LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Event structure problem

Hey people,

 

I will explain first what i want my system to do. I have the following compponnents:

- NI 6212

- Driver

- Stepmotor

- Joystick

 

This is what i want it to do with the NI 6212 i want to read in the Joystick (UP DOWN RIGHT LEFT boolean) then depending on wich is active it has to send a pulse signal to the driver so that the stepmotor will run. I got this working in the picture i added as a attachement. But when i made it in a event structure to look on the inputs it doesnt do anything at all. The whole program seems to get stuck. Does anyone here know what the problem is.

 

Greeting

Thomas

0 Kudos
Message 1 of 2
(2,040 Views)

You didn't show the code which doesn't work, so it's hard to say what's wrong with it, but in general, event structures only react to events. There are some events you can get from DAQmx, but I'm not sure how they work and what their limitations are, so I would suggest you stick with the code you have.

 

Some comments about your code:

 

  1. You don't have any waits in your loops. This is bad because it will cause the loops to use the CPU as much as they can without letting others use it.
  2. You have code duplication. In general, to avoid that, you create a subVI from the shared part of the code and supply the different parts as inputs.
  3. If I understand your description correctly, it looks like your code shouldn't actually work, because you're reading the buttons in parallel loops and only one of the loops will stop. I would suggest you modify it to be a single task which reads all of the buttons together and then search the array you get for T and activate the motor with that. You also shouldn't have to stop the loop.

To learn more about LabVIEW, I suggest you try looking at some of these tutorials.


___________________
Try to take over the world!
0 Kudos
Message 2 of 2
(2,030 Views)