Anything wrong with this code...
Archiver
Posts: 46,084
Hi all,
Try as hard as I can I've rebuilt the circuit several times on different
breadboards and I still can't get a reading from a MAX186 to a BS2-IC... I have
two MAX186 from Maxim and neither work. If I put a scope on the SSTRB line I can
see the out pulse from the MAX186...
Anything wrong with this:
'{$STAMP BS2}
'VARs
ADCin VAR Word 'ADC reading
' CONs
cs CON 0 'enable or disable A to D converter > Max186 pin 18
serDo CON 1 'serial data out > Max186 pin 15
serDin CON 2 'serial data in > Max186 pin 17
serclk CON 3 'serial Clock > Max186 pin 19
' MAX186 Input byte
'
' Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0
' Start Sel2 Sel1 Sel0 Unipolar SGL PD1 PD0
' 1 x x x 1 1 1 0
' 1 0 0 0 1 1 1 0 = 142
ch0 CON %10001110 ' = 142
' Setup i/o pins
INPUT serDin
OUTPUT serDo
OUTPUT cs
OUTPUT serclk
LOW serDo
LOW cs
LOW serclk
' Get ready
HIGH cs 'disable
PAUSE 500
main:
LOW cs 'enable
SHIFTOUT serDo, serclk, MSBFIRST,[noparse][[/noparse]ch0] 'send the channel data
SHIFTIN serDin, serclk, MSBPOST ,[noparse][[/noparse]ADCin\12] 'the reading
HIGH cs 'disable
DEBUG HOME
DEBUG "Using Channel: Zero", CR
DEBUG DEC ADCin DIG 3,".", DEC ADCin DIG 2, DEC ADCin DIG 1, DEC ADCin DIG 0
," Volts"
GOTO main
[noparse][[/noparse]Non-text portions of this message have been removed]
Try as hard as I can I've rebuilt the circuit several times on different
breadboards and I still can't get a reading from a MAX186 to a BS2-IC... I have
two MAX186 from Maxim and neither work. If I put a scope on the SSTRB line I can
see the out pulse from the MAX186...
Anything wrong with this:
'{$STAMP BS2}
'VARs
ADCin VAR Word 'ADC reading
' CONs
cs CON 0 'enable or disable A to D converter > Max186 pin 18
serDo CON 1 'serial data out > Max186 pin 15
serDin CON 2 'serial data in > Max186 pin 17
serclk CON 3 'serial Clock > Max186 pin 19
' MAX186 Input byte
'
' Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0
' Start Sel2 Sel1 Sel0 Unipolar SGL PD1 PD0
' 1 x x x 1 1 1 0
' 1 0 0 0 1 1 1 0 = 142
ch0 CON %10001110 ' = 142
' Setup i/o pins
INPUT serDin
OUTPUT serDo
OUTPUT cs
OUTPUT serclk
LOW serDo
LOW cs
LOW serclk
' Get ready
HIGH cs 'disable
PAUSE 500
main:
LOW cs 'enable
SHIFTOUT serDo, serclk, MSBFIRST,[noparse][[/noparse]ch0] 'send the channel data
SHIFTIN serDin, serclk, MSBPOST ,[noparse][[/noparse]ADCin\12] 'the reading
HIGH cs 'disable
DEBUG HOME
DEBUG "Using Channel: Zero", CR
DEBUG DEC ADCin DIG 3,".", DEC ADCin DIG 2, DEC ADCin DIG 1, DEC ADCin DIG 0
," Volts"
GOTO main
[noparse][[/noparse]Non-text portions of this message have been removed]