03-10-2011 01:45 PM
Why does basic serial write and read configure the port twice before writing? Could this potentially cause any problems communicating?
Also, I see (using Portmon) that VISA Configure Serial Port leaves some of the flow control parameters at certain values (XON = 11, XOFF=13, Shake=1, Replace=40, XonLimit = 64, XoffLimit = 64) when flow control is supposed to be set to "OFF". Could this potentially cause communication problems with a device?
I am trying to match the port configuration used by a device vendor software. The vendor software only configures the port once, and sets all of the above parameters to "0".
Thanks.
03-10-2011 02:35 PM
I also see that if I, instead of using the VISA Configure Serial Port VI, use a Serial Property Node to configure, then LabVIEW sends a new series of the following commands for each property listed in the property node:
| IOCTL_SERIAL_SET_BAUD_RATE |
| IOCTL_SERIAL_SET_RTS |
| IOCTL_SERIAL_SET_DTR |
| IOCTL_SERIAL_SET_LINE_CONTROL |
| IOCTL_SERIAL_SET_CHAR |
| IOCTL_SERIAL_SET_HANDFLOW |
| IOCTL_SERIAL_SET_QUEUE_SIZE |
| IOCTL_SERIAL_SET_TIMEOUTS |
| IOCTL_SERIAL_GET_COMMSTATUS |
| IOCTL_SERIAL_SET_RTS |
| IOCTL_SERIAL_SET_DTR |
| IOCTL_SERIAL_GET_BAUD_RATE |
| IOCTL_SERIAL_GET_LINE_CONTROL |
| IOCTL_SERIAL_GET_CHARS |
| IOCTL_SERIAL_GET_HANDFLOW |
It doesn't seem terribly efficient, but maybe it doesn't matter, since all of this happens really fast. Is there a way to just set all the configurations with one set of these commands?
03-10-2011 08:42 PM
The VISA Configure Serial Port is nothing more than property node so I don't see the point of this statement.
What is the issue? If you set the baud rate, parity, stop bits, handshaking, etc to be the same as the instrument and like the other program, then what is an extra millisecond. You only configure the port once.
03-11-2011 06:03 PM
Okay, lets forget about the series of same commands used to complete the configuration since this occurs really fast. Like you said, what is a few extra milliseconds.
The lingering question that I have is that when VISA Configure Serial Port is supposed to set flow control to "OFF", some of the flow control parameters are left at certain non-zero values (XON = 11, XOFF=13, Shake=1, Replace=40, XonLimit = 64, XoffLimit = 64). The vendor software sets all of these to zero. I have figure out how to set Xon and Xoff to zero, but not the other parameters. Could this potentially cause communication problems with a device? Also, how do I know that flow control is actually off?
Another thing I've not figured out is how to set in and out buffers at different values (IOCTL_SERIAL_SET_QUEUE_SIZE InSize: 640 OutSize: 640). LabVIEW sets these to 640 each. The vendor software sets them to 2048 each. I haven't been able to figure out which properties might correspond to these on the property node.
The vendor software also sets "IOCTL_SERIAL_SET_WAIT_MASK" such that "Mask: RXCHAR". I'm yet not sure what this means or if it is important.
Thanks.
03-11-2011 09:31 PM
When you set flow control to off, all of the other parameters are irrelevant. You don't need to worry about them. Trust me, when VISA sets flow control to off, its really off and if VISA sets it to on, then its really on. You haven't tested this against the hardware. When you do and it doesn't match, post back.
Setting the buffer is done with the pretty obviously named function (not property) called VISA Set I/O Buffer Size.