Jump to content

write to serial port delay


ehonda

Recommended Posts

Hello all,

I am creating a simulator using WinXp Pro and Labview 8.0 which communicates to a device serially using RS-485. The serial bus is at 115.2kbaud.

The device sends a command to the simulator in a polling fashion, where the command is sent every ~2msec. The device does not wait for any acknowledgement or response, and will send another cmd in the next ~2ms... over and over. I need to send a complete response to the command before the device sends it's next command (the 2ms window).

Using an oscilloscope and the application I wrote (set VISA comm--->while loop with serial read then write, no delays) I have noticed that it takes anywhere from 1 to 2.7ms(always varies) for my simulator computer port to write to the data bus. If it takes longer than 2ms to write, the data overlaps and the device craps out.

I am pretty sure the problem is not labview and that its a windows to port issue.

Does anyone know how I can reduce the winXP delay to the serial port?

note: I have observed that when I first start my Labview application it transmits very fast ~700uS, but after ~ 2secs it slows down to 2.7mS

any input would be much appreciated

thx

e

Link to comment

Seems like a classic software jitter problem. My guess is that you'll have a really hard time getting the job done in a reliable way unless you switch to a real time operating system. Try killing every process you can from the System Tray and Task Manager and see if that helps.

Link to comment
Try killing every process you can from the System Tray and Task Manager and see if that helps.

You could also try setting the priority of the LabVIEW process to HIGH.

post-6463-1161356147.jpg?width=400

However, there is no guarantee that Windows will not preempt the LabVIEW application for something as simple as a mouse event.

Good luck!

Mike

Link to comment
Hello all,

I am creating a simulator using WinXp Pro and Labview 8.0 which communicates to a device serially using RS-485. The serial bus is at 115.2kbaud.

The device sends a command to the simulator in a polling fashion, where the command is sent every ~2msec. The device does not wait for any acknowledgement or response, and will send another cmd in the next ~2ms... over and over. I need to send a complete response to the command before the device sends it's next command (the 2ms window).

Using an oscilloscope and the application I wrote (set VISA comm--->while loop with serial read then write, no delays) I have noticed that it takes anywhere from 1 to 2.7ms(always varies) for my simulator computer port to write to the data bus. If it takes longer than 2ms to write, the data overlaps and the device craps out.

I am pretty sure the problem is not labview and that its a windows to port issue.

Does anyone know how I can reduce the winXP delay to the serial port?

note: I have observed that when I first start my Labview application it transmits very fast ~700uS, but after ~ 2secs it slows down to 2.7mS

any input would be much appreciated

thx

e

I've been doing highly timed serial port writing using LabViews ETS RTOS v7.1.1. The one restriction that I found kind of obnoxious is that I had to use the motherboard's serial ports, as I was using a "standard" Pentuim 4 computer and there are no RTOS drivers for NI's multi-port serial cards (which we have several of from a former project). Besides that one problem, I've found that I could reliably time serial writes with about 60 microseconds of jitter, as measured via oscilloscope. In my application, I have to write certain charaters at certain times within a 35.7 millisecond window, at a baud rate of 115,200.

Another option, if you got the money and time for it, would be to try to program one of NI's FPGA's to do something similar. That could probably get the timing jitter down even farther.

Hope this helps,

-Pete Liiva

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.