SERIN bs2px
Hi everybody,
I·wrote this simple prog for the bs2px :
X VAR Word
SERIN 16, 16572, [noparse][[/noparse]DEC X]
DO
· SEROUT 16, 16572, [noparse][[/noparse]"Test", CR]
· PAUSE X
·LOOP
It works fine. What I would like to do is that when I enter another value for X in the debug terminal and I press enter, I want that the X get the new value entered.
Any idea please?
Thank you.
Doc
I·wrote this simple prog for the bs2px :
X VAR Word
SERIN 16, 16572, [noparse][[/noparse]DEC X]
DO
· SEROUT 16, 16572, [noparse][[/noparse]"Test", CR]
· PAUSE X
·LOOP
It works fine. What I would like to do is that when I enter another value for X in the debug terminal and I press enter, I want that the X get the new value entered.
Any idea please?
Thank you.
Doc
Comments
Have a look at the DEBUGIN command in the help file. I think it wil give you what you want.
Cheers,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tom Sisk
http://www.siskconsult.com
·
I 've already tried to work on DEBUGIN, but did not find anything helpful in this command except that it is a special case of SERIN.
What I am looking for, is that while the prog is running and without interruption, to enter new value of "X" and that this new value could be considered in the Do Loop. I worked with SERIN because I wanted to check how to do if I want to send this new value of X through VB6 MSComm.
Cheers,
Doc
So, the way you have it now, you get one value for x at the start of the program, but you never go back to get another.
What about putting the serin within the DO-LOOP with a small timeout delay so if no new value is sent, the serout continues.
The term "without interruption" is a bit relative because you don't have a comm buffer to receive data while the program is off doing something else. Technically, the SERIN command stops and waits for data and either receives something as data or times out and moves on.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tom Sisk
http://www.siskconsult.com
·
I do not think that if SERIN is in the Do...Loop will do the task. The SERIN Timout must be followed with Tlabel; I did try this option, but did not work.
I do not know if we can work on interruption with PBasic, otherwise, I am looking for something like this :
' {$STAMP BS2px}
' {$PBASIC 2.5}
X VAR Word
Main:
SERIN 16, 16572, [noparse][[/noparse]DEC X]
DO
· SEROUT 16, 16572, [noparse][[/noparse]"Test", CR]
· PAUSE X
LOOP UNTIL "A" is received or anything to interrupt the Do--Loop
GOTO Main
This way the loop will go on until A is sent, then, I can enter a new value of X
Any clue please?
Cheers,
Doc
This also means, if you're waiting in a SERIN statement for data, you're not doing anything else. The processor is "Pended", as they say in Unix land -- "Pended", waiting for a "pending" communication. And if the 'sender' never sends, you'll 'pend' forever, unless you use the timeout.
The timeout does let you 'pend' for shorter times than forever. So, if you're going to 'wait' for 'X' anyway, might was well put the 'X' in as your timeout parameter.
But your loop will have to be written:
Main:
DO
SEROUT 16, 16572, [noparse][[/noparse]">"] ' A 'prompt'
SERINT 16, 16572, X, Timeout, [noparse][[/noparse]DEC InData] ' The DEC modifier takes in an ascill string, translates to word, and puts in InData
TIMEOUT:
Loop Until InData = 10
X = InData
GOTO MAIN
The simple answer is that you can't do what you seem to want to do. There are some 3rd party serial input buffers that can attach between a Stamp and a serial input line and the Stamp can read the state of the buffer (whether there is anything present), but that won't work for the DEBUG port. You'd need to use some other I/O pins and you'd need a MAX232 or other TTL to RS232 adapter or a TTL to USB adapter as well.
thank you for the info guys.
Cheers,
Doc