Adc0808
sameia
Posts: 7
hi
am programming ADC0808 by basic program and am using ·BS2 chip
I have two analog sensors which give me different voltage 3 and 5
i want to convert·those· sensors to digital
this is my program , i need someone to check and correct the program for me·plzz
>>>>
' {$STAMP BS2}
' {$PBASIC 2.5}
' {$PORT COM5}
·Addr PIN 5
·SC PIN 3
·ALE PIN 4
·RD PIN 2
·EOC PIN 6
DIRS = %1000000000111111
X VAR Byte
Y VAR Byte
begin:
X =0
Y =0
OUTH =0
DO
LOW Addr
DEBUG "s"
PULSOUT ALE ,5
DEBUG "a"
PULSOUT SC,5
DEBUG "l"
'WAIT FOR END OF Converstion Cycle-Optional
DO
LOOP UNTIL (IN6 = 0)
DO
LOOP UNTIL (IN6 = 1)
·DEBUG "L"
PULSOUT RD,5
X = INH
DEBUG X
SEROUT 0, 84, [noparse][[/noparse]X]
DO
PAUSE 500
X= Y+1
LOOP UNTIL (Y =10)
GOTO begin
DO
SEROUT 0, 84, [noparse][[/noparse]X ]
DEBUG BIN X, CR
X= X+1
PAUSE 500
·LOOP
·' two sensors
· IF ( x>3 ) THEN
· ENDIF
· IF ( y>5 ) THEN
· ENDIF
X =Y+1
LOOP UNTIL (Y= 10)
GOTO Begin
·LOOP
END
in addition am using 555 timer for the clock that is why i didn't included in the program
·
am programming ADC0808 by basic program and am using ·BS2 chip
I have two analog sensors which give me different voltage 3 and 5
i want to convert·those· sensors to digital
this is my program , i need someone to check and correct the program for me·plzz
>>>>
' {$STAMP BS2}
' {$PBASIC 2.5}
' {$PORT COM5}
·Addr PIN 5
·SC PIN 3
·ALE PIN 4
·RD PIN 2
·EOC PIN 6
DIRS = %1000000000111111
X VAR Byte
Y VAR Byte
begin:
X =0
Y =0
OUTH =0
DO
LOW Addr
DEBUG "s"
PULSOUT ALE ,5
DEBUG "a"
PULSOUT SC,5
DEBUG "l"
'WAIT FOR END OF Converstion Cycle-Optional
DO
LOOP UNTIL (IN6 = 0)
DO
LOOP UNTIL (IN6 = 1)
·DEBUG "L"
PULSOUT RD,5
X = INH
DEBUG X
SEROUT 0, 84, [noparse][[/noparse]X]
DO
PAUSE 500
X= Y+1
LOOP UNTIL (Y =10)
GOTO begin
DO
SEROUT 0, 84, [noparse][[/noparse]X ]
DEBUG BIN X, CR
X= X+1
PAUSE 500
·LOOP
·' two sensors
· IF ( x>3 ) THEN
· ENDIF
· IF ( y>5 ) THEN
· ENDIF
X =Y+1
LOOP UNTIL (Y= 10)
GOTO Begin
·LOOP
END
in addition am using 555 timer for the clock that is why i didn't included in the program
·
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
it doesnt read the 8 pins, and i dont know how to program the input voltages as you can see my sensors are x and y
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen