Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

adc0808 not responding properly

Status
Not open for further replies.

iamalien

Newbie level 4
Joined
Mar 23, 2015
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
101
hello there i am trying to use the adc0808 with the microcontroller 8051 for a bigger project, so i wanted to test if i get correct output from the adc. To do this i made a temporary circuit and connected data pins to p3, eoc sc clock and ale to the port 0(used pull up too) and i am using only 1 input so i have kept others open and given address abc as 000 direct to ground and OE to vcc, vref+ to vcc, vref- to gnd and to test if conversion is happening, a pot in IN0. So i did what the datasheet says and sent controls accordingly but the eoc is not behaving properly, like i am checking for eoc pulse so that when it goes low to high the conversion would be over and until that happens the controller would check for it and so there is no output coming and stuck in that loop. This is my problem but when i tried the same circuit and code in proteus simulation everything works fine without any problem, please tell me what might be causing the problem
If u want to recheck the relevant part of the code is:(the adc value reading function:)

Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
unsigned char readadc() 
{  unsigned char adcvalue;
   delay(1);
   ale=1;
   delay(1);
   sc=1;
   delay(1);
   ale=0;
   delay(1);
   sc=0;
   while(eoc==1);
   while(eoc==0);
   delay(1);
   adcvalue=P3;
   delay(1);
   return adcvalue;
}

[the clock is given using timer interrupt continuously at 500khz, another thing i tried only checking eoc if it went 1 since it might do conversion under 1 to 8 us according to data sheet so the code moves forward but then i get random value from data lines, after that i tried without checking eoc and just waiting still then it was giving random values]
 

Vbase

Full Member level 6
Joined
Apr 7, 2015
Messages
367
Helped
74
Reputation
148
Reaction score
72
Trophy points
28
Activity points
1,997
eoc=1 at the end of conversion, swap lines 11 and 12.
 

iamalien

Newbie level 4
Joined
Mar 23, 2015
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
101
eoc=1 at the *end* of conversion just like it was at start of it, so if i want to check there is a low to high pulse wouldnt i be checking first for the eoc to go low then check for eoc to go high, the lines 11 and 12 do just that, 11 keeps running till eoc goes 0 then 12 keeps running till eoc goes 1
 

Vbase

Full Member level 6
Joined
Apr 7, 2015
Messages
367
Helped
74
Reputation
148
Reaction score
72
Trophy points
28
Activity points
1,997
You are right, my mistake.
The operating sequence also shows that you have to latch (enable) the output after the conversion ends by turning OE high and then low. Try this to see if you get valid output. Maybe it isn't good enough to put OE always high.
BTW I like your name.
 

iamalien

Newbie level 4
Joined
Mar 23, 2015
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
101
well i thought OE might be the problem but the datasheet said that OE is high only for giving output so i thought it might be for buffer only as enable signal, besides many people who have used this chip for continuous conversion have kept OE always high and didn't seem to have any problem for them(also if we look at the working of code on hardware what i saw was no output was given, and i made the program so that even if there is any value the controller should give some leds ON on the 1x7 column, and i didnt get any output meaning the program isnt going out of the eoc loop, which is what the big problem is)
 

Vbase

Full Member level 6
Joined
Apr 7, 2015
Messages
367
Helped
74
Reputation
148
Reaction score
72
Trophy points
28
Activity points
1,997
Hi Alien.
I'm afraid this is the best I could offer.
Earthly man
 

iamalien

Newbie level 4
Joined
Mar 23, 2015
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
101
both of them do the same thing in different ways, the second one for ex has put a delay instead of checking for eoc which i tried and it gave me random results, and even if it works i would have a greater delay problem since i am trying to run a led matrix display with the value i receive from the adc(the later part works only problem is this eoc thing i am facing in the adc)
 

hobbyckts

Advanced Member level 1
Joined
Mar 12, 2015
Messages
481
Helped
88
Reputation
176
Reaction score
85
Trophy points
28
Activity points
2,457
Try increasing the clock speed to 640Khz as it is the typical operating clock frequency with the time details mentioned in the datasheets.
 

Status
Not open for further replies.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top