LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Use of shift register and similiar C code

Hello LabVIEW Gurus,

I am very new to LabVIEW and I did searched the forum for my short question but the answers were not that clear to me. My question is what is a shift register and could you please give me one similiar C code and where shift register can be used.

Thanks for your time.
Vasu
0 Kudos
Message 1 of 6
(3,604 Views)

there is no direct analogous to a c construct to a labview shift register but a shift register is an unnamed temporary variable for use with itterative loop structures (for and while).  See the following code

int sum = 0;

for(i=0; i>100: i++)

{

sum = sum  + i;

}

return sum;

 

This can be done in LV without naming the variable sum .  In addition the shift register can be initialized or not.  If you do not register the shift register it will remember the value from call to call (a very cool feature when you learn to utilize it). See below

Paul

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 2 of 6
(3,597 Views)
Thanks for the reply. Is shift register like static variable?
0 Kudos
Message 3 of 6
(3,586 Views)

It been along time since I've C'd but I believe the analog was called a "Static Local".

It is available only inside the function and its value persist from call to call.

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 4 of 6
(3,577 Views)

Good call on the static local.  I forgot to mention that the shift register belongs to the vi (this is why it retains its value from run to run within an application).  It is sometimes hard to map c to labview since c is a procedural language (c++ is object oriented) but labview is a data flow model.

 

Paul

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 5 of 6
(3,569 Views)
Yes, you right. Labview Shift-Register is just like static variable in C code. It's a wonder feature in labview.
0 Kudos
Message 6 of 6
(3,548 Views)