LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

summing lengths from encoder signal

I'm trying to build code that will give me a running total of measured lengths with an encoder.  I'm using a analog signal (boolean) when I want my measurement to begin and end.  My problem is getting one measurement saved so it can be added to the next length measurement by the encoder for a running total.  Somehow I need the value to be saved at the moment the analog signal goes true,  Just one measurement reading giving me the length of my first piece so the next measurement by the encoder can be added to this first piece and so on.  Any Ideas?  I really don't want to write and read from a file if I can help it.
 
Regards
Geoguy
0 Kudos
Message 1 of 7
(3,279 Views)
why not use a shift register?

JD
0 Kudos
Message 2 of 7
(3,272 Views)

Thanks JD

I've attached my sample code.  Inside my case structure I have two constants.  These can be anything that will read and hold the value at my bit depth indicator at the instant the analog signal goes from true to false.  The true case is the only time the bit depth will change.  During the false case the encoder will travel up and receive another piece of pipe.  Once the pipe is attached the case will go true and this new piece of pipe will be added to the first piece of pipe for a running total.  I'm not sure how to use a shift register to hold only the last value before the case goes from true to false.

 

Regards

Geoguy

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

Sorry

 

Attached the wrong code.

0 Kudos
Message 4 of 7
(3,256 Views)
Hello,
 
I have attached an example program to illustrate the concept of shift registers.
Please refer to the LabVIEW help file to get more information. Specifically look at Fundamentals >> Loops and Structures >> Concepts >> For Loop and While Loop Structures.
 
Hopefully this gets you started in the right direction 🙂
 
Regards,
Chetan K
Application Engineer
National Instruments
0 Kudos
Message 5 of 7
(3,237 Views)

Thanks Cheten

 

A shift register would work fine if each length that was added would be the same but it won't be.  I need to read and store the value(1) triggered by the analog signal, the encoder will then travel to a new position and the analog will trgger again.  This new measurement as the enoder travels needs to be added to the value (1). 

 

Regards

Geoguy

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

Hello Geoguy

 

Hmm...I still believe that Shift-Register is the answer to your issue. Please look at the attached VI.

Notice how the new value of the slider is added to the old value when the boolean button is pressed.

 

Regards,

Chetan K

Message Edited by CKap on 12-13-2006 10:07 AM

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