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.
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.
08-09-2019 04:12 AM
Hey all,
I'm recently working with serial devices and now trying to do a bugfix. (LabView 2019)
My hardware:
Laptop/Win7
Nanotec C5-E-1-09 motorcontroller (CANopen/DS405) -> connected with USB
NEMA-23 stepper motor
Main programm is to drive the motor forward and backword on click. While the mouse button is pushed, the current position shoud be read and displayed in a XY-graph.
So far so good, everything works.
BUT suddenly the ReadPos.VI delivers less characters than it should be. I absolutely don't know why this is happening.
I tried to fix it by reading a second time to empty the buffer (usualy the second round gives me exactly the missing few characters) and in case the string is less than the expacted characters it will be discarded.
When it comes to less than 23 characters in the 'VISA read' the whole ReadPos.VI stuck for about 1-3sec and then works properly until it get stuck again.
I tried everything to solve this problem.
Can pls someone help me out here?
(I uploades the VI in version 8.6)
Best
Markus
08-09-2019 04:47 AM - edited 08-09-2019 04:55 AM
How do you initialize the serial port? Do you happen to use the dreaded Bytes at Serial port property to determine how much data to read?
Sorry can't open your VIs at the moment as I don't have any LabVIEW version installed on the machine I'm working on right now, but I'm applauding you for back saving your VIs to an earlier version.
08-09-2019 04:50 AM
Hi Markus,
in the German LabVIEWForum we told you to explicitely use VISASerialPortConfig to DISABLE any TermChars - but you didn't follow our advice.
Can you please try to switch off any TermChars?
08-09-2019 05:49 AM
Hey Gerd,
I tried this way with disabling the TermChar. (see Picture below)
The reading behaviour dosen't change
08-09-2019 05:54 AM
@rolfk wrote:
How do you initialize the serial port? Do you happen to use the dreaded Bytes at Serial port property to determine how much data to read?
I define the Bytes to read at the VISA Read function
08-09-2019 06:32 AM
For serial ports the TermChar Enable functionality is a little bit more involved than just this single property. Refer to this link to see an explanation.
Using the Initialize Serial Port.vi as recommended earlier takes care of all this for you and also makes sure the port uses the right baudrate and serial port settings instead of relaying on (user configurable) default values that can throw your application off.