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.
09-27-2012 04:19 AM
I had sent one previous problem two days before on a inserting commands to controll a motor. This is continuation of that. Now I need to know that is there any VI available to convert decimal numbers to ascii characters since the encoder detects only the ascii characters and as on byte also. So how can I convert all the inputs to the serial port write to ascii commands and I need the output from the serial port read to be decimal characters. So can you please help me by showing the VI's which fit to this problem or if there is no direct VI what I have to do to overcome this problem
09-27-2012 09:00 AM
Look under "string:/string/number" pallette on the block diagram. The return (reads of the serial port) will have the additional complexity if all the returned values aren't numeric values (like if there is a reading with units, i.e. "1.5V")
09-27-2012 10:33 PM
this is not the answer I want I need the way to convert a decimal number to the corresponding ascii value.
09-28-2012 01:14 AM
@perumpadapu wrote:
this is not the answer I want I need the way to convert a decimal number to the corresponding ascii value.
You need to be much more specific.
What is a "decimal number"? (a numeric integer data type? a string containing a single decimal character? someting else?)
If you have a single character string, you can typecast it to a U8 integer to get the ASCII value. For longer strings, you could use "string to byte array" to get an array of values.
Please attach a small VI that contains your "decimal number" as a diagram constant. Then tell us what the desired output should be.
09-28-2012 01:34 AM
I need to get ascii value d for the 100 and etc . Is it possible to write such a program and get result in labview 6i. If possible can You send a vi of that.
09-28-2012 06:41 AM - edited 09-28-2012 06:41 AM
@perumpadapu wrote:
I need to get ascii value d for the 100 and etc . Is it possible to write such a program and get result in labview 6i. If possible can You send a vi of that.
You are still not making yourself clear. is "100" a numeric or is it a string with the three characters "1, 0, 0".
If 100 is an U8 numeric, you can simply typecaset as I already said earlier.
LabVIEW 6i is over 10 years old and prehistoric, so I cannot attach a VI, but here's a picture. You should be able to recreate the VI from it.
09-28-2012 06:59 AM
Altenbach,
Do you go to sleep with your PC? How early do you get up to prepare a full response with that much details so early in the morning?
It's not even 8am here...
09-28-2012 07:12 AM
Well, it is 5am here on the west coast. 😄 Some friends just left for the airport, so I had to be up anyway....
09-28-2012 07:29 AM - edited 09-28-2012 07:33 AM
your example may confuse as in 6.x the diagram terminals weren't shown as icons. 🙂
typecast will result in additional, unprintable, characters before the "d" in the example he refers to. I have the numeric value going into a build array to make the single value into an array (one element), then the "byte array to string" as you show.
Can't post images or code from here.
09-28-2012 11:02 AM
LV_Pro wrote:typecast will result in additional, unprintable, characters before the "d" in the example he refers to. I have the numeric value going into a build array to make the single value into an array (one element), then the "byte array to string" as you show.
Typecasting an U8 to a string will give exactly one character (e.g.decimal 100(U8) --> "d"), no extra garbage, exactly the same as your suggestion. Where do you see unprintable characters?
If I change the display format of my string to hex, all I see is "64" as expected.