Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA baudrate configuration change inside a loop

Solved!
Go to solution

Hi,

 

In my application I read a load cell value using the serial port. I'm using VISA configuring serial port to initialize the port (9600. 8 , None, 1, None).

 

Last week I`ve changed my computer and since then I'm having problems with VISA configuration. In some loops, the baud rate change to 1200, so I can`t get the cell value.

 

I've already checked COM1 configuration in my OS and everything seems to be fine.

 

I don't have any idea about what is happening, could anybody help me. Thanks

 

Ignacio

0 Kudos
Message 1 of 6
(3,794 Views)

maybe a racecondition somewhere.

Post your code and check all error in error out wires

greetings from the Netherlands
0 Kudos
Message 2 of 6
(3,793 Views)

Hi, here is a simplified version of my code. I hope this is clear enough. Thanks

 

 

0 Kudos
Message 3 of 6
(3,760 Views)

Do not perform a serial port configuration inside the loop. It is totally pointless to keep reconfiguring the serial port in each iteration. The serial port configuration should be outside the loop, and you should close the serial port once (after the main loop is done). Your code is difficult to follow. The garish colors you chose makes it close to impossible to see the Boolean wires. What's driving the case structures? What's controlling the loop condition terminals? Why do you have  loops inside the main loop? Please post the actual VI (and subVIs).

0 Kudos
Message 4 of 6
(3,755 Views)
Solution
Accepted by topic author jimza

Thanks for your reply. I understand that it seems poitnless but I prefer to keep the VISA configuration inside the loop in order to allow a user to reconfigure the instruiment during execution. Anyway, I'll look for other ways to do it better.

 

The solution was to remove "VISA close" block as you suggest. Thanks again

0 Kudos
Message 5 of 6
(3,743 Views)

Then you should redesign your code so that the reconfiguration happens "on demand", rather than the way it is now. All you're doing is wasting resources performing unnecessary operations. There is no "seems pointless" about it. It is 100% pointless. Look into using event structures or a state machine.

0 Kudos
Message 6 of 6
(3,729 Views)