Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Sending a byte stream to a serial port

Hello,
 
I need to send a byte stream down and read a byte stream from a comm port. Unfortunately, the interpreter I am sending and reading commands to and from does not interpret ascii text, therefore the commands must be sent as byte streams. I have reviewd this post http://forums.ni.com/ni/board/message?board.id=140&message.id=13132&query.id=19028#M13132, but do not have the luxury of passing a string down the line. Is there any way around this in labview?
 
Appreciate any fedback.
 
Mike
0 Kudos
Message 1 of 5
(3,265 Views)
Whether you are sending ASCII characters or hex, you are always sending bytes through the serial port. It's just a matter of visual representation in your VI. If I have a string control with the character 'A', it is the same thing as specifying the byte x41 to send. There's nothing to get around. Just create your byte stream as an array and use the Byte Array to String. When you do your VISA Read, the String to Byte array will give you the byte stream that the device sent back.
0 Kudos
Message 2 of 5
(3,260 Views)
Thank you, but the complication is that my interpreter does not recognize ascii text. I realize that a number is a number is a number, and that A and x41 are identical, but the interpreter only understands x41. I did stumble across a few VIs that might possibly work, if I can figure ont the correct configuration. They are the VISA Peak and Poke VIs and the associated map, unmap, and memory allocation and free sub VIs. Do you have any experience with these?
0 Kudos
Message 3 of 5
(3,258 Views)

I still don't understand the issue. If you do what I say and have a numeric x41, convert that to string, the interpreter will receive x41 at the other end. You are not sending ASCII text. No matter what you provide at the input to VISA Write, you are sending a byte stream over the serial connection. You can play around with peak/poke all that you want, but you will have exactly the same results. It may be marginally faster to write a numeric to the serial port with the outport function but the data in the serial port buffer ends up being exactly the same.

Message Edited by Dennis Knutson on 09-21-2006 10:18 AM

Message 4 of 5
(3,255 Views)

Dennis,

Thank you for your persistance. I see the err of my ways.

Best,

Mike

0 Kudos
Message 5 of 5
(3,232 Views)