| ??? 07/27/03 02:26 Read: times |
#51509 - help on ADC0838 |
hi everyone ...
yeah I'm trying to hook up a ADC0838 to my 8052. but the strange thing is that this chip is highly undocumented and I couldn't find any working examples. I read the data sheet and I have everything done correctly but the ADC still gives me a stream of 0s when I connect 5 volts to the channel 1 input. heres my code: <code> ;Reads the ADC ;########################################################################### ReadADC: mov R7,#5 ;set a counter for the 5 address bits mov R6,#8 ;set a counter for the 8 input bits clr CLK clr ADCS ;start a conversion ADILoop: rrc a ;move the bit into c mov DIO,c ;move the bit into the IO line call ADpulse ;send a clock pulse djnz R7,ADILoop ;if the 6 bits have been transmitted then mov a,#0 call ADpulse ;the initialization pulse ADOLoop: call ADpulse ;Pulse, data is now available mov c,DIO ;move the data in c rlc a ;shift the bit in a djnz R6,ADOLoop ;if the 8 bits have been recieved setb ADCS ;disable the ADC ret ;code in acc ;Creates a pulse for the ADC fuctionality ;########################################################################### ADpulse: push b ;save b for now mov b,#9 djnz b,$ setb CLK ;set the clock pulse mov b,#9 djnz b,$ clr CLK ;clear the pulse pop b ret </code> yeah but I dont get any output. I have tried another chip in case this one is a goner but that didn't work either ... can someone help? I can send the circuit if it's needed. Yeah thanks. Nima |
| Topic | Author | Date |
| help on ADC0838 | 01/01/70 00:00 | |
| RE: help on ADC0838 | 01/01/70 00:00 | |
RE: help on ADC0838 | 01/01/70 00:00 |



