Showing results for 
Search instead for 
Did you mean: 

Increment Loop




I am intending to send and receive data using a Compact RIO's serial connection. Basically I have 2 wireless nodes sending data to the CRIO and the 2 nodes has to be synchronized. In order to do this, I need the Compact RIO to send a series of numbers 1-100 after the first package of data is received from the wireless nodes. Attached is my VI and the loop does send 1-100. But as soon as it reaches 100, it does not reset to 0 even though the loop is then false. I would need it to reset itself to zero after counting and sending 1-100 as measurement data is continuously coming every minute and we need them to be synchronized with the 1-100 sequence.


Any help will be greatly appreciated.


Thanks and Best Regards

0 Kudos
Message 1 of 4

You need to use a Select function or a case structure that feeds the +1 into the feedback node when it is less than 100, and feeds in a 0 when it is greater than 100.


I'm not sure why you have a 1 iteration For Loop in there, or why your incrementing logic seems to be divided between two different sections of code (inside the true case, and outside).  I think you'd be better off using a shift register instead of the feedback node.

0 Kudos
Message 2 of 4

Hi Ravens


Thanks for your reply. I am not sure how to use the shift register method you mentioned. Do you mind showing me how its done if possible?



0 Kudos
Message 3 of 4

Like the attached.


By the way, you have a lot of duplicated code.  You really should consider making subVI's to handle that.  It would make your main block diagram much smaller and cleaner.


For example, many of the calculations.  Also the case structures where you are writing information to a file where the only difference is a filename.

0 Kudos
Message 4 of 4