Greetings,
I am trying to use the ADC0808 with the 8051 microcontroller. But I am having a little trouble in the conversion of the device. Recently I programmed these functions to pulse the necessary pins of the device according to datasheet
The code is below
Basically the P2 port is connected to the control lines of the ADC and the P1 port is connected to the data bus of the ADC. I tested this program in the HyperTerminal and the serial communications is ok but the ADC is still not converting...
The enviroment of the experiment was in these conditions:
12MHz of clock for the 8051 uC
1MHz of clock for the ADC0808
I am trying to use the ADC0808 with the 8051 microcontroller. But I am having a little trouble in the conversion of the device. Recently I programmed these functions to pulse the necessary pins of the device according to datasheet
The code is below
Rich (BB code):
void adc_convert()
{
P2_0=0;
P2_1=0;
P2_2=0;
delay_small();
// Pulses the ALE and the START respectvely to starts the conversion...
P2_3=1;
delay_small();
P2_4=1;
delay_small();
// Disables the ALE and START...
P2_3=0;
delay_small();
P2_4=0;
}
void send_portP1()
{
xtod(P1);
SBUF=0x30+Hundreds_Cnt;
while(!TI);
TI=0;
SBUF=0x30+Tens_Cnt;
while(!TI);
TI=0;
SBUF=0x30+Ones_Cnt;
while(!TI);
TI=0;
SBUF=0x0A; // Sends the "\n"
while(!TI);
TI=0;
}
void int0() interrupt 0
{
P2_5=1; // Enables the OE
delay_small();
P2_5=0; // Disables the OE
while(IE0);
send_portP1();
REN=1;
P2=0x00;
}
The enviroment of the experiment was in these conditions:
12MHz of clock for the 8051 uC
1MHz of clock for the ADC0808