본문 바로가기

[AnalogDevice]/ADuc81x

[Aduc84x EVM]DAC를 이용한 사인파 출력 테스트

[Aduc84x EVM]DAC를 이용한 사인파 출력 테스트



Aduc841의 DAC출력을 이용하여 사인파 출력 테스를 진행하였다.




사인파 출력 후 오실로스코프로 측정한 결과
Aduc812보드로 진행할 때 보다 속도가 빨라 그런지 아날로그 DAC출력에 대한 성능은 충분히 만족할 정도로 나오고 있다.



사인파 출력 소스코드

#include <stdio.h>

#include <ADuC841.h>

 

sbit LED = 0x0B4;

 

void main (void)

{

                  unsigned code values[64][2]={

                  {0x07, 0xFF},{0x08, 0xC8},{0x09, 0x8E},{0x0A, 0x51},{0x0B, 0x0F},

                  {0x0B, 0xC4},{0x0C, 0x71},{0x0D, 0x12},{0x0D, 0xA7},{0x0E, 0x2E},

                  {0x0E, 0xA5},{0x0F, 0x0D},{0x0F, 0x63},{0x0F, 0xA6},{0x0F, 0xD7},

                  {0x0F, 0xF5},{0x0F, 0xFF},{0x0F, 0xF5},{0x0F, 0xD7},{0x0F, 0xA6},

                  {0x0F, 0x63},{0x0F, 0x0D},{0x0E, 0xA5},{0x0E, 0x2E},{0x0D, 0xA7},

                  {0x0D, 0x12},{0x0C, 0x71},{0x0B, 0xC4},{0x0B, 0x0F},{0x0A, 0x51},

                  {0x09, 0x8E},{0x08, 0xC8},{0x07, 0xFF},{0x07, 0x36},{0x06, 0x70},

                  {0x05, 0xAD},{0x04, 0xEF},{0x04, 0x3A},{0x03, 0x8D},{0x02, 0xEC},

                  {0x02, 0x57},{0x01, 0xD0},{0x01, 0x59},{0x00, 0xF1},{0x00, 0x9B},

                  {0x00, 0x58},{0x00, 0x27},{0x00, 0x09},{0x00, 0x00},{0x00, 0x09},

                  {0x00, 0x27},{0x00, 0x58},{0x00, 0x9B},{0x00, 0xF1},{0x01, 0x59},

                  {0x01, 0xD0},{0x02, 0x57},{0x02, 0xEC},{0x03, 0x8D},{0x04, 0x3A},

                  {0x04, 0xEF},{0x05, 0xAD},{0x06, 0x70},{0x07, 0x36}};

                 

    DACCON = 0x0D;                //DAC0 on 12-bit Asynchronous

                     

    DAC0H = 0x08;                    //DAC0 mid scale

    DAC0L = 0x00;

 

                  while (1)

                  {

                                   int i;

                                   for ( i = 0 ; i < 64; i++)

                                   {

                                                     DAC0H = values[i][0];

                                                     DAC0L = values[i][1];

                                   }

                                    LED ^= 1;

                  }

}

                 

반응형