10-15-2018 09:17 AM
Hello,
i want to read Data stored on the PCB (Printed Circuit Board - DC motor).
To activate readout the following command has to be applied on Motor PWM-IN pin:
frequency 300 Hz :
1. Duty cycle 80% (10 periods)
2. Duty cycle 50% (10 periods)
3. Duty cycle 10% (10 periods)
how can genarate PWM signal using Digital OUT lines without unsing counter.
thank you very much in advance.
Solved! Go to Solution.
10-15-2018 09:25 AM
Hi nbnnnbn,
create a (digital) waveform with needed PWM pulses, then output that waveform on a DO pin of the first digital port. (Waveforms are only supported on Port0, see the manual.)
10-15-2018 09:41 AM
thank you for your replay. i'm new in Labview, there's example for that?
10-15-2018 11:20 AM
Sure, under the menu Help-->Find Examples..., you can find one for Finite Digital Output that should run on your X-series board.
You'll have to figure out the correct digital data to feed to the example task in order to accomplish the spec you gave in msg #1.
It would be more straightforward to do this with a counter if you were willing / able. Counters work in terms of freq & duty cycle more naturally so it'd be easier to define the data to generate.
-Kevin P
10-16-2018 02:59 AM
thank you again for your help. i can easy create PWM signals with different duty cycle using counter. Can you please give me a example how can i create a PWM Signal (300Hz) with 80% duty signal using waveform?
thank you in advance
10-16-2018 04:49 AM
10-16-2018 08:11 AM
GerdW's post shows how you could approach it with an analog waveform. And that might be a good first step for you because you could use the built in square wave generator function 3 times to build up your overall waveform with 3 distinct duty cycles that each last for a little while. Here's what remains to be done:
- carefully think through the 'sampling info' input to that square wave generator. More on this below
- as shown, you'll get a square wave that transitions back and forth between +5 and -5 volts. You can easily change input parameters to make it vary between 0 and +5 volts
- you can also easily turn the analog data array from the waveform into a boolean array. That's something you can use if you want to convert over to a DO task.
On 'sampling info': For a 300 Hz square wave and a duty cycle *resolution* of 10%, you would need 10 samples per cycle. That means 3000 Hz sample rate. For a resolution of 1% on your duty cycle settings, you'll need 100 samples per cycle for a 30 kHz sample rate.
Then the # samples needs to representing the # cycles you want. For 10 cycles, you'll need 10 * (# samples per cycle).
-Kevin P
10-23-2018 04:36 AM
i create a sub vi for generating PWM signal "generatePWMSig.vi". but i can not see the PWM signal over DO on an oscilloscope?
is it timing Problem...Ports...or something else ??
thank you in advance
10-23-2018 04:45 AM
Hi nbnnnbn,
do you get any error messages? If yes: which ones?
Does your hardware support a sample frequency of 100kHz?
You output just 1000 samples per waveform: that takes just 10ms. But you wait until 150ms multiple in the loop!?
Have you tried to create just one waveform by appending your 3 parts?