Need to know how to use a character string as an input to debugin
VinceKas
Posts: 2
Need to know how to use a character string as an input to debugin. The following is a portion of a working program. I merely type in A or B into the debug screen and the program jumps to the appropriate subroutine. Now I would like to use a character srtring like LAMP1 or Lamp2 in place of A or B. The program should not jump to the subroutines until the entire string character is typed in. How do you do it?
'Declare Variables
LED·· VAR Byte
LED1· VAR Byte
LED2· VAR Byte
L1··· VAR Byte
DO
· DEBUG CLS
· DEBUG "INSTRUCTIONS", CR
· DEBUG "Enter L1 to select LED 1 Or· Enter L2 to Select LED 2", CR
· 'Enter A OR B FOR LED1 OR LED2 CONTROL
· DEBUGIN LED
· IF (LED= "I"OR"i")THEN
· GOSUB LEDONOFF1_SUBROUTINE
· ELSEIF (LED="A"0R"a")THEN
· GOSUB LEDONOFF2_SUBROUTINE
· ENDIF
· LOOP
Post Edited By Moderator (Chris Savage (Parallax)) : 5/15/2008 3:23:36 PM GMT
'Declare Variables
LED·· VAR Byte
LED1· VAR Byte
LED2· VAR Byte
L1··· VAR Byte
DO
· DEBUG CLS
· DEBUG "INSTRUCTIONS", CR
· DEBUG "Enter L1 to select LED 1 Or· Enter L2 to Select LED 2", CR
· 'Enter A OR B FOR LED1 OR LED2 CONTROL
· DEBUGIN LED
· IF (LED= "I"OR"i")THEN
· GOSUB LEDONOFF1_SUBROUTINE
· ELSEIF (LED="A"0R"a")THEN
· GOSUB LEDONOFF2_SUBROUTINE
· ENDIF
· LOOP
Post Edited By Moderator (Chris Savage (Parallax)) : 5/15/2008 3:23:36 PM GMT
Comments
If you declare LED as a byte array (" LED VAR BYTE(2)" ) and then use the "STR" input instead of DEBUGIN
" SERIN 16, 16864, [noparse][[/noparse]STR LED] "
Then, when you enter "L1<enter>" (<enter> meaning the <enter> key) then LED(0) will hold "L" and LED(1) will hold "1".
I·know that you are NEW to the Forum and that ok and·I welcome you to the Forum
Please go back to your first post and put this in as· the subject line
at the top of the page·
How to use a character string as an input to debugin
Thank You for doing this·will help ·all of us that read·post on the forum·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any··that you may have and all of your time finding them
·
·
·
·
Sam
Post Edited (sam_sam_sam) : 5/14/2008 9:37:08 PM GMT