Nicolina2
Newbie level 2
Hi!
Somebody have experience using AD7711A, a 24 bit analog to digital converter?
I have a problem somewhere, because I can't see the right data on a LCD display... the good value is just in flashing at 2 - 3 second on LCD display ... in the rest, the measured value of analogic signal is 0.
The AD7711A is conected at a AT89C2051 microcontroller, and this one display data on a LCD with 2 lines, compatible with HD44780 standard
In infinite while loop I have:
while(1)
{
write_to_ADC(0xA097D0); // initialization code, mean Activate BAckground Calibration, gain 1, chanel 0, Unipolar, and the number at Filter Selection is 2000
if(flag_received_data24 == 1)
{
display_no(curent_data24);
flag_received_data24 = 0;
EX0 = 1; // enable int0
}
}
the external interrupt 0 is:
void int_ext_0(void) interrupt 0
{
EX0 = 0; // invalidarea intreruperii externe 0
curent_data24 = read_from_ADC();
flag_received_data24 = 1;
}
and the reading and writing to AD7711A functions are:
void write_to_ADC(unsigned long int data24)
{
long int compara,numarat;
TFS = 1; RFS = 1; SCLK = 0;
TFS = 0;
compara = ((unsigned long)1)<<23;
for (numarat=compara;numarat>0;numarat>>=1)
{
if((data24 & numarat)==0) SDATA = 0;
else SDATA = 1;
SCLK = 1;
SCLK = 0;
}
TFS = 1;
}
unsigned long int read_from_ADC(void)
{
unsigned char i;
unsigned long int data24;
data24 = 0;
TFS = 1; RFS = 1; SCLK = 0;
RFS = 0;
for(i=0;i<24;i++)
{
SCLK = 1;
data24 = data24 | SDATA;
SCLK = 0;
data24<<=1;
}
RFS = 1;
data24>>=1;
return data24;
}
I put on attachment the a jpeg with the schematic... but if you want to help me,
I can send you the full source code, just write me at hai@k.ro
I am in the situation: all is perfect but is not working...
PLEASE HELP ME!
Stelian
Somebody have experience using AD7711A, a 24 bit analog to digital converter?
I have a problem somewhere, because I can't see the right data on a LCD display... the good value is just in flashing at 2 - 3 second on LCD display ... in the rest, the measured value of analogic signal is 0.
The AD7711A is conected at a AT89C2051 microcontroller, and this one display data on a LCD with 2 lines, compatible with HD44780 standard
In infinite while loop I have:
while(1)
{
write_to_ADC(0xA097D0); // initialization code, mean Activate BAckground Calibration, gain 1, chanel 0, Unipolar, and the number at Filter Selection is 2000
if(flag_received_data24 == 1)
{
display_no(curent_data24);
flag_received_data24 = 0;
EX0 = 1; // enable int0
}
}
the external interrupt 0 is:
void int_ext_0(void) interrupt 0
{
EX0 = 0; // invalidarea intreruperii externe 0
curent_data24 = read_from_ADC();
flag_received_data24 = 1;
}
and the reading and writing to AD7711A functions are:
void write_to_ADC(unsigned long int data24)
{
long int compara,numarat;
TFS = 1; RFS = 1; SCLK = 0;
TFS = 0;
compara = ((unsigned long)1)<<23;
for (numarat=compara;numarat>0;numarat>>=1)
{
if((data24 & numarat)==0) SDATA = 0;
else SDATA = 1;
SCLK = 1;
SCLK = 0;
}
TFS = 1;
}
unsigned long int read_from_ADC(void)
{
unsigned char i;
unsigned long int data24;
data24 = 0;
TFS = 1; RFS = 1; SCLK = 0;
RFS = 0;
for(i=0;i<24;i++)
{
SCLK = 1;
data24 = data24 | SDATA;
SCLK = 0;
data24<<=1;
}
RFS = 1;
data24>>=1;
return data24;
}
I put on attachment the a jpeg with the schematic... but if you want to help me,
I can send you the full source code, just write me at hai@k.ro
I am in the situation: all is perfect but is not working...
PLEASE HELP ME!
Stelian