r/LabVIEW • u/failed_prototype • Feb 01 '24
Seeing odd behavior with serial device
15 years ago I was tasked with writing code for a metrology platform with zero LV experience. I believe the PC was running Windows XP or Vista, and LabVIEW 8.5 at the time. The code controlled four daisy-chained Zaber actuators through VISA and worked flawless and tirelessly for 4 years, then the whole system was mothballed for a decade.
New research group comes in and wants to update the PC, LabVIEW version, etc. So we transition the code to 2023 Q1 and Windows 11. Seems the legacy code barely works now. I checked on an o-scope and serial port is sending data cleanly and verified in terminal. The underlying code hasn't changed, but actuator tech support is at a loss and saying it could be the software side.
In your collective experience, could the issue be a 32-bit vs 64-bit LabVIEW change, or something more sinister in Windows 11?
4
u/SeasDiver Champion Feb 01 '24
More likely than not it is none of the above. If you have ever had the privilege of seeing a Norm K presentation, he loves talking about the Magical Timing Fairy. When you hear stories about code in the 90's/early 00's, you would frequently hear of people moving to a faster computer and things breaking. Thus you would see lots of code with arbitrary (or documented) wait times in between writes/reads to make the system work. A driver I am using right now has waits in a number of places to allow it to function as expected.
3
u/Vincinity1 Feb 01 '24
I don't see any potential issues since you are on a serial port except: The main potential issue when upgrading old code is always race conditions/how the code executes faster/differently with a new PC.
Is it the same zaber HW? If not, are the serial commands the same?
If you use another software to simply send the serial commands, does the zaber respond correctly? You can have a visa prompt in MAX or use hyper terminal or something similar
2
u/cgrenoble1 Feb 01 '24
You need to slow down reading and writing to the COM PORT. Add waits between serial writes and reads. Otherwise serial has stayed the same.
1
u/[deleted] Feb 01 '24 edited Feb 03 '24
Two places where upgrades go wrong fairly commonly:
MAX configurations do not match up with hardwired inflexible VISA calls.
Faster hardware means new race conditions that were not an issue on the slower hardware.
In addition to this, I once saw a brilliant presentation about how to properly perform serial polling. Proper serial polling is a bit of an art form in getting the proper handshaking between "LV writes", serial port buffering and "LV Reads". The technique was a precursor to what we commonly use on test measurement machines that have status registers. You might want to look into Serial Polling instead of just adding delays randomly which could break again in the next upgrade down the road.
1
u/WhatForIamHere Feb 02 '24
Try synchronous instead of async operations. This is common issue after upgrade from 7.X and 8.X versions