LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

hardware push button

Thanx guys. I'll look into it again and get back to you'll once I figure it out. Thanks again
0 Kudos
Message 21 of 117
(1,390 Views)

If I have a regular on -off switch. (digital 1 for on, 0- for off- not momentary switch). so can someone tell me how to modify the soft start and stop to instead be activated froom a hard start-stop button. I'm totally confused now. I can't think of anything. I knwo I have to use the DAQmx reads but I cannot figure how.

The logic I know will be, if the daq reads 1 start the process and if if it reads 0 intially do not satrt. But during the process if it reads a 0, then you stop the process. So what this is upposed to do is continuosly monitor the daq line.

I totally don't know how I can modify the code to do that. Do I need another state machine or if I should make the modifications in the existing state machine.

I know i have reposted this msg a gazillion times on the forum, but I really need some help.

 

0 Kudos
Message 22 of 117
(1,368 Views)
Start by dropping in a DAQmx read of a digital boolean 1 channel 1 sample.  It iwll put out a Boolean that is True if the switch is closed and a False if it is open.  Replace your front panel start stop switches with these.
 
Another alternative is to do a Boolean OR of the output of the DAQmx read with the front panel start switch (and likewise the other DAQmx read with the Stop switch).  This would allow you to start the test from either the hardware push button or the front panel.  Actually, I would do it this way because it gives an alternate way to stop the test in the event the programming for the hardware buttons isn't working right until you get it all figured out.
 
See how this behaves.  The worst case situation would be if the pushbutton isn't held for long enough, or when it is pressed, the code for the DAQmx read is not executing at that instant of time.  Then an alternate way to handle the reading of the pushbuttons will need to be programmed.
 
 
0 Kudos
Message 23 of 117
(1,362 Views)

I give up Smiley Sad I just cannot seem to program this. I'm sure I'm doing something insanely wrong. Could someone please help me edit my VI to link the hard start stop button in place of the soft start and stop. I am falling way behind schedule on this project. Please help Smiley Sad

0 Kudos
Message 24 of 117
(1,335 Views)


Ravens Fan wrote:
Start by dropping in a DAQmx read of a digital boolean 1 channel 1 sample.  It iwll put out a Boolean that is True if the switch is closed and a False if it is open.  Replace your front panel start stop switches with these.

I cannot see any boolean after putting DAQmx read of a digital boolean 1 channel 1 sample. So what do I replace the front panel start stop switches with ?
0 Kudos
Message 25 of 117
(1,330 Views)


smm wrote:

I cannot see any boolean after putting DAQmx read of a digital boolean 1 channel 1 sample. So what do I replace the front panel start stop switches with ?

I don't understand your problem.  The DAQmx read digital boolean 1 line 1 point has a boolean coming out.  See attached.



Message Edited by Ravens Fan on 02-12-2008 09:51 AM
0 Kudos
Message 26 of 117
(1,322 Views)

I have done what you have said (or I think it is what you said). Could you take a look and tell me if this is what you were saying.

In the 1st frame I have the daqmx read with the boolean and then in the while loop I replaced the stop witha local variable of the boolean.

Will this make the 2nd frame active(start) when switch is closed and 0 when it is open and hence stop the process?

 

0 Kudos
Message 27 of 117
(1,314 Views)
No No No No.Smiley Sad  You are undoing some stuff you still need.
 
You had the start button in a while loop, but you deleted that.  Put the new DAQmx read in the same while loop replacing the start button.  Don't kill the whole loop.  Feed the output of the DAQmx read to the stop condition of the loop.  Not to an indicator.
 
For the stop button, you put in a local variable for Data which is written to by the first DAQmx read.  Obce you get out of that first frame, the value for Data will never change.  You want a new DAQmx read for the digital line where you stop button is tied to the stop condition of the loop in the second frame.
 
You have some dataflow race condition problems.  You have a front panel indicator called step.  But you have 5 local variables and 1 terminal writing to that indicator.  When that loop runs in the 2nd frame, you are just going to have a lot of noise flashing really fast across that indicator has each local variable almost instant writes over one of the other local variables.
 
Pay attention to your task wires.  You have one create task with multiple channels.  But you have that same task feeding to the new DAQ read you just created.  Also, I don't know what is going on in those subVI's, but you have that task wire going in and other channel/task wires going into the same subVI.
 
 
0 Kudos
Message 28 of 117
(1,306 Views)

I'm pretty sure this might still not be correct. But please take a look


Ravens Fan wrote:
You have some dataflow race condition problems.  You have a front panel indicator called step.  But you have 5 local variables and 1 terminal writing to that indicator.  When that loop runs in the 2nd frame, you are just going to have a lot of noise flashing really fast across that indicator has each local variable almost instant writes over one of the other local variables.

What do you suggest I do?
 


Ravens Fan wrote:
Pay attention to your task wires.  You have one create task with multiple channels.  But you have that same task feeding to the new DAQ read you just created.  Also, I don't know what is going on in those subVI's, but you have that task wire going in and other channel/task wires going into the same subVI.

Initally when I used to use different tasks for different read VIs it used to give some error saying  too many tasks are created in one VI. So I use one create task and feed it to the reads.
Could you show me how to edit what you are saying please please please

0 Kudos
Message 29 of 117
(1,298 Views)

What is the data that goes into the Step indicator?  I see it is a string.  Is it specific data you want to track for each of the 6 tests?  You may want to make 6 different indicators, one connected to each subVI.

I would highly recommend (and I think this was suggested before) to make each of those indicators for each test into a type def'd cluster.  (I attached one as a .ctl file in LV8.5).  You can bundle the values into the cluster inside the subVI.  Then just pass a single wire out of the subVI into the indicator of the cluster.  This will simplify wiring on your main diagram and also visually group things on your front panel.  (If you want that step string, you can add that to the cluster as well.)

What is the action of your hard pushbuttons?  Do you have a momentary start button and a momentary stop button?  Is it a single button that latches that when it is pressed means start, and when it is unpressed means stop?  A toggle switch?  If they are separate buttons (which is how the software on screen buttons were), then you will need two different digital inputs, one for each button.

I know what you mean about the mutiple tasks and sometimes having errors if trying to have separate tasks.  I don't know what situations raise such and error and which don't in terms of digital vs. analog, 1 sample vs. N samples, timing ....  If what you are doing works without errors, keep doing it.  I don't have a DAQ card present to experiment with task and channel setups.  I raised the question because because I thought you had multiple tasks, but there seemed to be a single task wire going to different channels to be read.

0 Kudos
Message 30 of 117
(1,287 Views)