Jump to content

Reset shift register value


mross

Recommended Posts

Hello,

I am working on a simple excersise. I'd like to automatically reset my Total (please refer to my attached VI) to 0 (basically resetting my shift register to 0) when it reaches a certain value, let say 20. Could anyone help me make that happen? I am stuck.

Thanks,

MC

You run the result into a greater than function. If it is greater than 19 you want it to put 0 in the SR.

The output of the greater than is T or F. T = SR = 20.

Wire that to a Case Statment and wire the SR itself to the Case as well.

In the False case you wire the SR to the right side and then to the right border node of the SR.

In the T case you put a 0 numeric constant which you then wire to the same output node of the F statement.

Each time the loop runs it tests the value for twentyness and either passes the value or replaces it with 0.

Notice that you have the loop conditional set as Stop if True and the default of the Boolean control is up True. Either change the loop conditional, or change the default value of the Boolean.

Mike

Link to comment
Hello,

I am working on a simple excersise. I'd like to automatically reset my Total (please refer to my attached VI) to 0 (basically resetting my shift register to 0) when it reaches a certain value, let say 20. Could anyone help me make that happen? I am stuck.

Thanks,

MC

Just for completeness' sake, I'll add a slight variation on Mike's reply - perform the test for > 19, then feed that to the boolean terminal of a 'Select' primitive. This is the triangular-shaped node on the 'Comparison' palette which is the LV equivalent of the C syntax:

s ? t : f

Wire the shift register leftside to the 'f' input, your constant zero to the 't' input, and the output to the shift register rightside.

Same result as the case structure, but a little more readable - you don't have to flip the case structure to see its alternate-case code.

Hope this helps!

Dave

Link to comment
Just for completeness' sake, I'll add a slight variation on Mike's reply - perform the test for > 19, then feed that to the boolean terminal of a 'Select' primitive. This is the triangular-shaped node on the 'Comparison' palette which is the LV equivalent of the C syntax:

s ? t : f

Wire the shift register leftside to the 'f' input, your constant zero to the 't' input, and the output to the shift register rightside.

Same result as the case structure, but a little more readable - you don't have to flip the case structure to see its alternate-case code.

Hope this helps!

Dave

Mike and Dave, thank you. Both ways worked. It's great.

MC

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.