Shop OBEX P1 Docs P2 Docs Learn Events
strange problem. — Parallax Forums

strange problem.

sapisticosapistico Posts: 1
edited 2011-09-16 07:46 in BASIC Stamp
Hi Guys,

I am new in the forum and i hope some of you can help me..
I am using a BS2 to receive a string and a number from an outside system via 232. I want to store in a varible the number that is always preceeded by the 3 letters LKL.
Here is what i did:
AlrApp VAR Word
SERIN com1, baud, [WAIT ("LKL"),DEC4 AlrApp]
SEROUT com1, baud, [CR,BIN alrApp]

When i try it with the debug terminal of the BS editor it works fine and as soon as i type on the debug terminal LKL0023 i see the BS2 sending the Binary representation of alrApp varible. But when i try to make it work with hyperterminal i have to type twice LKL0023 in order to receive data from the BS2...
So basically the program works perfect with BS debug terminal and it doesn´t with any other terminal program. Does anybody know a reason for this?

Thanks a lot.

Comments

  • dandreaedandreae Posts: 1,375
    edited 2011-09-01 07:47
    Are you able to send just the letters in one shot or are you able to send just the decimal numbers in one shot? I suggest try and break it down and see if you can find a work around.

    Dave
  • Mike GreenMike Green Posts: 23,101
    edited 2011-09-01 08:03
    There is a bit of overhead in setting up for the various SERIN formatters like WAIT and DEC4 and the Stamp doesn't have an input buffer. If the characters are sent too close together, it's possible that the Stamp will miss the first digit after the LKL. I'm sure that the Stamp Editor's debug terminal uses a small delay after each character (2 stop bits instead of 1 stop bit) while Hyperterminal normally does not do this. I believe you can configure Hyperterminal for 2 stop bits. Try that. An alternative fix would be to slow down the Baud. The BS2 SERIN is dicey at 9600 Baud, particularly when you're using formatters. Try 4800 or 2400 Baud.
  • john_sjohn_s Posts: 369
    edited 2011-09-16 07:46
    Shorten WAIT inside SERIN to just a single "L" and try again:

    SERIN com1, baud, [WAIT ("L"),DEC4 AlrApp]

    That way in case the 1st L went undetected it should capture the 2nd L as valid and continue..
Sign In or Register to comment.