LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

acquisition scale through VISA & USB

Solved!
Go to solution

Hello,

 

I'm trying acquisitionning the value of my KERN scale, through a USB port (the output of the device is RS 232) with the vi attached. My problem is that I would like to make one acquisition every hour or so. If I put a wait time in my while loop of even 1 second, it seems that the device keeps the value until we ask for it. So the more time is running, the bigger the time shift is. Any idea about what I am doing wrong ?

 

Thanks in advance for your help 🙂

 

Sylvian

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

You have the while loop running as fast as it can, with no wait.

Also, I would use the 'bytes at port' function:

The 'wait' function has an input of milliseconds, so if you want 1 aquisition every hour,
you need to input 3600000 ms
Message Edited by Cory K on 05-11-2009 10:46 AM
Cory K
0 Kudos
Message 2 of 7
(3,614 Views)

Cory,

 

If you use the Wait(ms) with such a large value, the stop button will not operate until the wait times out. In other words, you might have to wait an hour for the while loop to stop.  

Also, the VISA Bytes at Serial Port is not at all necessary when the instrument sends a termination character. You just need to specify some arbitrary byte count larger than what yuo would expect. The VISA Read will automatically terminate when the term character is detected.

 

Sylvian,

 

You should calculate the elapsed time or just use the Elapsed Time function with the serial read code inside a case statement.

 

 

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

Thanks both of you for your answers.

I did what you advised Dennis (see in attachment), but I need to connect something in the false case, whereas I don't really want... Do you have an idea ?

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

Hi sylvian,

 

I would also go with the elapsed time express VI.Put a case structure around the Serial Commands and connect it to the Time has Elapsed output of the express VI. Use a shift register to store your array of measured values. Inside the case structure use Build Array to append the last value to your array.

 

Regards,

Andreas Stark
LabVIEW Lead @ Rocket Factory Augsburg
0 Kudos
Message 5 of 7
(3,564 Views)
Solution
Accepted by topic author sylvian

Thanks everybody for yours suggestions. I finally found a way (see VI attached).

 

Sylvian

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

It all seems silly to write values to the array and then remove them. The use of the local variable is also completely unnecessary.

 

To save when the loop finishes, you should be using a shift register and only update the shift register in the true case. To save while the loop is running, just place the file write code inside the case statement.

 

Shift registers are a basic element of LabVIEW. Check the tutorials, the online help, and the example VIs that come with LabVIEW.

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