LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to send only 1 byte hexa code using VISA send for every 500 ms?

Solved!
Go to solution

Hello,

 

I would like to send only 1 byte of hexa code from LabVIEW to a external device using RS-232 (300bits/s, 8-bit data, no parity bit, no flow control) every 500 ms.

 

The TX pin on the computer should stay at logic 1 level once it finished transmitting the 1 byte of data and wait for 500 ms before transmitting again.

 

I build a test code below:

send_hex_over_VISA_write.png

The "String 1" output will be connected to the write buffer of the VISA Send. (Please note that the code above doesn't include the delay of 500 ms that I mentioned. Just ignore that for a moment.)

 

Will this code work as what I described above? I tried it on my project, but I was receiving weird things on the device.

 

Do I convert the hexa code correctly?

 

And how the VISA Send transmits the string? Does it include other "unneccessary" strings with the hexa code that I want to send?

 

 

Any help will be appreciated.

 

Thanks. 

 

0 Kudos
Message 1 of 4
(2,381 Views)

U converted to hexadecimal correctly but check the bytes.To which instrument u sending this data.Dont forget to put the delay inside the while loop otherwise its heats up ur processor.

 

http://forums.ni.com/ni/board/message?message.uid=921526#U921526

Message Edited by Baji on 06-09-2009 04:33 PM
Balaji PK (CLA)
Ever tried. Ever failed. No matter. Try again. Fail again. Fail better

Don't forget Kudos for Good Answers, and Mark a solution if your problem is solved.
0 Kudos
Message 2 of 4
(2,377 Views)
Solution
Accepted by topic author eddiechai2003

Hi eddiechai...,

you'll get a string of length 2 so you have 2 byte. You should use the to U8 and the type cast function. (see the attached picture). You have to disable the termination character to get what you want.

 

Mike

Message 3 of 4
(2,371 Views)

Thanks MikeS81,

 

That is exactly what I want.

0 Kudos
Message 4 of 4
(2,342 Views)