Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

How do i sort out lines of data so it would allow me to filter the results?

Solved!
Go to solution

I have 2 different VI's that work perfect seperately but combined not so much.  I am using the USB-6009 to send a digital out to control pneumatic cylinders.  The other VI uses can messages to tell me which buttons are being closed.  How can i redesign my VI to control say "Buttons 1-3 and it wont move on to buttons 4-6 until it recieves the message that buttons 1-3 have been pushed?"  This way i can shut down the test if buttons stop working or something breaks.    It sounds easy enough to do

0 Kudos
Message 1 of 11
(3,928 Views)

Hi chris12345,

 

Can you post a screenshot or your code to help visualize your situation a little better?

 

Regards,

Dustin D

0 Kudos
Message 2 of 11
(3,911 Views)

I want to run the first daq assistant, then read the can bus, and then just repeat this cycle until the loop is finished.  I am running the test 250,000 times once i get a whole loop finished and its workinig great.

0 Kudos
Message 3 of 11
(3,909 Views)

Hi chris12345,


You should definiately consider a state machine.  This will provide you the most flexibility and scaliability.  Post back if you have questions!

 

Regards,

Dustin D

0 Kudos
Message 4 of 11
(3,903 Views)

Hey Dustin,

 

 

I tried the state machine and it just stays in the first state and doesnt go to the next one.  The whole idea behind this is that the first state makes all the cylinders retract, then next state makes 3 engage and hit 3 different switches.  The next state waits for the CAN message to show the 3 were pressed, then engages the next 3 and so on.  I do appreciate your help but I am a hardware guy, not so much a software guy.  Everything else works except the labview part, ha.  I took the first daq assistant out of the state machine, but in the state machine the daq assistant runs before the can message is called.  I attached the first 3 states and let me know what else i can do to make this work?

0 Kudos
Message 5 of 11
(3,897 Views)

Hi chris12345,

 

In your state machine you want to define a state for each action that needs to take place.  It looks like you have done this.  What you need to do next is tell the state machine upon exiting a state what the next state it needs to go to by writing the approprite state to your shift register.  This way you can control on a per state basis what the next state should be.  If you take a closer look at the example I posted you will see that you can even make decisions and go to a specific state based on some condition that you define within the state. 

 

You can download this example to see more how the state machine works.  I reccomend running it in highlight execution mode.  Using this button in LabVIEW.

 

 

 

23398i8CEFFE043BDCAE31

Let me know how this goes!


Regards,

Dustin D

0 Kudos
Message 6 of 11
(3,893 Views)

Great now i am getting a framing issue once the pneumatics engages, i try to read the can and i get error 1073807253 or 1073807252.  I took the next step out, which in the case structure, would be 1 because i still could not get it to switch during the cycle.  Where do i need to tell it specifically to go in order?

0 Kudos
Message 7 of 11
(3,886 Views)

Hi chris12345,

 

This is what it look like in the example I linked to in the last post. 

23412i1902A52AEEC5B5C0

The shift register saves a value from the last iteration of the while loop.  Here you are telling the state machine to to go to the Stop state on the next iteration.   The reason you are not moving states is because you have wired your shift register straight through your loop so your next state value never changes.  Were you able to run the example I posted in highlight execution mode?

 

Regards,

 

 

 

Dustin D

Message 8 of 11
(3,882 Views)

I couldnt run it because of an error, but when i use this shift register if only stays at that value i put in. Im getting so frustrated i am not thinking i guess.  If i put a 1 in the first case it goes to case 1, if i put in a 0 for the 1st case it never goes to 1 after 0 has finished

0 Kudos
Message 9 of 11
(3,879 Views)
Solution
Accepted by topic author chris12345

hey chris12345,

you should wire the first case you want to run when the VI runs to your left-most shift register.  Then inside the case, you need to break the wire and create a constant for the next case you want to run.

 

for instance,

if you want to run "0" when you start, wire a constant "0" to the left-most shift register, then

inside the case structure, place another constant "1" and wire that out to the right-most shift register.

you will see that case "0" runs then it will attempt to run case "1"...

 

23444i7DF6E9ABA642E4BA

 

and so on and so forth.

 

does that help?

 

-gaving

Message 10 of 11
(3,851 Views)