Shop OBEX P1 Docs P2 Docs Learn Events
SERIN problems — Parallax Forums

SERIN problems

nondemnondem Posts: 15
edited 2007-12-02 18:47 in BASIC Stamp
I am stuggling to get my BOT to respond to input to pin 2 of the serial input cable.
I've got a BOE BOT - using a Stamp(BS2) on a Board of education.
I'm using a laptop and a USB to serial adapter to connect to the serial port on my BOEBOT.
I'm VERY familiar with communications with a DB9 serial cable....I've written several applications using data streamed into a serial port from GPS hardware(NMEA).
For some reason - I'm beating my head against a wall trying to get my BOT to "hear" commands sent to it via a VB.NET application I've written.
I'm sending the string "fwd" to the serial port using my application, and have confirmed that the "fwd" string is actually getting sent to whatever is connected to the other end of the serial cable.
I'm using various version of this simple program to try to confirm that the BOEBOT is receiving the command:
' {$STAMP BS2}
' {$PBASIC 2.5}
serdata var word


SERIN 1, 16468, [noparse][[/noparse]WAIT("fwd"), DEC serData]
HIGH 6

pause 10000
end


I've also tried using 84 and about a jillion other Baudrate/Databits/Stopbits/parity configs....nothing will lite the led circuit on pin 6

I setup a serout program using the same configs and they work fine...Hyperterminal displays the string I send w/serout fine.

I've also tried using
serdata var byte - and a numeric value for the trigger. No dice.


Do any of you guys have an idea what I should look at next? I must be missing something....

Comments

  • nondemnondem Posts: 15
    edited 2007-12-02 05:34
    I should mention: I meant pin 2 into the stamp.

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}


    SERIN 2, 16468, [noparse][[/noparse]WAIT("fwd"), DEC serData]
    HIGH 6
  • steve_bsteve_b Posts: 1,563
    edited 2007-12-02 14:22
    Check your connections?

    Gotta have that ground!

    Can you "see" the string with the same code on another pin? or another stamp (if ya got one)....

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <FONT>Steve



    What's the best thing to do in a lightning storm? "take a one iron out the bag and hold it straight up above your head, even God cant hit a one iron!"
    Lee Travino after the second time being hit by lightning!
  • nondemnondem Posts: 15
    edited 2007-12-02 15:09
    I'm assuming that since through the same connection I can send stuff w/a SEROUT command to Hyperterminal, that means my connection and pin selection is working. I've only got the one Stamp and one serial port on the BOE to work with. As I mentioned before - I am using a laptop w/no real DB9 serial port. I'm using one of those adapters that creates a prolific COMx port on the laptop.
    It's worked fine for everything else I've done. I can point my VB.NET application to another port that loops back to another "phantom" port using (com0com) to see what is getting sent to the stamp but I can't monitor whats sent in real-time.
    Since I am using the DB9 connector on the BOE, I can't easily change which pin on the stamp gets the signal. I appreciate the suggestions though. Maybe I should make the connection directly to the stamp through the other BOE breadboard-type connections bypassing the DB9 connector????
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2007-12-02 15:26
    nondem -

    When using the programming port (SIN, SOUT) as a serial data port, there is one anomaly about which you should probably be aware. I'm not sure that this has any bearing on your problem, but anything sent to to the Rx pin on the Stamp (SIN) will also appear, concurrently (ECHOED), on the Tx pin (SOUT) of the Stamp. This means any extraneous data received by the sending program must but be ignored.

    I hope that's helpful.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2007-12-02 17:23
    If you are using the USB to serial cable connected to the serial port the SERIN should use P16 and for 9600 baud a value of 16468. If you want to use P2 for your serial comms then you will need a RS232 to TTL level shifter such as the MAX232 and for a baud of 9600 you would use the value 84. Connecting the RS232 voltage levels directly to a Stamp will damage the processor.

    So from your description the SERIN command should read SERIN 16, 16468, [noparse][[/noparse]WAIT("fwd"),DEC serData]

    The fact you are using "fwd" in your protocol takes care of the echo that Bruce mentions but is something to bear in mind in future apps.

    Another thing worth mentioning is that in my experience at 9600 baud using a WAIT instruction I have to seperate the wait string and data with a small delay in the VB code. This doesn't seem to be a problem at 4800 so it may be worth dropping the baud while you do your tests. Lastly , and I feel you have probably taken care of this already, when you transmit your data from the PC to the Stamp terminate it with a nl or cr character.

    Jeff T.
  • nondemnondem Posts: 15
    edited 2007-12-02 18:47
    Unsoundcode gets the cigar. All the examples I've seen use pin 1 or 2 - also the "Sin" label on the BOE is on pin 2 of the stamp. I would never have guessed 16 was the pin to look at. Thanks to all for the help - problem solved!!!!
Sign In or Register to comment.