LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to convert a number into a string

I need to send a string command to a piece of hardware. it consists a letter and a number, such as "M100". I guess I should first give "M" then "100" then combine them into an array and then convert the array into a string. but the out come string has only M plus some machine code. how to do it correctly?
Can a computer learn how to program?
0 Kudos
Message 1 of 8
(2,682 Views)
Send M100 as a string to the hardware. No conversion necessary. Usually an instrument will accept characters for its command string, not actual numeric values. GPIB uses characters only. You send "FR1000Hz" to set frequency to 1000Hz. You might read from a DMM "15.000" as a string of characters, not a value. The string can be converted to a value if necessary. Try just sending M100 as a string to the instrument.
- tbob

Inventor of the WORM Global
0 Kudos
Message 2 of 8
(2,676 Views)
Thanks tbob, that works. but I need to increase the value of the number part using a for loop. for example, I need the user to say "M100" and the loop will run 100 times sending commands like "M1" "M2" ... all the way to "M100"
Can a computer learn how to program?
0 Kudos
Message 3 of 8
(2,673 Views)
Have a look at the attached VI. It should do what you want.


Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
Message 4 of 8
(2,665 Views)
Wow! Thank you very much! I did not expect someone will solve the problem for me, but Thank you! You used some many things that I have never seen before. This is quite a big lecture you have gave me. I will carve this into my head.
Can a computer learn how to program?
0 Kudos
Message 5 of 8
(2,661 Views)
Unfortunately, I am using LV7.0 and not able to enjoy what the Counter.vi could have offered 😛
However, I have this vi created for your problem. Perhaps, you wanna take a look at it and let me know if it works and helps?

Cheers!
ian
Ian F
Since LabVIEW 5.1... 7.1.1... 2009, 2010, 2014
依恩与LabVIEW
LVVILIB.blogspot.com
Message 6 of 8
(2,653 Views)
Ian, your VI works just as good. It does the same as the counter VI with very minor differences. Plus I am absolutely shocked by the fact that it is built on a entire philosophy. This also inspires me greatly, thank you very much!
Can a computer learn how to program?
0 Kudos
Message 7 of 8
(2,625 Views)
My pleasure!

Cheers!
ian f
Ian F
Since LabVIEW 5.1... 7.1.1... 2009, 2010, 2014
依恩与LabVIEW
LVVILIB.blogspot.com
0 Kudos
Message 8 of 8
(2,601 Views)