LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Convert String to Decimal for Zigbee on NCD board

Solved!
Go to solution

Hello,

 

A short glimpse of what I am trying to do:

I have a zigbee radio hooked up to an NCD AD1216 board. I also have another zigbee hooked up as a serial in my computer. I need to send a Decimal format write command to the remote zigbee and have it deliver back the same format data. 

 

Problem:I can only seem to send text data. I always get hooked up with errors in the Visa read portion of the code. I am trying "Typecast" but there are still errors. I need to send for example "254 33" and it should reply with "85" instead I believe it is sending in either ascii or hex format. 

 

Thank you very much in advance!

0 Kudos
Message 1 of 15
(3,148 Views)

First off, what is the error you are getting.

 

Second, what do you need to be sending to the board? You gave the example: "254 33". Does that mean a 6-character string, or two U8s with the values of 254 and 33 (decimal) respectively? Likewise, is the response two ASCII characters or a single U8 with the value 85 (decimal? hex?)

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 2 of 15
(3,139 Views)
Solution
Accepted by topic author stevenette

Judging from here (AD1216 Analog to Digital Conversion Commands), it look like those are decimal numbers that need to be sent.  So I recommend using an array of U8.  Make the first value 254 and the second 33.  Then use the Byte Array To String node.  For your data back, use the String To Byte Array.  The first element of the return array should be an 85.


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 3 of 15
(3,132 Views)

Hi!

 

I am getting error -1073807339.

 

I need to send the number 254 followed by 33 followed by etc.  in decimal format. I don't know how that handles the space, but I have tried concatenate, and typecast with a numeric input. The numeric input however does not allow the space. 

I do not know what I need to send whether it is a 6 character string or two U8's until I figure out which one works. I am assuming the 2 U8's but the VISA write does not accept 2 values. 

 

The response for now is just 85, but we will need multiple values for example "128 08 00..." Sooo... I think multiple U8 values on the response as well? 

 

Thank you! and hopefully I have cleared it up? Please let me know if I have not. 

 

 

0 Kudos
Message 4 of 15
(3,129 Views)

stevenette wrote:

I am getting error -1073807339.


Timeout expired.  How many bytes are you telling the VISA Read to read?  Do you have the termination character turned on?


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
0 Kudos
Message 5 of 15
(3,126 Views)

1. I have attached a very basic file of what I am trying to do. Typecast is deleted, but just a simple diagram that hopefully helps. Taken from the examples online. 

 

2. How do I implement the arrays into the flow and change their size? 

0 Kudos
Message 6 of 15
(3,121 Views)

I'm picturing something like this.  You can manipulate the command and response arrays as much as you need using the functions in the Array palette.


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 7 of 15
(3,113 Views)

@crossrulz wrote:

I'm picturing something like this.  You can manipulate the command and response arrays as much as you need using the functions in the Array palette.


*Off Topic* - How did you include the frontpanel in the snippet?!?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If someone helped you out, please select their post as the solution and/or give them Kudos!
0 Kudos
Message 8 of 15
(3,106 Views)

LAVA Code Capture Tool can do a few things the snippett tool cannot

 

On topic: a few additions that make some sense.

!1-1.png


"Should be" isn't "Is" -Jay
Message 9 of 15
(3,100 Views)

@MrHappyAsthma wrote:

@crossrulz wrote:

I'm picturing something like this.  You can manipulate the command and response arrays as much as you need using the functions in the Array palette.


*Off Topic* - How did you include the frontpanel in the snippet?!?


Code Capture Tool.  It is way better than the built in snippet tool.  Look for it in VIPM.  Once installed, you will find a Tools->LAVA->Code Capture Tool menu item.  Feel free to play around from there.


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 10 of 15
(3,098 Views)