Difficulty in getting SERIN to recognize data from HyperTerm - answer found, th
davejames
Posts: 4,047
Hi All,
After a frustrating day of digging around books and the web looking at examples of SEROUT/SERIN, I find that I must ask the league of users that have gone before me.
I am attempting to understand the use of SERIN/SEROUT.· I've been able to output a string of characters from my Stamp·to the HyperTerm app, but·I am not able to "go the other way" and use HyperTerm to send a single number to my Stamp.
The code on the Stamp side is:
' {$STAMP BS2}
' {$PBASIC 2.5}
input_num VAR Byte
'DEBUG CLS
TOP:
···· SEROUT 16, 396, 1, [noparse][[/noparse]"Enter number...", CR, 10]
'DEBUG "Enter number..."
···· PAUSE 5
···· SERIN 16, 396, 3000, TOP, [noparse][[/noparse]DEC input_num]
'DEBUGIN DEC input_num
···· PAUSE 5
···· SEROUT 16, 396, 1, [noparse][[/noparse]"Number entered = ", DEC input_num, CR, 10]
'DEBUG "Number entered = ", DEC input_num, CR, 10
···· PAUSE 5
···· END
'··· GOTO TOP
The commented DEBUG statements were used to prove the basic idea before commiting to the serial connection with HyperTerm.
The SERIN/SEROUT value of "396" means 2400 baud, 8-bit, no parity; HyperTerm has been set up the same.
When the connection between the Stamp and HyperTerm is made, all that happens is "Enter number..." is displayed on the HyperTerm window.· If I press a number key, nothing happens and the code cycles back to asking for input after a 3 second delay (the "3000" SERIN value).
Anybody have *any* ideas?· Please ask questions if I didn't provide enough information.
Thanks much,
DJ
BTW...yes I've read through "the manual", yes I've read through the Nuts & Volts, I've read Anderson's site, EME's site, found a 200+ page college Power Point Stamp presentation, all to no avail.
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Instead of:
"Those who can, do.· Those who can't, teach." (Shaw)
I prefer:
"Those who know, do.· Those who understand, teach." (Aristotle)
Post Edited (davejames) : 6/6/2009 9:09:28 PM GMT
After a frustrating day of digging around books and the web looking at examples of SEROUT/SERIN, I find that I must ask the league of users that have gone before me.
I am attempting to understand the use of SERIN/SEROUT.· I've been able to output a string of characters from my Stamp·to the HyperTerm app, but·I am not able to "go the other way" and use HyperTerm to send a single number to my Stamp.
The code on the Stamp side is:
' {$STAMP BS2}
' {$PBASIC 2.5}
input_num VAR Byte
'DEBUG CLS
TOP:
···· SEROUT 16, 396, 1, [noparse][[/noparse]"Enter number...", CR, 10]
'DEBUG "Enter number..."
···· PAUSE 5
···· SERIN 16, 396, 3000, TOP, [noparse][[/noparse]DEC input_num]
'DEBUGIN DEC input_num
···· PAUSE 5
···· SEROUT 16, 396, 1, [noparse][[/noparse]"Number entered = ", DEC input_num, CR, 10]
'DEBUG "Number entered = ", DEC input_num, CR, 10
···· PAUSE 5
···· END
'··· GOTO TOP
The commented DEBUG statements were used to prove the basic idea before commiting to the serial connection with HyperTerm.
The SERIN/SEROUT value of "396" means 2400 baud, 8-bit, no parity; HyperTerm has been set up the same.
When the connection between the Stamp and HyperTerm is made, all that happens is "Enter number..." is displayed on the HyperTerm window.· If I press a number key, nothing happens and the code cycles back to asking for input after a 3 second delay (the "3000" SERIN value).
Anybody have *any* ideas?· Please ask questions if I didn't provide enough information.
Thanks much,
DJ
BTW...yes I've read through "the manual", yes I've read through the Nuts & Volts, I've read Anderson's site, EME's site, found a 200+ page college Power Point Stamp presentation, all to no avail.
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Instead of:
"Those who can, do.· Those who can't, teach." (Shaw)
I prefer:
"Those who know, do.· Those who understand, teach." (Aristotle)
Post Edited (davejames) : 6/6/2009 9:09:28 PM GMT
Comments
I'm no expert but here is my thoughts. The DEC format will wait until a non numeric evaluated key is pressed. IE if you type 1, it waits for another number as it has no idea if you're typing 1 or 12 or 123 etc. The first non-numeric character should satisfy the DEC requirement. This also assumes the 3 second time-out doesn't occur before the DEC is satisfied. If you typed 12A it would return 12. If you tested it only typing numbers, you wouldn't see anything and the timeout would occur thus showing nothing.
Regards,
Fred
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Why be one if you can't act like one? Knoxville, TN
I did try inputting alpha keys (your 12A) example with no success. I still have the Stamp asking me to input a number.
The Parallax reference manual says that the DEBUG/DEBUGIN commands are simplified SEROUT/SERIN. If I replace the SEROUT/SERIN commands with the DEBUG equivalent (the commented-out lines of code), results are what I would expect. Although I am confused why, when using DEBUGIN, I must press the 'enter' key to terminate the input.
Later,
DJ
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Instead of:
"Those who can, do.· Those who can't, teach." (Shaw)
I prefer:
"Those who know, do.· Those who understand, teach." (Aristotle)
·
Regards,
Fred
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Why be one if you can't act like one? Knoxville, TN
I'll give the inverted format a try and see what happens.
Later,
DJ
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Instead of:
"Those who can, do.· Those who can't, teach." (Shaw)
I prefer:
"Those who know, do.· Those who understand, teach." (Aristotle)
Post Edited (davejames) : 6/6/2009 4:51:58 PM GMT
I found the problem. It seems that HyperTerm has "selectable Flow Control" and the choices are Hardware, Xon/Xoff, and None; the setting was it's default "Hardware". I set Flow Control to "None" and now the Stamp will recognize my numeric keyboard entries.
And Fred - you are correct, the DEC formatter looks for any non-numeric and that's why the process requires an 'enter key' or any other non-number.
I am calling this thread closed.
Regards,
DJ
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Instead of:
"Those who can, do.· Those who can't, teach." (Shaw)
I prefer:
"Those who know, do.· Those who understand, teach." (Aristotle)
·
DJ
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Instead of:
"Those who can, do.· Those who can't, teach." (Shaw)
I prefer:
"Those who know, do.· Those who understand, teach." (Aristotle)
·