Dealing with serial comm and floating point values.
zacharypch ~!at!~ gmail ~!dot!~ com
Posts: 13
Hi,
I am trying to program for a dialogue over RS232 like this:
And I am hung up on the query/catch part. This is how I am trying to do the work:
The execution is hanging at the SERIN instruction, and my assumption is that since +2.0000000... is being sent over the wire in ASCII, then catching it in a byte(5) array would result in +2.00 being stored in the var CurPZTVoltage. Does this approach seem to make sense? Given that, what could cause the hangup?
Thanks
I am trying to program for a dialogue over RS232 like this:
VOLT? +2.5000000000000E+00 VOLT 2.0 VOLT? +2.0000000000000E+00
And I am hung up on the query/catch part. This is how I am trying to do the work:
CurPZTVoltage VAR Byte(5) COMOutput CON 16 COMInput CON 16 COMBaud CON 110 FC CON 0 .... SEROUT COMOutput\FC, COMBaud,[noparse][[/noparse]"VOLT?", CR, LF] SERIN COMInput\FC, COMBaud, [noparse][[/noparse]STR CurPZTVoltage\5]
The execution is hanging at the SERIN instruction, and my assumption is that since +2.0000000... is being sent over the wire in ASCII, then catching it in a byte(5) array would result in +2.00 being stored in the var CurPZTVoltage. Does this approach seem to make sense? Given that, what could cause the hangup?
Thanks
Comments
I assume (?) that you are using a BS2SX or BS2P?
Ryan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Ryan Clarke
Parallax Tech Support
RClarke@Parallax.com
The line above will look for 5 bytes, and not terminate until it sees 5 bytes. You have PIN 0 set as a flowcontrol pin. You are however using (I assume) a built in DB9 port (and appropriate level shifting) from a BOE or similar board (16)- Have you connected your PIN 0 for flow control properly then?
I'll bet if you add a timeout to your serin statement, you'll find you're either getting only 1 byte of data, or none at all.
Can you go into more detail about your connection scheme?
Ryan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Ryan Clarke
Parallax Tech Support
RClarke@Parallax.com
My device uses an RS232 crossover to connect to the demoboard, so i suppose if i soldered from pin 6 of the RS232 thats coming into the board to pin 0 of the BS2p40, then I would have flow control on pin 0...does that sound sane?
Thanks for the help
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
Thanks
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
"The function generator monitors the state of the DSR line on the RS-232. When the line goes true, the function generator sends data over the interface. When the line goes false, the function generator stops sending finformation."
Since I have the crossover cable going from the agilent to the demo board, does it sound right then that the DTR pin 6 could be used as the flow control?
If there is an easy way to access the CTS line from the BS2P40, perhaps its pin 16 or something like that, then it would be easy to change the agilent for that handshake mode.
Thanks,
·· You cannot use flow control on port 16 (programming port).· If you want to do that you could use standard I/O pins and declare the FP pin in your SERIN/SEROUT statement.· DTR/DSR work very similar to RTS/CTS so it would be possible to implement that in the same way, although I have never used DTR/DSR for flow control, only to sense when a modem is available.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com