DAC_data()
{
unsigned int UpHex,MidHex,LowHex,wDigVoltage,Temp,i;
while(1)
{
unsigned int dac_ip[]= { 0x03C,0x03D,0x03E,0x03F,0x040,0x041,0x042,0x043,0x044,0x045,0x046,0x047,0x048,0x049,0x04A,0x04B,
0x04C,0x04D,0x04E,0x04F,0x050,0x051,0x052,0x053,0x054,0x055,0x056,0x057,0x058,0x059,0x05A,0x05B,
0x05C,0x05D,0x05E,0x05F,0x060,0x061,0x062,0x063,0x064,0x065,0x066,0x067,0x068,0x069,0x06A,0x06B,
0x06C,0x06D,0x06E,0x06F,0x070,0x071,0x072,0x073,0x074,0x075,0x076,0x077,0x078,0x078,0x078,0x078,
0x078,0x078,0x078,0x078,0x078,0x078,0x078,0x078,0x078,0x078,0x078,0x078,0x078,0x078,0x078,0x078,
0x078,0x077,0x076,0x075,0x075,0x074,0x073,0x072,0x071,0x070,0x06F,0x06E,0x06D,0x06C,0x06B,0x06A,
0x069,0x068,0x067,0x065,0x064,0x063,0x062,0x061,0x060,0x05F,0x05E,0x05D,0x05C,0x05B,0x05A,0x059,
0x058,0x057,0x056,0x055,0x054,0x053,0x052,0x051,0x050,0x04F,0x04E,0x04D,0x04C,0x04B,0x04A,0x049,
0x048,0x047,0x046,0x045,0x044,0x043,0x042,0x041,0x040,0x03F,0x03E,0x03D,0x03C,0x03B,0x03A,0x039,
0x038,0x037,0x036,0x035,0x034,0x033,0x032,0x031,0x030,0x02F,0x02E,0x02D,0x02C,0x02B,0x02A,0x029,
0x028,0x027,0x026,0x025,0x024,0x023,0x022,0x021,0x020,0x01F,0x01E,0x01D,0x01C,0x01B,0x01A,0x019,
0x026,0x025,0x018,0x017,0x016,0x015,0x014,0x013,0x012,0x011,0x010,0x00F,0x00E,0x00D,0x00C,0x00B,
0x00A,0x009,0x008,0x007,0x006,0x005,0x004,0x003,0x002,0x001,0x000,0x000,0x000,0x000,0x000,0x000,
0x000,0x000,0x000,0x000,0x000,0x000,0x000,0x000,0x000,0x000,0x001,0x002,0x003,0x004,0x005,0x006,
0x007,0x008,0x009,0x010,0x00A,0x00B,0x00C,0x00D,0x00E,0x00F,0x011,0x012,0x013,0x014,0x015,0x016,
0x017,0x018,0x019,0x01A,0x01B,0x01C,0x01D,0x01E,0x01F,0x020,0x021,0x022,0x023,0x024,0x025,0x026,
0x027,0x028,0x029,0x02A,0x02B,0x02C,0x02D,0x02E,0x02F,0x030,0x031,0x032,0x033,0x034,0x035,0x036,
0x037,0x038,0x039,0x03A,0x03B
};
for(i=0;i<277;i++)
{
Temp = dac_ip;
.
.
*ptr_dac_reg= wDigVoltage ;
ReadADC( );
}
Here the function DAC data() has a look up table of around 277 samples.
case 1: the function ReadADC(); is NOT included
the for loop takes each samples and covert to analog voltages. so this 277 samples makes a sine wave of around 2.23Khz. amplitude is 100mVpp.
case 2: the function ReadADC(); is included
in this case the output frequency changes to around 200Hz.. because of this additinal function. this is the actual problem
the frequency (2.23Khz )should not change when ADC is included. What should i do ??
{
unsigned int UpHex,MidHex,LowHex,wDigVoltage,Temp,i;
while(1)
{
unsigned int dac_ip[]= { 0x03C,0x03D,0x03E,0x03F,0x040,0x041,0x042,0x043,0x044,0x045,0x046,0x047,0x048,0x049,0x04A,0x04B,
0x04C,0x04D,0x04E,0x04F,0x050,0x051,0x052,0x053,0x054,0x055,0x056,0x057,0x058,0x059,0x05A,0x05B,
0x05C,0x05D,0x05E,0x05F,0x060,0x061,0x062,0x063,0x064,0x065,0x066,0x067,0x068,0x069,0x06A,0x06B,
0x06C,0x06D,0x06E,0x06F,0x070,0x071,0x072,0x073,0x074,0x075,0x076,0x077,0x078,0x078,0x078,0x078,
0x078,0x078,0x078,0x078,0x078,0x078,0x078,0x078,0x078,0x078,0x078,0x078,0x078,0x078,0x078,0x078,
0x078,0x077,0x076,0x075,0x075,0x074,0x073,0x072,0x071,0x070,0x06F,0x06E,0x06D,0x06C,0x06B,0x06A,
0x069,0x068,0x067,0x065,0x064,0x063,0x062,0x061,0x060,0x05F,0x05E,0x05D,0x05C,0x05B,0x05A,0x059,
0x058,0x057,0x056,0x055,0x054,0x053,0x052,0x051,0x050,0x04F,0x04E,0x04D,0x04C,0x04B,0x04A,0x049,
0x048,0x047,0x046,0x045,0x044,0x043,0x042,0x041,0x040,0x03F,0x03E,0x03D,0x03C,0x03B,0x03A,0x039,
0x038,0x037,0x036,0x035,0x034,0x033,0x032,0x031,0x030,0x02F,0x02E,0x02D,0x02C,0x02B,0x02A,0x029,
0x028,0x027,0x026,0x025,0x024,0x023,0x022,0x021,0x020,0x01F,0x01E,0x01D,0x01C,0x01B,0x01A,0x019,
0x026,0x025,0x018,0x017,0x016,0x015,0x014,0x013,0x012,0x011,0x010,0x00F,0x00E,0x00D,0x00C,0x00B,
0x00A,0x009,0x008,0x007,0x006,0x005,0x004,0x003,0x002,0x001,0x000,0x000,0x000,0x000,0x000,0x000,
0x000,0x000,0x000,0x000,0x000,0x000,0x000,0x000,0x000,0x000,0x001,0x002,0x003,0x004,0x005,0x006,
0x007,0x008,0x009,0x010,0x00A,0x00B,0x00C,0x00D,0x00E,0x00F,0x011,0x012,0x013,0x014,0x015,0x016,
0x017,0x018,0x019,0x01A,0x01B,0x01C,0x01D,0x01E,0x01F,0x020,0x021,0x022,0x023,0x024,0x025,0x026,
0x027,0x028,0x029,0x02A,0x02B,0x02C,0x02D,0x02E,0x02F,0x030,0x031,0x032,0x033,0x034,0x035,0x036,
0x037,0x038,0x039,0x03A,0x03B
};
for(i=0;i<277;i++)
{
Temp = dac_ip;
.
.
*ptr_dac_reg= wDigVoltage ;
ReadADC( );
}
Here the function DAC data() has a look up table of around 277 samples.
case 1: the function ReadADC(); is NOT included
the for loop takes each samples and covert to analog voltages. so this 277 samples makes a sine wave of around 2.23Khz. amplitude is 100mVpp.
case 2: the function ReadADC(); is included
in this case the output frequency changes to around 200Hz.. because of this additinal function. this is the actual problem
the frequency (2.23Khz )should not change when ADC is included. What should i do ??