Trouble with ADC0831
Derek Brown
Posts: 1
Hey,
I'm trying to use an ADC0831CCN with my BS2 and a TSL257T but I'm getting nothing but all 00000000 when I run my program. I've never worked with these before and I am using the example program from the A/D book. I'm pretty sure that wired everything up right but I just cannot get any kind of reading from it. I even tried setting upa test circuit with a 10k pot and still no dice. I replaced the chip since I bought two and still nothing. Any ideas on what I may be doing wrong?
Here is that program.
'
[noparse][[/noparse] Title ]
' Basic Analog and Digital - PL3_1R0.bs2
' Program Listing 3.1 Revision 0.
' {$STAMP BS2}
' {$PBASIC 2.5}
'
[noparse][[/noparse] Declarations ]
adcBits VAR Word
v VAR Byte
r VAR Byte
v2 VAR Byte
v3 VAR Byte
'
[noparse][[/noparse] Initialization ]
CS PIN 0
CLK PIN 1
DataOutput PIN 2
DEBUG CLS 'Start display.
'
[noparse][[/noparse] Main Routine ]
DO
GOSUB ADC_Data
GOSUB Calc_Volts
GOSUB Display
LOOP
'
[noparse][[/noparse] Subroutines ]
ADC_Data:
LOW CLK
LOW CS
PULSOUT CLK, 210
SHIFTIN DataOutput,CLK,MSBPOST,[noparse][[/noparse]adcBits]
HIGH CS
RETURN
Calc_Volts:
RETURN
Display:
DEBUG HOME
DEBUG "8-bit binary value: ", BIN8 adcBits
RETURN
NOTE: ADC pin arrangement
1) P0
2) input from pot/TSL
3) Vss
4) Vss
5) Vdd
6) P2
7) P1
8) Vdd
Thanks,
Derek
I'm trying to use an ADC0831CCN with my BS2 and a TSL257T but I'm getting nothing but all 00000000 when I run my program. I've never worked with these before and I am using the example program from the A/D book. I'm pretty sure that wired everything up right but I just cannot get any kind of reading from it. I even tried setting upa test circuit with a 10k pot and still no dice. I replaced the chip since I bought two and still nothing. Any ideas on what I may be doing wrong?
Here is that program.
'
[noparse][[/noparse] Title ]
' Basic Analog and Digital - PL3_1R0.bs2
' Program Listing 3.1 Revision 0.
' {$STAMP BS2}
' {$PBASIC 2.5}
'
[noparse][[/noparse] Declarations ]
adcBits VAR Word
v VAR Byte
r VAR Byte
v2 VAR Byte
v3 VAR Byte
'
[noparse][[/noparse] Initialization ]
CS PIN 0
CLK PIN 1
DataOutput PIN 2
DEBUG CLS 'Start display.
'
[noparse][[/noparse] Main Routine ]
DO
GOSUB ADC_Data
GOSUB Calc_Volts
GOSUB Display
LOOP
'
[noparse][[/noparse] Subroutines ]
ADC_Data:
LOW CLK
LOW CS
PULSOUT CLK, 210
SHIFTIN DataOutput,CLK,MSBPOST,[noparse][[/noparse]adcBits]
HIGH CS
RETURN
Calc_Volts:
RETURN
Display:
DEBUG HOME
DEBUG "8-bit binary value: ", BIN8 adcBits
RETURN
NOTE: ADC pin arrangement
1) P0
2) input from pot/TSL
3) Vss
4) Vss
5) Vdd
6) P2
7) P1
8) Vdd
Thanks,
Derek
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen