LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

visa parity problems

Hello,

 

I have a problem with the parity checking on the VISA READ function.

I am using LabView Visa (2009) to communicate with an ASIC, the settings are as follows

Baud rate: 38400, data bits: 8, parity: odd, stop bits: 1, flow control: none.

I have enclosed a picture of the relevant part of my code.

It operates as follows;

The Serial port is set to the aforementioned settings using the “serial port open” sub via

The Bytes at port node is waiting for data to arrive (the other to frames are a 10 ms wait and a time out timer function), when data arrives it is read by the Visa Read function. I am using an adjusted version of Basic Serial Read Write to receive and send data to this program so that I can simulate errors.

The problem I have is as follows (data sent means data being read by the VISA READ function in the main program).

 

Data sent         Parity of sent message           Message read             Error message

D0E30033        odd                                       D0E30033                   none

D0E30033        even                                     00D000E300003300       -1073807254

D0                    even                                    00D0                            none

D0E3                even                                    00D0 00E3                   -1073807254

 

I’ve connected the data transfer up to an oscilloscope and it agrees with what I think I’m sending to the main program send.

So the big problem is why doesn’t the Visa read function pick up an error when only one byte of data is sent? Each individual byte must have a parity bit, I think?

Anyway I’m not an expert so if you can shed any light, or offer advice or help then that would be great.

 

Regards

 

Stephen

0 Kudos
Message 1 of 7
(3,846 Views)

Yes, each byte has a parity bit associated with it.

 

How do you know what the parity of the sent message is?  You say odd or even, but how do you know that?

 

I have never had parity problems using the VISA driver.  If you are having problems, then I would suspect you either have noise on your serial communication line, or the ASIC is not implementing the protocol for parity properly.

 

What else is odd to me is that the Message read column has a lot of 00 bytes being shown that aren't in the data sent message.  I don't know if you have a null replacment character set up on your VISA read.  But it seems like it is detecting a byte that is not really there.

0 Kudos
Message 2 of 7
(3,826 Views)

If the Bytes at Port loop exits due to a timeout, the Read still occurs (reading zero bytes).  The string output of the Read is probably \00.  Put a case structure around the Read and decode stuff so that it does not execute if the timeout occurred.

 

This occurred to me while reading Ravens Fan's point about the extra bytes.

 

Lynn

0 Kudos
Message 3 of 7
(3,818 Views)

Hello,

 

Thank you both for replying, I'll address your concerns in order

 

Ravens fan,

 

I know the parity that is sent because I'm using VISA on another computer with the parity set accordingly (this also rules out the possibility of it being the ASIC that's at fault as I'm not using it). The oscilloscope also detects If I change ot even parity so I'm pretty sure It is correct. The fact that the scope is reading correctly tends to suggest that it's not noise.

I've added the Null replacement character node after my set up sub vi (as shown) and this doesn't change anything I'm still getting 00 in the reading. Interestingly I've used NIspy whilst sending communications and the status message is read when reading the single byte of incorrect parity meaning it has spotted the error but an error message is not generated by the read vi.

 

Lynn

 

If there is not data the read loop exits and then retries without reading a 00 that isn't there, there are no extra 00 on the oscilloscope so it must be VISA read that is generating them.

 

Thanks again

 

Stephen

 

0 Kudos
Message 4 of 7
(3,806 Views)

I think you got my point, almost.

 

The VISA Read executes immediately after the Bytes at Port loop ends.  IF that loop stops because of a timeout (in one of the hidden sequence frames), the Bytes at Port value is zero.  The VISA Read executes, but does not actually read anything.  I tried it.  It returns an empty string.  The Type cast in the case structure at the bottom right of your image converts that empty string to a numeric = 0, which then becomes a string "0" after the Number to Hexadecimal String.  Since we cannot see the right side of that diagram, we cannot tell what is happening.

 

The point is that your processing should not occur if no data was read.

 

Lynn

0 Kudos
Message 5 of 7
(3,799 Views)

Ok, I understand what you mean however this is not the issue I am concerned with, VISA read, as I understand it, is supposed to check the parity bit and then report an error if it spots a mistake, this doesn't appear to be happening.

Any thoughts?

Stephen

0 Kudos
Message 6 of 7
(3,782 Views)

Stephen,

 

-1073807254 is a parity error.  In your original post you said you were getting this error.  How do you handle the error?  We cannot see where the error wire goes in either of the images you have posted.  What is the Byte Count when the error occurs?

 

Lynn

0 Kudos
Message 7 of 7
(3,776 Views)