05-04-2017 10:10 AM
Hi All,
I am trying to control the SMAC LCA8-010 actuator with LCC-10 controller. I wrote my functions in LCC-10 as macro functions with SMAC provided "Control Centre" software, and used LabVIEW VISA Write to call them.
I tried PuTTY first and it runs smoothly. But when I tried to run them in LabVIEW ("Control.vi" attached), for most of the time, the motor doesn't move, and the Property Node "Byte at the Serial Port" returned a 0, which means the "Write" function does not write anything to the controller.
What is strange is that it succeeded for some time (~10% of test runs). So the input format is correct. I am thinking about if the difference in mechanism of PuTTY user input and LabVIEW VISA Write function could make a difference.
Can anyone help me with that? Thanks a lot!
05-04-2017 05:15 PM
Putty and LabVIEW differ in two ways. First but probably not really important is the speed. Putty transfers characters more slowly than LabVIEW after each other. You can add a small delay by defining two stop bits or to transfer each character in a for loop with visa write. But more importantly Putty uses CRLF instead of just LF so use /r/n in your string write.
05-04-2017
05:25 PM
- last edited on
06-18-2025
10:27 AM
by
Content Cleaner
Hi Albert,
Thanks for your answer!
Can you elaborate a little bit about "defining two stop bits"?
Yes I indeed suspect about the speed, and I've tried to change the input mode to character-by-character using https://forums.ni.com/t5/Example-Code/Serial-Write-One-Character-at-a-Time/ta-p/3996032. I set the time gap from 4ms to 50ms.
However, same problem happened: it works but only sometimes.
May I ask for more options to try? Please let me know!
05-05-2017 02:57 AM
Hi "1 at a a time.vi" is Ok to use but I would wait 0 time between two writes.
And instead of extracting each character from the string I would use convert string to byte array and in a for loop send each character with build array and byte array to string. Without having a wait.
2 stopbits can be found in "VISA Configure Serial Port (Instr).vi" it determines that each serial character is followed by two bit times of inactivity on the line. Normal behaviour is 1 stop bit and on USB even that is not for sure.
I have the feeling that the cr/lf option is the better way to go and also try to read until you get an end character instead of using a wait and bytes available.
Using/ enabling end characters means that you ask a too big number of bytes say 255 and the function automatically stops reading from the buffer at the first end character.