Unable to do serial read from BS2sx in Labview
Steve123
Posts: 9
Stamp Code:
'{$STAMP BS2sx}
'{$PBASIC 2.5}
'{$PORT COM1}
baudmode CON 240
instrg VAR Byte
instrg = 0
start:
SERIN 16,baudmode,[noparse][[/noparse]instrg]
SEROUT 16,baudmode,[noparse][[/noparse]"got_it",CR]
GOTO start
The stamp waits to receive a byte and once it does, it should send the response string. Everything works when using the BS2 debug program and when using RS232 Hex Com Tool v4.0. When I run my labview program, it sends a one byte character to Com 1, a time delay then occurs, and the port is read (using the # of bytes at port function). The returned string is only one byte long, and it turns out to be the byte that I just sent to the port instead of the expected response string. Essentially, I'm reading exactly what I have just written.
I've tried using the example labview program·from parallax, and I get the same results. I've tried modifying the BS2 program by commenting out the SERIN line, and when I read the port in labview, I receive a timeout error.
LabView 7.1
Win2k with Com 1 settings of:
Baudrate: 9600
data bits:8
parity: none
stop bits: 1
flow control: none
Labview VI is attached.
Any help?
'{$STAMP BS2sx}
'{$PBASIC 2.5}
'{$PORT COM1}
baudmode CON 240
instrg VAR Byte
instrg = 0
start:
SERIN 16,baudmode,[noparse][[/noparse]instrg]
SEROUT 16,baudmode,[noparse][[/noparse]"got_it",CR]
GOTO start
The stamp waits to receive a byte and once it does, it should send the response string. Everything works when using the BS2 debug program and when using RS232 Hex Com Tool v4.0. When I run my labview program, it sends a one byte character to Com 1, a time delay then occurs, and the port is read (using the # of bytes at port function). The returned string is only one byte long, and it turns out to be the byte that I just sent to the port instead of the expected response string. Essentially, I'm reading exactly what I have just written.
I've tried using the example labview program·from parallax, and I get the same results. I've tried modifying the BS2 program by commenting out the SERIN line, and when I read the port in labview, I receive a timeout error.
LabView 7.1
Win2k with Com 1 settings of:
Baudrate: 9600
data bits:8
parity: none
stop bits: 1
flow control: none
Labview VI is attached.
Any help?
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas, TX· USA
Even if I just use:
'{$STAMP BS2sx}
'{$PBASIC 2.5}
'{$PORT COM1}
baudmode CON 240
start:
SEROUT 16,baudmode,[noparse][[/noparse]"got_it",CR]
GOTO start
I am still unable to read any information
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas, TX· USA
Another thing to remember is that the Stamp editor's·Debug Terminal is just a specialized terminal program.· When the IDE downloads a program to the BASIC Stamp that contains the DEBUG command, the editor opens the Debug Terminal for you.· You can also do this manually.· When you do you'll have to select the Com port to use, but after that you should see your data.· Once you can verify the text coming out of the BASIC Stamp it's time to turn to the good folks at LabView for getting into their software.· I believe others have done this, but having no experience with that software myself, I don't know what needs to be done.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas, TX· USA
I tried changing every setting I could think of, but never did get it working.
When I looked at the serial data on a scope it wasn't right, but at different baud rates it was right.
I write a simple little DOS program to send serial data on the same port, and it worked fine.
IOW I wouldn't totally rule out a problem with hyperterminal.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"SX-Video Display Module" Available Now.
www.sxvm.com
"A problem well defined, is a problem·half solved."
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas, TX· USA