LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA Close sending 0x0 character

Hi,

 

Labview 8.5.1

 

I open a serial port with VISA open, send and receive data, and then close things down with a VISA Close.

 

However, the VISA Close is sending a 0x0 character on the serial line which is confusing the target instrument.   I can replicate this behaviour with MAX and with the serial port examples.

 

How can I prevent the VISA Close from sending the rogue character?   It's important that I do close the resource without closing the program in this instance.

 

TIA,

Richard.

0 Kudos
Message 1 of 5
(2,835 Views)

Richard,

 

Can I ask how you are viewing the 0x0 character on the line?  Also, what serial instrument are you communicating with?  An NI Spy Capture of what happens on your port when replicating this may also be helpful.  Instructions on performing a spy capture can be found here.  After running the spy capture, select File » Save As  to save the capture, and then attach it to a post here.

 

Thanks,

 

Eric K

Applications Engineering

National Instruments

0 Kudos
Message 2 of 5
(2,794 Views)

Eric,

 

Thanks for the reply.

 

I first noticed the issue communicating with a homebrew embedded processor, but I can demonstrate the effect by running the Basic Serial Write and Read.vi, hooking the outgoing COM port back to a second incoming COM port (crossing the TX and RX lines, of course) and monitoring that with Com Port Toolkit.  I see the outgoing *IDN?<carriagereturn><newline>

 

Timestamp                                 Hex chars received                                ASCII representation

 

 08:16:21.124                             2A 49 44 4E 3F 0D 0A                            *IDN?..

 

and then about half a second later, the 0x00.

 

08:16:21.655                               00            

 

Manually inserting a x second wait before the Visa Close delays the 0x00 by a corresponding amount. 

 

If I use the Measurement & Automatum explorer, select the com port,  open the visa test panel, select the viWrite tab, and Execute the test repeatedly, I get repeated *IDN?.. strings and it's only when I close the test panel that the 0x00 comes through.  ( I can also see a 0x00 coming through when I Validate the session - I assume it's opening and closing it?)

 

I have attached a Capture.spy session.

 

Thanks,

Richard.

 

0 Kudos
Message 3 of 5
(2,776 Views)

Richard,

 

 I just tried to replicate this problem and could not.  Do you see this behaviour on other computers?  I even tried running COM Port Toolkit and each time I would only get the *IDN?.. never the 00.  Can you tell me anything else about what you are doing to get this extra data?  There is also no indication of the data on NI SPY.  In Hex 0x0 is a NULL character but I still don't know why one would be sent.

Sincerely,
Jason Daming
Applications Engineer
National Instruments
http://www.ni.com/support
0 Kudos
Message 4 of 5
(2,755 Views)

Jason, Eric,

 

 I've been away from this project for a while, hence my lack of reply.  

 

I can reproduce this behaviour on more than one PC. It also seems that the spurious 0x0 is throwing up a framing error, so I don't know if it is actually badly framed or if it's just noise that looks like 0x0.

 

Right now I can work around it by simply not closing the serial port, but I'd be curious to know if anyone else can reproduce it.

 

best regards,

Richard.

0 Kudos
Message 5 of 5
(2,571 Views)