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: 

Serial port read

Solved!
Go to solution

Hello all!

 

I'm designing a tester that reads from a dial indicator continuously (Mitutoyo)  and when a certain value is reached (2mm) i want to send a command to another visa port (to slow down motor) i then want to have it detect the next value (4mm) and return the arm to starting position. 

 

My current issue is converting a constant decimal string into a number value. 

Ive tried lowering the bytes at port to only include 2 decimal places (xx.xx) but in reality the string is constantly repeating. (1.0001.0001.0001.0001.00) how can I pull one offset to the right of the decimal and only 4 digits.  

 

please excuse my spaghetti im still learning. 

King133x_0-1643308079118.png

 

0 Kudos
Message 1 of 4
(1,150 Views)
Solution
Accepted by King133x

Use Cancatenate String and End Of Line Constant to append a termination character to the messages you are writing.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 4
(1,139 Views)

crossrulz i believe i was just watching your video on proper serial communication. thanks ill add termination characters. 

0 Kudos
Message 3 of 4
(1,128 Views)

I'd like to comment that your code wasn't spaghetti code.  It was obvious that you tried to organize it.  Now there are common errors like the duplicate code that can easily be turned into one subVI, and there are places when wires run under things, are hidden by other wires, and stuff, but that's not spaghetti code.  THIS is spaghetti code:

billko_0-1643317443578.png

 

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 4 of 4
(1,105 Views)