LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial Port Transmit Delay in LabVIEW

Solved!
Go to solution

Dear All,

 

For one of a test system, I need to write the commands with some 'transmit delay' in serial port for communicating with DUT.  I could find a option for that in TeraTerm (as attached). Is there any way to add that transmit delay in LabVIEW serial port VIs? Please let me know.

 

Thanks.

 

Best Regards,

Sathish kumar D

0 Kudos
Message 1 of 16
(4,801 Views)
Solution
Accepted by crossrulz

Hi satish,

 

I need to write the commands with some 'transmit delay' in serial port for communicating with DUT.

What kind of "transmit delay"? How long do you need to delay?

You could transfer your string char by char in a loop, with some wait function in the loop…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 16
(4,791 Views)

Hi Gred,

 

I would need to have a transmit of 10 ms between chars.  As you could see in that Teraterm GUI, there is a feature for that.. I am just curious to know if there is any option like that in LabVIEW.

 

Transferring the string char by char is the work around for solution for this need.

 

Thanks.

 

Best Regards,

Sathish kumar D

0 Kudos
Message 3 of 16
(4,782 Views)

Hi Sathish,

 

As you could see in that Teraterm GUI, there is a feature for that.

I am just curious to know if there is any option like that in LabVIEW.

There is no such option in LabVIEW (AFAIK). That also is not a standard option with serial ports at all.

So I guess TeraTerm has implemented it in the very same way as I suggested you before: send one char, wait some time, send the next char, wait, …

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 16
(4,778 Views)

As Gerd has already said, such an option is not a feature of the VISA IO library.

 

But!!!!! LabVIEW, unlike Teraterm, is a programming environment and you can VERY easily program this yourself. As long as you don't need millisecond accuracy (which Teraterm couldn't guarantee either on a normal desktop OS), there is no problem in creating a loop and sending each character seperately with an accrding Wait Until Next ms Multiple node in that loop.

Rolf Kalbermatter
My Blog
Message 5 of 16
(4,766 Views)

Here is an example .. i used wait instead wait until next ms ...   or try a timed loop ....  however with the OS and it's serial driver the time delay may vary anyway...

with some OS driver tweaking (buffer size, priority ,...)  that could be improved but it should run like that.

serialdelay.png

(hope I don't end up in the Rube thread with that solution :D)

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


Message 6 of 16
(4,743 Views)

I am familiar with old hardware that was just fast enough to keep up but back then we used flow-control via hardware lines of X-On X-Off.

 

If your device support flow control and you can configure it to use it, it will let your device pace the serial transmission instead of the OS.

 

Just my 2 cents worth,

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 7 of 16
(4,738 Views)

Thank you all for your valuable inputs; I will use a loop with ms delay to address my requirement.

 

Best Regards,

Sathish kumar D

0 Kudos
Message 8 of 16
(4,721 Views)

@Ben wrote:

I am familiar with old hardware that was just fast enough to keep up but back then we used flow-control via hardware lines of X-On X-Off.

 

If your device support flow control and you can configure it to use it, it will let your device pace the serial transmission instead of the OS.

 


XON/XOFF or RTS/CTS may be a solution for some hardware. But without knowing about the capabilities of the connected device or DUT it is hard to say anything.

 

An intercharacter delay of 10 ms may be indeed just a workaround solution for such a device to avoid having to use its XON/XOFF capability or having to connect the extra RTS/CTS lines. But it could be also that the serial port implementation on the DUT is done in pure software over simple digital lines without real UART support circuit and that the device doesn't even support such handshaking capabilities. There is no way to know without a detailed specification for the device in question.

Rolf Kalbermatter
My Blog
0 Kudos
Message 9 of 16
(4,658 Views)

Heads up- depending on the particulars of your serial port, you may need to use Flush Buffer to force the write to happen after each character, otherwise it might "batch" them. It may work fine on one device but not on others, so if you NEED it to happen NOW then I'd flush your Write buffer after each character.

 

(But flow control is the better solution if your device supports it!)

0 Kudos
Message 10 of 16
(4,620 Views)