+ Post New Thread
Results 1 to 9 of 9
  1. #1
    Newbie level 4
    Points: 164, Level: 2

    Join Date
    Mar 2015
    Posts
    5
    Helped
    0 / 0
    Points
    164
    Level
    2

    adc0808 not responding properly

    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]

    •   AltAdvertisement

        
       

  2. #2
    Full Member level 6
    Points: 2,302, Level: 11

    Join Date
    Apr 2015
    Posts
    366
    Helped
    72 / 72
    Points
    2,302
    Level
    11

    Re: adc0808 not responding properly

    eoc=1 at the end of conversion, swap lines 11 and 12.



  3. #3
    Newbie level 4
    Points: 164, Level: 2

    Join Date
    Mar 2015
    Posts
    5
    Helped
    0 / 0
    Points
    164
    Level
    2

    Re: adc0808 not responding properly

    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



    •   AltAdvertisement

        
       

  4. #4
    Full Member level 6
    Points: 2,302, Level: 11

    Join Date
    Apr 2015
    Posts
    366
    Helped
    72 / 72
    Points
    2,302
    Level
    11

    Re: adc0808 not responding properly

    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.



    •   AltAdvertisement

        
       

  5. #5
    Newbie level 4
    Points: 164, Level: 2

    Join Date
    Mar 2015
    Posts
    5
    Helped
    0 / 0
    Points
    164
    Level
    2

    Re: adc0808 not responding properly

    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)



  6. #6
    Full Member level 6
    Points: 2,302, Level: 11

    Join Date
    Apr 2015
    Posts
    366
    Helped
    72 / 72
    Points
    2,302
    Level
    11

    Re: adc0808 not responding properly

    Hi Alien.
    I'm afraid this is the best I could offer.
    Earthly man



  7. #7
    Banned
    Points: 12,436, Level: 26

    Join Date
    Apr 2013
    Posts
    2,528
    Helped
    538 / 538
    Points
    12,436
    Level
    26

    Re: adc0808 not responding properly




    •   AltAdvertisement

        
       

  8. #8
    Newbie level 4
    Points: 164, Level: 2

    Join Date
    Mar 2015
    Posts
    5
    Helped
    0 / 0
    Points
    164
    Level
    2

    Re: adc0808 not responding properly

    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)



  9. #9
    Advanced Member level 1
    Points: 2,589, Level: 11

    Join Date
    Mar 2015
    Posts
    481
    Helped
    88 / 88
    Points
    2,589
    Level
    11

    Re: adc0808 not responding properly

    Try increasing the clock speed to 640Khz as it is the typical operating clock frequency with the time details mentioned in the datasheets.



--[[ ]]--