Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Problems using VISA read to read values of the serial port

Hi

I have the above problem. I have to communicate with a piece of equipment that only supports RS232 and no handshaking.
I read the adresses from 2 - 193, and every thing seams fine but in the address area 120 to 170 there are errors in the read.
I read a fixed number of bytes in every read, so the bytes are at the port I just can't view them (no '/' code display won't help). I'm quite sure It's the way I handle the data but can not find another way around it. The problem is probably the caracters I read and . Here is an example of a data lines as they should be:

120: 202 9 0 10 0 10 0 13 0 23
130: 0 61 0 10 128 10 128 9 128 6
140: 128 16 0 68 0 3 128
2 128 1
150: 0 10 0 33 0 119 0 255 255 255
160: 255 255 255 255 255 255 255 255 255 255
170: 255 255 255 255 255 255 255 255 255 255

But in my setup they turn up as:

120: 202 9 0 10
130: 0 10
140: 0 13 0 23 11 13 0 61 0 10
150: 128 10
160: 128 9 128 6 224 13 128 16 0 68
170: 0 33 0 119 0 255 255 255 159 13

BTW I am forced to use VISA!

J;-)
0 Kudos
Message 1 of 6
(4,161 Views)
I just figured something out, but still no solution. It's the termination char set in the "VISA Configure Serial Port"
So now I found that out I can change the char, but since I need to read from 0 to 255 I'm having a problem choosing a char that I don't need.

Is there a work around?
0 Kudos
Message 2 of 6
(4,161 Views)
When you read binary data you must disable termination character:
viSetAttribute (io, VI_ATTR_ASRL_END_IN, VI_ASRL_END_NONE)
viSetAttribute (io, VI_ATTR_TERMCHAR_EN, VI_FALSE)

when you read all binary data you should enable term character:
viSetAttribute (io, VI_ATTR_ASRL_END_IN, VI_ASRL_END_TERMCHAR)
viSetAttribute (io, VI_ATTR_TERMCHAR_EN, VI_TRUE);

Regards,
Zdenek
Message 3 of 6
(4,161 Views)
Where do I set these Attributes??? I have now narrowed it down to being the VISA read in LV 6.0.2. And I can not find any way to tell the read not to end at the termination char!
0 Kudos
Message 4 of 6
(4,161 Views)
Before read icon connect to VISA resource name "Property Node". Property Node is located in "Application Control" palette. When Property Node is connected click on the Property and popup menu will be displayed. In this menu you can select all VISA properties. For you are interesting following:
VI_ATTR_ASRL_END_IN => Serial Settings>>Serial End Mode for Reads
VI_ATTR_TERMCHAR_EN => Message Based Settings>>Termination Character Enable

CTRL+H display valid values. Remember that you should enable term. character, when all binary data was transfer.

Zdenek
0 Kudos
Message 5 of 6
(4,161 Views)
OK found this document explained it so that I could understand.

http://digital.ni.com/public.nsf/3efedde4322fef19862567740067f3cc/6e2c88c43c76a77386256975006db10a?OpenDocument

But you got me on track!
0 Kudos
Message 6 of 6
(4,161 Views)