AnsweredAssumed Answered

vrf Timeout on RS232 com port using Direct I/O

Question asked by VRFuser on Aug 8, 2006

Tim,

You do not state what operating system you are using.  I recently had a VEE 5.0 program that ran on UNIX and controlled a set of precision motor drivers using a serial port.  Everything worked great.  We typically sent command strings just the way you are doing.

Then we migrated to a PC bases system.  It didn't seem to matter much if it was Win2K or XP.  In either case, this approach did not work.  Every now and then, I would lose a character on a command.  The device being commanded would fail to execute the command (that it didn't get) and the software would either hang up waiting for something to happen that wasn't going to happen, or I would be trying to get a reply from a serial device that was still in receive mode waiting for a command.  This can cause a timeout error.

The fix for us was to send out the serial commands as a series of bytes instead of a single string.  You have to include the carriage return or newline character as a byte at the end of the command string.  Apparently, XP likes to assert control of the IO ports at the wrong time and kills part of the command string.  And it appears to be random!  Check the VEE archives and you will see more about this.  Our solution was based upon the info we found in previous posts.  

So, for your application, you will need to send out the ASCII values for
R, then
F, then
S, etc.
1
N



Reading a string was never a problem for us.  Also, if your instrument or controller echoes back the characters it receives, you can do an on the fly error check as well.

Good Luck

Paul Sylvester
Test Engineer
Business Line Ultrasound
Philips Medical Systems
3000 Minuteman Road
Andover, MA 01810

978-659-4836
paul.sylvester@philips.com








"Pimentel, Tim" <Tim.Pimentel@adc.com>

08/03/2006 05:31 PM
Please respond to
"Pimentel, Tim" <Tim.Pimentel@adc.com>

To
VRF <vrf@agilent.com>
cc
Subject
[vrf] Timeout on RS232 com port using Direct I/O
Classification

     




I am using Vee 5.01 and am having trouble with I/O or timeout occurred errors (Error number: 811) in Direct I/Os for an RS232 com port. The serial device itself (IES 8-Port RF Switch) requires;
Bits per second: 9600
Data bits: 8
Parity: None
Stop bits: 1
Flow Control: None
with 50 ms minimum/100 ms preferred between successive switching commands.
 
I have set up my Switch Serial (@1) Direct I/O like this;
General tab
   Timeout (sec): 5
   Live Mode: On
   Byte Ordering: MSB
Serial tab
   Baud Rate: 9600
   Character Size: 8
   Stop Bits: 1
   Parity: None
   Handshake: None
   Receive Buffer Size: 4096
Direct I/O tab
   Read Terminator: "
"
   Write
      EOL Sequence: "
"
      Multi-Field as : Data Only
      Array Separator: ","
      Array Format: Linear
Plug&play Driver tab
   Plug&play Driver Name: Unknown
   Parameters to init() call
      Address (e.g. GPIB-VXIO::12::INSTR): ASRL0::INSTR
      Perform Identification Query (checked)
      Perform Reset (checked)
Panel Driver tab
   ID Filename: (blank)
   Sub Address: (blank)
   Error Checking: On
   Incremental Mode: On
 
An example of the commands in the Switch Serial (@1) Direct I/O for switching to 1N and 1F ports:
WRITE TEXT "RFS1N" EOL
WAIT INTERVAL:.5
WRITE TEST "RFM1F" EOL
WAIT INTERVAL:.5
I have 16 User Functions that use similar Direct I/Os for switching between the various port combinations on the IES switch, the command syntax in lines 1 and 3 changing accordingly.
 
The error appears to occur randomly in time and randomly among the 16 User Functions, but always in line three of erring the Direct I/O.
 
I have tried increasing/decreasing the WAIT INTERVAL to no avail. I have tried to slow down the PCs serial port through SettingsDevice Manager to no avail. If the IES Switch requires no Flow Control and Direct I/O is set up for
no Handshake, how/why does Vee detect a timeout? I would think Vee would send data out over the RS232 and keep going, not caring if the serial device is responding. Any help or ideas?
 
Best regards,
Tim Pimentel
Senior Lab Tech
ADC
Suite 220S
7600 East Orchard Road
Greenwood Village, CO 80111
720.344.6320
720.344.6305
HYPERLINK "mailto:tim.pimentel@adc.com"tim.pimentel@adc.com
 

---
You are currently subscribed to vrf as: paul.sylvester@philips.com
To subscribe please send an email to: "vrf-request@lists.it.agilent.com" with the word subscribe in the message body.
To unsubscribe send a blank email to "leave-vrf@it.lists.it.agilent.com".
To send messages to this mailing list, email "vrf@agilent.com".
If you need help with the mailing list send a message to
"owner-vrf@it.lists.it.agilent.com".
Search the "unofficial vrf archive" at "www.oswegosw.com/vrf_archive/".
---  To subscribe please send an email to: "vrf-request@lists.it.agilent.com" with the word subscribe in the message body. To unsubscribe send a blank email to "leave-vrf@it.lists.it.agilent.com". To send messages to this mailing list, email "vrf@agilent.com". If you need help with the mailing list send a message to "owner-vrf@it.lists.it.agilent.com". Search the "unofficial vrf archive" at "www.oswegosw.com/vrf_archive/".  

Outcomes