From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Continuous write on serial port Tx

hi,
I'm trying to send an hex word (Ox5B)word on the serial port in order to reproduce a periodic signal on Tx. I'm using the attached VI. The main question is concerning the writing in the "while" or "for" loop. In fact as you will see in TEK00013 (ch1=IR receiver signal, ch2=IR diode emitted signal - Tx), when I'm sending "5B" in my "while" loop I have intervals (big ones) between the writings , even when I remove every timing between loops. I also tried to change the word written in the serial port using the one that corresponds to the maximum length stimulation to the scope. This word is "5B5B 5B5B 5B5B 5B5B 5B5B 5B5B", a "5B" more reduce the length. When writing it consecutively I have the signal of TEK00012 and the main problem is the gaps I have between two emissions. You could also remark that the receiver sees these gaps, it losts the modulation.

I'd like to know how to send this word with no interval between consecutive writings to avoid this phenomenon. I'm not aware of every RS-232 principles so it's possible I don't know the most appropriate function to use.

I hope someone can help me.
Thank you in advance.

Bim
0 Kudos
Message 1 of 4
(2,468 Views)
What you're seeing is the result of the OS doing it's background tasks. Windows is not a real time OS and timing is only approximate. You could try using the timed loop that's new to LabVIEW 7.1. If that doesn't work, you may have to investigate a solution with hardware timing such as NI's digital pattern I/O cards (NI 653x).
Message 2 of 4
(2,458 Views)
Thank you for replying so quickly M.Knutson.

That's what I was thinking... but :
Is there no way to minimize those little interruptions? Maybe to put LabVIEW as a top priority task?
May the same program in C or VB work better? In this case is it possible to control this "external" function via LabVIEW?

bim
0 Kudos
Message 3 of 4
(2,451 Views)
You can probably minimize the interuptions. That's why I suggested the timed loop. I don't know if you can completely eliminate them. You said that you wrote a long string instead of doing a loop and still saw interuptions? If so, what was the size of the string? You could try increasing the size of the serial port buffer (VISA Set I/O Buffer Size). I don't know offhand what the maximum size of the buffer is but if you need to send the pattern for an extended time, then the will be a pause between sending one buffer and then filling it again I believe. Hopefully, someone with more knowledge on how the serial port buffer works on a pc will provide more information. I really don't think that switching to VB or C++ will help you avoid the limitations of the OS or the pc hardware.
Message 4 of 4
(2,444 Views)