LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

ASCII to Int in arduino labview compiler

Dear all,

I am using pallets of arduino compiler of labview by TSXperts. I am recieving the data over the serial communication.

Arduino read this data as ASCII char. , My question is how to convert it from ASCII to Int.

 

Please refer screen shot.

 

Many thanks in advance

Suyash

0 Kudos
Message 1 of 26
(3,744 Views)

That sounds like a question for an Arduino programming forum, not the LabVIEW forum.

0 Kudos
Message 2 of 26
(3,741 Views)

I don't have the arduino compiler so I can't say for sure since I know it has a limited palette that you can use, but I think you can probably use the "Scan From String" function. Wire it to the format code "%d" (of "%f" if it will be a decimal number).

 

To make sure, you mean your string says something like "123" and you want to get the number 123 from that right? Or do you mean like you have a string "A" and you want to get the number 65. In that case, you would use the "Type Cast" function (if that is part of the arduino compiler allowed functions, if it's not, I don't know what you do).

0 Kudos
Message 3 of 26
(3,736 Views)

Hi,

Thank you for your prompt reply.

If you have check the screen shot, you must have seen the number s like

 

Sending data on serial  - 1_2_3 ("_" with separator )

Arduino reading each and every char as individual ascii 49 = 1, 95 = _   , 50 = 2  and so on

As of now i have make the program which read the serial data and that data i am writing again to serial so i can monitor it.

 

I want separate 

1 (Int)

 (Int)

 (Int)

0 Kudos
Message 4 of 26
(3,729 Views)

Hi,

There is third party tool , arduino compiler for LabVIEW, which contain, labview pallets (arduino compatible).

Solution on Arduino IDE is available but on LabVIEW i am stuck.

That's why i asked here.

 

Thanks

0 Kudos
Message 5 of 26
(3,727 Views)

Then use the format string "%d_%d_%d" for scan from string.

0 Kudos
Message 6 of 26
(3,725 Views)

But still this wont allow me the ASCII chr. to int conversion.

Type cast one of the option , but it is not available in this specific library 

0 Kudos
Message 7 of 26
(3,722 Views)

Is scan from string available in the library? Would this work?

 

string_integer.png

0 Kudos
Message 8 of 26
(3,717 Views)

Unfortunately No ...

But match pattern is available , can do something from it.  2018-09-26 01_54_38-Untitled 1 Block Diagram _.png

 

0 Kudos
Message 9 of 26
(3,697 Views)

Hmm, yeah I guess you could try something like this?

 

string_integer2.png

 

If Decimal String To Number is in the palettes?

 

It's not the most robust or extendable solution - maybe others will have better ideas.

Message 10 of 26
(3,690 Views)