LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

count toggle switch using labview 8.5

As a part of an MPhil Program that I am persuing I am using Labview to automate a process. The process basically consists of controlling a stepper motor. The device that I am working with consists of two limit switches. The limit switches are connected in parallel. What I need assistance with is a method of counting each time those limit switches are toggled. I can build the logic to detect the high to low switch toggle but I am having dificulty in counting the toggles. The switches are connected to a line on the DAQ module (6008). The version I am using is LabVIEW 8.5. The university acquired 2013 version but it has not been installed yet. The work must go on so I am using 8.5 with DAQ 6008. Can anyone offer me a solution? I tried putting the daq module in a event loop but each time I put the event loop in the general while loop everything else stops working. Assist me please. I am writing this from home and I do not have a copy of LabVIEW so I cannot attach the vi that I created.

 


Thanks

0 Kudos
Message 1 of 9
(4,283 Views)

Hello Gates,

 

Maybe this would be useful to understand why your VI stops working...

 

Basically, the event structure waits for an event to occur. If there is no events, the loop just waits and does nothing else. It's a way to save some CPU and stop polling your values continuously. That's why this structure is meant to be used in a parallel loop (which will wait) and never in your main loop (which runs the program) !

 

As for your question, here is a proposition of solution in LV 8.5 😉

CLAMaxime -- Kudos are a great way to say thank you
0 Kudos
Message 2 of 9
(4,257 Views)

Thanks for your reply Maxime. I will have to open it tomorrow at the lab to see it and then test it.

 

See you then.

0 Kudos
Message 3 of 9
(4,217 Views)

Ok. Maxine I have seen the vi and tested it and it works. I will have to go to the other lab to to test it with the limit switches. 

How can I adjust the program for it to respond to the limit switches. The limit switch is connected to the 6008 DAQ digital input.

0 Kudos
Message 4 of 9
(4,198 Views)

The program is not responding to the limit switch as there is nothing in the add events case that recognises the daq assistant. What should i do to correct this?

0 Kudos
Message 5 of 9
(4,191 Views)

1. I got a solution which works. It is through using shift registers. The problem is that it uses extra processing power which slows the stepper motor speed a bit. I would prefer the event structure solution but it is not working for now. 

 

2. The other soltuion i got is using the PFIO input for counting. It works but I will have to work out the contact bouncing situation.

 

Thanks

 

 

0 Kudos
Message 6 of 9
(4,159 Views)

When a while loop is run and then stopped how can the iteration value be saved and then reused for some other calculation when the loop is run again?

0 Kudos
Message 7 of 9
(4,108 Views)

@gates123 wrote:

As a part of an MPhil Program that I am persuing I am using Labview to automate a process. The process basically consists of controlling a stepper motor. The device that I am working with consists of two limit switches. The limit switches are connected in parallel. What I need assistance with is a method of counting each time those limit switches are toggled. I can build the logic to detect the high to low switch toggle but I am having dificulty in counting the toggles. The switches are connected to a line on the DAQ module (6008). The version I am using is LabVIEW 8.5. The university acquired 2013 version but it has not been installed yet. The work must go on so I am using 8.5 with DAQ 6008. Can anyone offer me a solution? I tried putting the daq module in a event loop but each time I put the event loop in the general while loop everything else stops working. Assist me please. I am writing this from home and I do not have a copy of LabVIEW so I cannot attach the vi that I created.

 


Thanks


The version of LabVIEW for this problem should not matter.  Do you have access to e-mail from your school, where you have a computer with LabVIEW installed?  If so, from there you can attach a copy of your code.

 

You mention that you have two limit switches connected "in parallel".  What kind of switches?  Are they NO or NC?  What are you trying to accomplish with the Limit Switches?

 

If I assume that you want the limit switches to "limit" the excursion of your Stepper Motor, then I'd assume you'd put one on the "minimum" end of the motion travel and one on the "maximum" end.  I'd further assume you would wire them independently to two sensors.  If they were NO and wired in parallel, detecting a Switch closure could signal "Stop -- reached one end or the other", but wouldn't tell you which end was reached.

 

Maybe I don't have the right idea of what you mean by a "limit switch".  I certainly don't understand "toggling" a Limit Switch.  On my system, the Limit Switches are protective devices designed to disable the Servo if the device being controlled ever hits them.  They "stay on" as long as the arm is pushing against them.  To re-enable the system, we need to (manually) move the arm (which we can do with the servo off) so that the Limit Switch is not engaged, and can then re-enable the Servo.

 

You need to explain better what you are trying to do, how the switches fit into your control scheme, and something about how your control scheme should work.  You also need to show us the code you have developed thus far, tell us what works and what doesn't, and we can then make sensible suggestions.

 

Bob Schor

0 Kudos
Message 8 of 9
(4,095 Views)

Good Day Bob Schor,

 

First;y the Limit switches should protest the motor and mechanism from being damaged when either limits are reached. You are right when you say it will detect when either ends are reached ut cannot tell which end. I have actually put that in the program. When I say toggle I mean when the switch is pressed. They are normally open (N.O) switches. They are limit switches because they will indicate when either limits are reach and they will return to their default position when they are released. What I am trying to accomplish is when the switches the motor should stop in manaul operation and automatically reverse when the system is in auto.

 

Thanks

0 Kudos
Message 9 of 9
(4,068 Views)