Shop OBEX P1 Docs P2 Docs Learn Events
Problem with Serial Converter Code — Parallax Forums

Problem with Serial Converter Code

captainvideocaptainvideo Posts: 2
edited 2009-12-15 20:05 in BASIC Stamp
I am having problems with the attached Basic Stamp 2·code. The program inputs a serial string, and then based on the string, outputs a different string. The problem I am having is that is takes two serial strings to make the Case Select code work. When I put in a Debug statement and the Debug window opens up, I notice that the RX Led on the Debug interface only·flashes when a second string is received. It does not flash when only a single string is input.

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2009-12-15 19:11
    Hello,

    What are the exact bytes being sent by the originating device? I ask because since you're using both a WAIT and HEX modifier, several things need to happen exactly to meet both conditions. It would help to know exactly what bytes are being sent to the BS2.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage

    Parallax Engineering
    Check out the new Savage Circuits TV!
    ·
  • captainvideocaptainvideo Posts: 2
    edited 2009-12-15 19:39
    The serial strings I am using are "C00", "C01", "C04", & "C05". All four strings are recongnized and displayed in the Debug window. But they are only recognized after two strings have been sent, and it doesn't matter which of the four strings are sent first, the second string sent is the correct string.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2009-12-15 20:05
    Okay, I think I see the problem...You've not indicated that a carriage return or other data terminates each 2-digit value. Using HEX the BASIC Stamp will wait for the first non-valid character to terminate input. If your sending device doesn't supply that then try changing the HEX formatter to HEX2 and it will terminate after two valid digits. I hope this helps. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage

    Parallax Engineering
    Check out the new Savage Circuits TV!
    ·
Sign In or Register to comment.