Ive got problems with serial communications using serin
boonboy
Posts: 10
Hello again, Ive got problems with serial communications using serin. I'm communicating with a PC and can send data from the BS2 to the PC's debug page using serout 16,84, [noparse][[/noparse]var] Var held hello. This message was displayed within the debug window on the PC. I use a serial to USB adaptor. All is fine with serout, but I cannot for the life of me get serin to pick up a value sent from my web site. It sends a C or F to make the BS2 calculate centigrade or farenheit temperatures.
Is the baud mode required the same in for both directions, i.e does the PC send data in the same format as the BS2. having major problems please respond.
[noparse][[/noparse]Moderator Added Subject]
Post Edited By Moderator (Chris Savage (Parallax)) : 4/12/2007 7:38:57 PM GMT
Is the baud mode required the same in for both directions, i.e does the PC send data in the same format as the BS2. having major problems please respond.
[noparse][[/noparse]Moderator Added Subject]
Post Edited By Moderator (Chris Savage (Parallax)) : 4/12/2007 7:38:57 PM GMT
Comments
However, you need to be aware that the BS2 does NOT have a serial input buffer. Thus, if the BS2 is not 'waiting' in a SERIN statement for data to arrive, it won't get it.
Note also, because of the BS2 hardware, anything sent to it (from a PC, say) will be echoed back out the RX pin (so the PC gets an echo of what it sent). You need to 'filter' out this returned echo in the PC's software.
Oh, and you might try adding the "Inverted" flag value to the baud-mode value.
The Stamps are single execution thread devices. That just means that they can only do one thing at a time. If your program is not waiting at a SERIN when the PC sends the command, it will be missed. Usually what people do is to have a SEROUT or DEBUG that displays a prompt message and an immediate SERIN or DEBUGIN that receives the information. When the Stamp is driven by a PC program, the prompt serves as a signal to the PC program that it's ok to send the information.