LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

is it a good vi code for pulse control

Solved!
Go to solution

Hi, I just wrote a simple code for generating two pulses; the first pulse is to output 5V for 200ms and then shut off and wait for 4 secs. After that, another 5V pulse is on for 200ms an then shut off. This is basically what I need to control relay. The relay is toggle on and toggle off type.The code looks akward, is there any better approach? I am using USB-6008, thank you

Download All
0 Kudos
Message 1 of 4
(2,209 Views)
Solution
Accepted by topic author godpaul

just a few minor Tweaks:

  • Keep create and destroy outside of loops. DAQmx tasks need to be created once - preferably during develoment and saved in MAX or your Project.
  • Keep a custom wait with error handling vi handy to avoid those seq structures that botch up the BD
  • the 500mS wait is in parallel with the seq structure and does nothing but keep 1 thread busy for 1/2 sec while the structure executes.

See revised code:

1b.PNG

 

This is still not very scaleable.  For adaptabiity this should be converted to  state machine or QMH with "Init(Task), Wait (Time to wait), Write (Bool), and Exit" States.


"Should be" isn't "Is" -Jay
0 Kudos
Message 2 of 4
(2,199 Views)

Thank you Jeff. By the way, some people mention counter output which is a option in the 'create virtual channel vi', is this helpful for usb-6008?

0 Kudos
Message 3 of 4
(2,178 Views)

@godpaul wrote:

Thank you Jeff. By the way, some people mention counter output which is a option in the 'create virtual channel vi', is this helpful for usb-6008?


Not really- the 6008 does not have the hardware required to use a counter DAQmx Task.  A counter output would be usefull on a more capable device though.


"Should be" isn't "Is" -Jay
0 Kudos
Message 4 of 4
(2,170 Views)