Adc0838
msh5686
Posts: 70
Hi All!
I'm using an ADC0838 to convert an analog voltage to a signal I can read into the BS2. I can't tell if my problem is with a the program (attached) or with my connections. When I debug the output from the chip, all I get is a full byte in decimal form (255). Something isn't right because I am varying the voltage going into the chip while debugging the output from the ADC, but it never changes. Using a DVM I have checked to make sure the voltage going into the channel I am reading is varying, but still just getting the decimal value of a byte out. Can anyone please give my program a once over? It seems simple enough, but I'm at a loss here. Thanks for the help!
I'm using an ADC0838 to convert an analog voltage to a signal I can read into the BS2. I can't tell if my problem is with a the program (attached) or with my connections. When I debug the output from the chip, all I get is a full byte in decimal form (255). Something isn't right because I am varying the voltage going into the chip while debugging the output from the ADC, but it never changes. Using a DVM I have checked to make sure the voltage going into the channel I am reading is varying, but still just getting the decimal value of a byte out. Can anyone please give my program a once over? It seems simple enough, but I'm at a loss here. Thanks for the help!
bs2
1K
Comments
The ADC0838 is pretty easy to use (with other people's code), but I sure got it wrong when I first tried to use it.
You need to decouple the ADC supply pin. Use a 10 uF capacitor as mentioned in the data sheet.
Basically your code is expecting data MSB first, however your wiring has it set for LSB first, IIRC. I am pretty sure grounding /SE wil correct that part.
How is the circuit constructed? I don't trust solderless breadboards and build things like that on home-made PCBs. I have very few problems.
That could be your problem...try using a pot with the outside leads connected to VDD and GND and the wiper connected to the channel input.
Also, I am really using a photocell as my variable voltage. It's output is very small so I am boosting it with an op amp. This gives me the 3.5 V I described earlier. The output from the op amp (3.5 V) is what I am sending into the ADC I am just using the variable supply to give my op amp (TCA0372) enough power to work. I do have one line on the breadboard dedicated to being a common ground between all these supplies, ie. negatives from the power supply, Vss on the stamp board, and the photocell all on one line. The unit is functioning to some degree in that when I cover part of the photocell, I see a voltage drop on the debug window. When covering as much as possible, I see the voltage drop close to zero. Does this make sense? The only part that is throwing me is how the values fluctuate when I am not changing anything to the photocell (DVM confirms steady voltage). Also, it does seem like there is some sort of pattern to the fluctuations in the debug window.... or maybe I'm just going crazy from looking at it for too long! Thanks for the help guys!
I have removed the external power supply from the equation that was being used to power the op amp. Now I have the same configuration as just stated, but the op amp is powered by the Vdd on the stamp board.
Let's see the op amp circuit. I could simulate it if necessary.