What LabVIEW version are you using? As Bojan said, we have to know the hardware to make the code for you. Send me an email ([email protected]) and I can give you some examples.
Yannapol, start LabVIEW, click on Help, choose "Find Examples" and then search for "Pulse". This will bring up a list of many examples in which pulses are used. You may be able to start with one of these examples and modify it to your needs.
In labview there is option by which you can generate square wave.See if you can share your model no of your DAQ it will be easy to tell the procedure. If it is a multifunctional DAQ like USB 6221 , 6225 series. Then you can generate a pulse signal of 0 -5 Volts( a TTL logic) using Digital I/O. Now you want to switch on and off solenoid valve. So you have to design a driver for your solenoid valve. Because the input to SV should meet its currrent requirement. Driver circuit can be design using Transistor or MOSFET( depends on current requirement).
first of all we need to know the DAQ model. It may have PWM genarator. you can downloaw the addons on ni.com as evaluation version. To use any DAQ you have to download the DEVICES DRIVERS (http://www.ni.com/download/ni-device-drivers-august-2014/4818/en/)
This is what I have tried(in the picture), I am still have problem, because the Digital I/O Port does not have any voltage.
1) See on the black box. I think it is refer to the port name. The port name is different form the user manual and label on the box. How can I know which one refer to Digital I/O?
2)**** My LabView is still incorrect, What should I do ?
I have an example of PWM, but this one is not my DAQ.
http://www.ni.com/tutorial/2991/en/
Dear Acharya,
Thank you for your help, but I am very new with this.
Could you please explain in detail?
Why do I have to use clock ? What is the concept of this ?
Could you just take the sign of a sine wave input? Set the wavelength of the Sine wave to be twice the length of each pulse in your desired square wave. Then multiply the output of the sign operation by the desired amplitude of each pulse in your desired square wave. .
Try the VI attached. The easiest way of generating a PWM signal is turning on and off a digital out line. The frequency and the duty cycle can be set with the wait periods. This technique can be used as long as the frequency is not higher than ~10 Hz.
For higher frequencies other techniques should be used.
In the VI you should replace the NI DAQ functions to the specific one that you've received with the hardware itself.
You can find the drivers and some detailed tutorials here: http://www.mccdaq.com/daq-software/universal-library-extensions-lv.aspx I think that based on the tutorial you can modify the VI that I've made.
And you can find some basic LabVIEW tutorials here: