Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial

Solved!
Go to solution

OK so I need to be able to turn multiple byte numbers into a string so the write function can do its job. (I am also missing the unsigned short int checksum. That's what the extra blank slot is for.)

-K
0 Kudos
Message 21 of 43
(1,602 Views)

@kstipe wrote:

OK so I need to be able to turn multiple byte numbers into a string...


I find the type cast works well.  Just make sure your byte order is correct.  Convert all of your numbers into a byte array and then use the Byte Array to String primitive.

Combine bytes to string.png


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 22 of 43
(1,597 Views)

any chance you could post that as a VI? I'm still new to labview and learning the componants of it.

 

thanks

-K
0 Kudos
Message 23 of 43
(1,595 Views)

You apparently have LV2011.  I posted the image as a snippet.  So you can save that image to your disk and drag it onto a block diagram and there's your code.


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 24 of 43
(1,590 Views)

Ok. I have done everything in my power to get this command to go through, bit I still don't understand what is going wrong. Any insight would be much apreciated.

 

The first link is the program

 

the second link is the manual for those who didn't see it from before.

-K
Download All
0 Kudos
Message 25 of 43
(1,573 Views)

I do not understand your equipment, so I can't say exactly what you are doing wrong.  But here are some programming pointers that may help you.

 

First of all, the sequence structure does nothing for you.  Don't bother with it.  Secondly, label your constants.  I recommend labeling them as what setting they are.  Third of all, if you are going to use the hex display, show the radix so that it's obvious that we are dealing with Hex.  I had one program where the difference between Hex and Decimal kept coming up and was 90% of our problems.  Finally, you only need to convert to U8 array those types that are not bytes.  The bytes can just go into the build array and it will handle them just fine.

build command.png


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 26 of 43
(1,549 Views)

ok great! now I have a question.

 

what is cmd?

 

and do I need a value in the U8 array? that has a little indicator scroll wheel that sycles through numbers.

 

and are those converted into bits already?

-K
0 Kudos
Message 27 of 43
(1,544 Views)

Now you are getting tripped up by not understand LabVIEW basics. The emtpy array wired to the typecast is 'type' just a way to tell the typecast function what to convert to. In this case, convert the input to an array of U8s. The contents of the array wired to the 'type' input are irrelevant.

 

The byte labeled 'cmd' is just a generic label - as is the entire example. Your bytes, the values, the order, the quantity have to match your documentation. For your specifically, you need 1 byte equal to sync_code1, 1 byte equal to sync_code2, etc. I have no idea what specific values are sync_code1, sync_code2, etc.

Message 28 of 43
(1,540 Views)

Ok. Thank you. I will be back later with more questions, I'm sure.

-K
0 Kudos
Message 29 of 43
(1,537 Views)

http://zone.ni.com/reference/en-XX/help/371361D-01/lvhowto/numeric_data_types_table/

 

 

(this was just for tec support. not an actual question for the forum. It can be disregaurded. Thank you)

-K
0 Kudos
Message 30 of 43
(1,486 Views)