LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to send a command in Hex to serial port

I need to send the following command to serial port
[SS] [1] [CR] to serial port , how do i do that in Hex
0 Kudos
Message 1 of 5
(7,605 Views)
Norman,

Learn to write a single commands and get back a valid replies first, before
you try to develop an app to continuously communicate with the instrument.
Once you get the command set down, you can plug them into your state
machine.
Attached is a VI about ASCII to HEX and Carriage Returns.

Parks


"Noman" wrote in message
news:506500000008000000E2670000-1031838699000@exchange.ni.com...
> I need to send the following command to serial port
> [SS] [1] [CR] to serial port , how do i do that in Hex



[Attachment SS1 to Serial Port.vi, see below]
Message 2 of 5
(7,605 Views)
Noman wrote in news:506500000008000000E2670000-
1031838699000@exchange.ni.com:

> I need to send the following command to serial port
> [SS] [1] [CR] to serial port , how do i do that in Hex
>

Use a string control or string constant in
- "'\' codes display"
input control code with \r for CR, \n for newline,
\XX for a HEX value representation (check help for more possibilites)
- "Hex Display"
input hex values directly

Or create a byte array with needed values and use the "Byte array to
string" function

--
Rolf
Message 3 of 5
(7,605 Views)
Thank you guys, at this point I am able to send my command to device and receive my data per single data command, but eventually I would send a different command to continously get data. At this point I have few questions, first my data printed out looks like this on Hyperterminal. at the prompt after it says either power on or reconnect , i enter my command ss/r

! RECONNECT
!
329-12:18:51 *01 RANGE"F *02 RANGE ''F

Above is an example. Does labview cares about the spacing in between the bytes because they are different between the Ranges. It says RANGE because I do not have any themal couple connected right now otherwise its going to be 0070."F for example. I need to save this also in Excel. I need to parse this data, can you guys help me on th
is. Thanks
0 Kudos
Message 4 of 5
(7,604 Views)
"I'm having the most odd problem. I've drawn up my 1D array of U8, convert it to string using the U8-2-string converter and send it, but my device does not respond.

So I tap the line with an Oscope and I see that only some of the numbers are being sent out correctly. I send out a 32, it replies with a 32 (correct!). I send out a 30, it replies with a 34, 36 combination. Btw these are all hex values. I've checked and double checked that I'm sending out a hex 30. Anyway it started doing the same for the 32. What is happening??? I tell it to send two hex number, it sends four!!??!?"
0 Kudos
Message 5 of 5
(7,604 Views)