From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using Labview to control the Digital I/O of a Virtual Bench

Hi,

 

I am trying to use this example to create a 5V pulse to a device. http://www.ni.com/example/52071/en/. I want to use the 5V digital output line on a Virtual Bench to create a short laser pulse. (The laser is just driven by a 5V pulse of any length.) I can use it to output 5V manually (just by toggling the button), but I dont know how to incorporate the Output Array Control into a timed loop or something else. 

 

Thanks,

Matthew 

0 Kudos
Message 1 of 7
(3,324 Views)

How fast of pulses do you need?  And how accurate are these pulse widths?

 

I do not think the VirtualBench DIO can be used for pulsed outputs since they are software timed.  You might be able to do something with the Arbitrary Waveform Generator though.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 7
(3,313 Views)

I am not yet sure how fast, but down to a millisecond would be very nice. And I would use the FGEN but that is being used to generate pulses down to 1us for a different part of the experiment sadly. The pulses dont need to be accurate as such, just reliable. If I can set it to 15ms and always get a 17ms pulse then that is fine, I can calibrate for that, but if the pulses vary much with the same settings then that would be a problem. 

 

However even if they are not stable I would like to be able to pulse it at the ~100ms range. Does that help answer your question?

0 Kudos
Message 3 of 7
(3,310 Views)

100ms might be doable mostly reliable, but on a Windows machine you cannot rely on software timing.  What you really should do is get a simple DAQ that has a counter output that is capable of outputting pulses (double check in the data sheet).  Then you can use simple DAQmx functions to tell the hardware to output a pulse.  With the hardware controlling the timing, you will get a lot more consistent pulses.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 7
(3,300 Views)

Ok thanks, but in the meantime how would I get this working as intended? I have attached the VI im using. It can turn the laser on with the pulse button, but then not off. I am very new to labview so I think its a basic mistake.

 

Thanks in advance

0 Kudos
Message 5 of 7
(3,294 Views)

Hi Matthew,

 

I believe you can do what you need with VirtualBench, but it's a little outside the designed behavior of the hardware.

 

md12g12 wrote:

I want to use the 5V digital output line on a Virtual Bench to create a short laser pulse. (The laser is just driven by a 5V pulse of any length.) I can use it to output 5V manually (just by toggling the button), but I dont know how to incorporate the Output Array Control into a timed loop or something else.

crossrulz wrote:

I do not think the VirtualBench DIO can be used for pulsed outputs since they are software timed.

This is correct -- the VirtualBench GPIO instrument API is 100% software timed -- as fast as the program can write to the device is as fast as you can go. However, the GPIO also has another mode: SPI, which is hardware-timed.

 

md12g12 wrote:

The pulses dont need to be accurate as such, just reliable. If I can set it to 15ms and always get a 17ms pulse then that is fine, I can calibrate for that, but if the pulses vary much with the same settings then that would be a problem.

Try this example and use the scope to measure the SPI Clock's period (dig/0). If that is too fast, you can write a different digital pattern and measure the MOSI Signal's period (dig/1).

 

VirtualBench: Master SPI With the DIO

http://www.ni.com/example/52585/en/

 

VirtualBench Digital I/O Pinout and Connections

http://zone.ni.com/reference/en-XX/help/371526B-01/vbhelp/diopinout/

Joe Friedchicken
NI Configuration Based Software
Get with your fellow OS users
[ Linux ] [ macOS ]
Principal Software Engineer :: Configuration Based Software
Senior Software Engineer :: Multifunction Instruments Applications Group (until May 2018)
Software Engineer :: Measurements RLP Group (until Mar 2014)
Applications Engineer :: High Speed Product Group (until Sep 2008)
0 Kudos
Message 6 of 7
(3,269 Views)

The speed is ok, for now I would be happy with any pulse at all really. I just need help with making labview output a pulse of true to the boolean array. Something along the lines of the VI I attached would be great, but I dont know how to use a timer to change a boolean value.

0 Kudos
Message 7 of 7
(3,260 Views)