Reset BS2SX
Manuel
Posts: 105
Hello:
Is it possible to me to reset my BS2sx by connecting a pin to the reset and using the·low command?
Or is there a better way to do that with code?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Best Regards
Manuel C. Reinhard
Is it possible to me to reset my BS2sx by connecting a pin to the reset and using the·low command?
Or is there a better way to do that with code?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Best Regards
Manuel C. Reinhard
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Best Regards
Manuel C. Reinhard
· HIGH 0
makes pin 0 and output and sets it to 1. In your case with reset, you might do this:
· Reset··· PIN··· 0
The pin will be initialized (after power-up or hard reset) as an input, so it can be left alone.· Then, if you have some emergency that causes you to want to do a hard reset, do this:
Emergency_Reset:
· LOW Reset
· END
You don't need to do anything else -- and be sure you don't do anything with the pin called Reset except use it as I've shown you above.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Best Regards
Manuel C. Reinhard
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
' {$STAMP BS2sx}
' {$PBASIC 2.5}
INPUT 1
INPUT 2
INPUT 3
to_see VAR Word
sensor CON 5
met VAR Word
mes VAR Word
to_cont VAR Byte
x VAR Byte
meters VAR Word
met_two VAR Byte
meters = 0
q VAR Word
enter VAR Byte
LCD CON 0
LcdCls········· CON···· $0C
LcdOn1· ········CON···· $16
LCDBaud······ CON···· 110
Scale······ CON···· $0CD
LcdLine1······· CON···· $80
LcdLine2······· CON···· $94
prendido:
SEROUT LCD, LcdBaud, [noparse][[/noparse]$11]
HIGH LCD
PAUSE 100
· SEROUT LCD, LcdBaud, [noparse][[/noparse]$11, $16]
start:
· SEROUT LCD, LcdBaud, [noparse][[/noparse]$0c]
· SEROUT LCD, LcdBaud, [noparse][[/noparse]LcdLine1, "Insert"]
· PAUSE 1000
· SEROUT LCD, LcdBaud, [noparse][[/noparse]$0c]
· SEROUT LCD, LcdBaud, [noparse][[/noparse]LcdLine1, "length ", LCDLine2, "in· meters"]
· PAUSE 1000
··· SEROUT LCD, LcdBaud, [noparse][[/noparse]$0c]
· SEROUT LCD, LcdBaud, [noparse][[/noparse]LcdLine1, "For 400 meters", LCDLine2, "press 1"]
· PAUSE 1000
··· SEROUT LCD, LcdBaud, [noparse][[/noparse]$0c]
··· SEROUT LCD, LcdBaud, [noparse][[/noparse]LcdLine1, "When finished", LCDline2, "press enter"]
PAUSE 1000
· SEROUT LCD, LcdBaud, [noparse][[/noparse]$0c]
··· SEROUT LCD, LcdBaud, [noparse][[/noparse]LcdLine1, "Press enter ", LCDline2, " to continue "]
PAUSE 1000
GOTO enters
enters:
BUTTON 3, 1, 10, 20, enter, 1, metros
PAUSE 20
BUTTON 2, 1, 10, 20, enter, 1, cuatro
PAUSE 20
GOTO enters
·
metros:
· SEROUT LCD, LcdBaud, [noparse][[/noparse]$0c]
· SEROUT LCD, LcdBaud, [noparse][[/noparse]lcdline1, "Meters", Lcdline2,"· ", DEC meters/10, DEC met]
· PAUSE 50
· GOTO add
add:
BUTTON 4, 1, 10, 20, enter, 1, cien
PAUSE 30
BUTTON 1, 1, 10, 20, enter, 1, diez
PAUSE 30
BUTTON 2, 1, 10, 20, enter, 1, uno
PAUSE 30
BUTTON 3, 1, 10, 20, enter, 1, cont
PAUSE 30
GOTO add
cien:
meters = meters+100 MAX 2470
GOTO metros
diez:
meters = meters+10 MAX 2470
GOTO metros
uno:
met = met+1
IF met = 10 THEN cambio
GOTO metros
cambio:
meters = meters +10
met = 0
GOTO metros
cuatro:
meters = 400
GOTO cont
cont:
SEROUT lcd, lcdbaud, [noparse][[/noparse]$0c]
SEROUT LCD, LCDbaud, [noparse][[/noparse]lcdline1, DEC meters/10, DEC met , " Meters", lcdline2, "Press enter"]
PAUSE 1500
met_two = ((met * 265)/10)
q =(((meters/10)*265)+((meters/10)/4)+met_two)
·
SEROUT LCD, LCDbaud, [noparse][[/noparse]lcdline2, "To continue"]
PAUSE 1000
SEROUT LCD, LCDbaud, [noparse][[/noparse]lcdline2, "1 to cancel"]
······ PAUSE 1000
sigue:
BUTTON 3, 1, 10, 20, enter, 1, preparar
PAUSE 20
BUTTON 2, 1, 10, 20, enter, 1, resetear
GOTO sigue
·
preparar:
· SEROUT LCD, LcdBaud, [noparse][[/noparse]$0c]
· GOTO contar
·
contar:
DO
SEROUT lcd, lcdbaud, [noparse][[/noparse]lcdline1, $09, $09, $09, DEC ((mes * 377)/10000),"/", DEC meters/10, DEC met , lcdline2, "Meters"]·· 'check variable overflow
IF IN9 = 1 THEN mes = mes + 1
DO: LOOP WHILE IN9 = 1
LOOP WHILE mes < q
Finalizar:
HIGH 9
PAUSE 500
LOW 9
· SEROUT LCD, LcdBaud, [noparse][[/noparse]$0c]
· PAUSE 50
SEROUT lcd, lcdbaud, [noparse][[/noparse]lcdline1, "Finished ", DEC meters/10, DEC met, " mts.", lcdline2, "Press enter"]
ending:
BUTTON 3, 1, 10, 20, enter, 1, reset_var
PAUSE 20
GOTO ending
· Reset_var:
met = 0
meters = 0
mes = 0
GOTO start
END
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Best Regards
Manuel C. Reinhard
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Best Regards
Manuel C. Reinhard
The problem is that it wont display me in the lcd anymore that the variable increases. The variable stays stuck at 0.
DO
SEROUT lcd, lcdbaud, [noparse][[/noparse]lcdline1, $09, $09, $09, DEC ((mes * 377)/10000),"/", DEC meters/10, DEC met , lcdline2, "Meters"] 'check variable overflow
IF IN9 = 1 THEN mes = mes + 1
DO: LOOP WHILE IN9 = 1
LOOP WHILE mes < q
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Best Regards
Manuel C. Reinhard
LOL
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Best Regards
Manuel C. Reinhard
PS (and to the powers that be) - there should really be some kind of chat room for this back-and-forth posting.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Best Regards
Manuel C. Reinhard
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Best Regards
Manuel C. Reinhard
HTH.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Truly Understand the Fundamentals and the Path will be so much easier...