LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Weird VISA serial behaviour

Hi I have a Weird VISA Serial problem that i hope someone could make some suggestions to help me.  i will try to keep this short whilst giving as much detail as possible.

 

This is about a bed of nails ATE system that labview controls to test PCB's.  My customers PCB has a UART on board and LabVIEW reads this to obtain data to be checked.  

The project was developed using LabVIEW 2013, on PC 'A' this works 100% in development mode.

For reasons i don't need to go into i had to use a second PC that has 2016 installed let's call this PC 'B' i then built the project and deployed it on PC 'C'  but some of the UART tests fail. 

now for the weird part!

1, Labview talks to the unit under test via serial port using VISA 3 times successfully prior before the test fails.

2, if i use remote debug between PC 'B' and PC 'C' the test passes.

3, if i set the front panel to pop up (ie set it as dialog in vi properties) it passes. 

4, if i cause a message box to come up showing the data read then it passes.

 

it's almost as if the PC is too quick i have added delays with no luck. all 3 PC's are windows 7 PC 'A' is quite old while PC where PC 'B' and 'C' are a bit newer with intel i5 CPU's.

I have hopefully attached the VI in question, when it fails i get no data read at all, the physical serial port is a FTDI USB com port.  i may have missed stuff off so please ask questions if you need to clarify. thanks in advance.

 

Does anyone have any suggestions?       

0 Kudos
Message 1 of 7
(2,971 Views)

Hi Dave,

 

Does anyone have any suggestions?

- Why do you open and close the serial port with each iteration of the outer loop?

- Why don't you use a shift register to keep your "Data" for next iteration?

- you don't need to typecast a string to a VISA resource…

- The inner loop is labelled to iterate 25 times, but is programmed to iterate just 11 times…

- The inner loop contains a wait function, which shouldn't be there as you already have VISARead to wait for next received bytes…

- why do you use WHILE loops instead of FOR loops?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 7
(2,963 Views)

@GerdW wrote:

Hi Dave,

 

Does anyone have any suggestions?

- Why do you open and close the serial port with each iteration of the outer loop? The outer loop runs 3 times, this was done as a way to retry if the previous attempt failed, i wanted to close and reopen in case of any problems

- Why don't you use a shift register to keep your "Data" for next iteration? good point i can do 

- you don't need to typecast a string to a VISA resource… true but i don't like having coercion dots.

- The inner loop is labelled to iterate 25 times, but is programmed to iterate just 11 times… this is a typo, it did use to be 25 times.

- The inner loop contains a wait function, which shouldn't be there as you already have VISARead to wait for next received bytes… this was an experiment which got left in.

- why do you use WHILE loops instead of FOR loops? personal preference in this case as i want the loops to stop once the data is valid, i know i can add a stop feature to a for loop.  they will both perform the same function in this VI won't they?

 

Thanks


 

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

@Dave76 wrote:


- you don't need to typecast a string to a VISA resource… true but i don't like having coercion dots.





Don't use a string in your cluster.  Put a VISA reference, then you won't need any typecast functions and won't have any coercion dots.

0 Kudos
Message 4 of 7
(2,916 Views)

@RavensFan wrote:

@Dave76 wrote:


- you don't need to typecast a string to a VISA resource… true but i don't like having coercion dots.





Don't use a string in your cluster.  Put a VISA reference, then you won't need any typecast functions and won't have any coercion dots.


The reason i am using a string is because i am reading in the alias name from a text script file (this could be used on various Pc's with different equipment but the same alias names) but i am trying to figure out why this VI randomly fails to read when in use, could this cause that?

0 Kudos
Message 5 of 7
(2,909 Views)

Do you get an error message when it fails?  If so, what is the error number?

0 Kudos
Message 6 of 7
(2,896 Views)

good point, there is an error but i don't see it due to me erasing any errors as you can see from the code ( i must change that).  its the timeout error -1073807339 

 

you will also see i have set a timeout to 500ms i have tried increasing this with no luck.

0 Kudos
Message 7 of 7
(2,890 Views)