Shop OBEX P1 Docs P2 Docs Learn Events
Difficulty in getting SERIN to recognize data from HyperTerm - answer found, th — Parallax Forums

Difficulty in getting SERIN to recognize data from HyperTerm - answer found, th

davejamesdavejames Posts: 4,047
edited 2009-06-06 22:15 in BASIC Stamp
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

Comments

  • WebheadFredWebheadFred Posts: 27
    edited 2009-06-06 12:35
    DJ,
    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
  • davejamesdavejames Posts: 4,047
    edited 2009-06-06 14:49
    Hi Fred - thanks for the response.

    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)
    ·
  • WebheadFredWebheadFred Posts: 27
    edited 2009-06-06 16:04
    I'm sure you read about the 22k resistor unless you're using the SIN pin. I'm not sure if that would have an effect on the input only. also try 8 bit no parity inverted (16780) for 2400 baud. I thought 'talking' to the outside world is different than device to device internal. I know I had to monkey around until I found the right settings to get it to work with the Little Step-U and my BS2px. I'm sure you've tried the above but that is all I can think about at the moment.

    Regards,
    Fred

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Why be one if you can't act like one? Knoxville, TN
  • davejamesdavejames Posts: 4,047
    edited 2009-06-06 16:46
    All this communication is being done through the USB/Serial adapter the Parallax includes with the Board of Education kit; I guess I should have mentioned that. So the SEROUT/SERIN commands are using "Rpin 16" which in turn uses the already defined, hardwired serial connection on physical pins 1 & 2 on the Stamp.
    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
  • davejamesdavejames Posts: 4,047
    edited 2009-06-06 21:06
    To All reading this thread (and to Fred),

    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)
    ·
  • davejamesdavejames Posts: 4,047
    edited 2009-06-06 22:15
    BTW - I posted this info in the 'User Supported FAQ' sticky for future reference.

    DJ

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Instead of:

    "Those who can, do.· Those who can't, teach." (Shaw)
    I prefer:
    "Those who know, do.· Those who understand, teach." (Aristotle)
    ·
Sign In or Register to comment.