meocop Posted August 30, 2006 Report Share Posted August 30, 2006 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 Download File:post-4960-1156894826.vi Quote Link to comment
mross Posted August 30, 2006 Author Report Share Posted August 30, 2006 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 Quote Link to comment
David Boyd Posted August 30, 2006 Report Share Posted August 30, 2006 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 Quote Link to comment
meocop Posted August 30, 2006 Report Share Posted August 30, 2006 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 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.