LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

simple counter between 1-11

Solved!
Go to solution

Check out the DAQ Change Detection Event...

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 11 of 22
(1,353 Views)
Solution
Accepted by topic author nolsqn

If you try to simulate DI with buttons, your buttons need to be switch until released (like a car horn). Then you also need a little bit of code to detect the off-on transition.

 

Try this:

 

 

Download All
Message 12 of 22
(1,352 Views)

hi Alten,

 

actually ur solutions is much simpler , I will edit my vi and send you as I dont just have 2 inputs rather 6 but the the principal works the same.

 

Thanks 🙂

Regards
0 Kudos
Message 13 of 22
(1,345 Views)

 

You can still use Events

 

Main_vi.png

Omar
Message 14 of 22
(1,343 Views)

nolsqn wrote:

actually ur solutions is much simpler , I will edit my vi and send you as I dont just have 2 inputs rather 6 but the the principal works the same.


What are the additional 4 inputs for? If you need to increment several numerics, you should use arrays.

 

(Does you application have anything to do with spinal tap? :D)

0 Kudos
Message 15 of 22
(1,330 Views)

Hi Alten,

 

Sorry for late reply as I was away for the weekend. Actually the 6 inputs control 3 stepper motors to postion them acording to 11 pre selected positions. Labview actually recevie the DI from the DAQ card and then depending on the DI send a command to move the motor.

 

Best Regards

Regards
0 Kudos
Message 16 of 22
(1,290 Views)

this soution also works prety well.

 

Thanks all

Regards
0 Kudos
Message 17 of 22
(1,283 Views)

As I said, you should use Arrays of buttons and an array of number is the shift regsiter. Your curret code does not scale well. What if you need to rewrite it for four, five, two, ot 100 button pairs in the future? With scalabel code, all you need to do is change one number.

0 Kudos
Message 18 of 22
(1,268 Views)

Here's what I had in mind. Changing to more or fewer button pairs is simply a matter of resizing arrays. No other code changes needed.

 

 

Message 19 of 22
(1,249 Views)

hi alten,

 

although I am prety sure we dont need to work with more bottons in the future so scalability is not an issue but using arrays is just more cooler and impressive 🙂 thanks a lot because this has given me way better techniques for future coding .

 

Best Regards,

Ali Asad

Regards
0 Kudos
Message 20 of 22
(1,219 Views)