VirtualBench

cancel
Showing results for 
Search instead for 
Did you mean: 

Export PWM signal to DIO

Solved!
Go to solution

Hi guys! 

 

I'm working on a project where I want to control a dc motor with the VirtualBench and LabView.

I have the motor hooked up to a H-Bridge motor driver, so I need to send 3 digital signals from the VirtualBench DIO to the H-bridge. 

As for direction, I have that figured out, but now I need help with getting a PWM signal to one of the DIO pins.

 

I can generate a PWM from the FGEN but dont know how to export it to a DIO pin.

I can also generate a PWM with the Express->Input->Generate signal function in Labview. But I get an error when trying to write that signal to the pin.

 

Or is there a smarter/easier way?

 

Please help! 

 

/Christian

0 Kudos
Message 1 of 2
(4,737 Views)
Solution
Accepted by topic author ChristianEllingsen

The Digital I/O pins only support SPI, I2C, static (software-timed) DIO, and exports of the MSO Trigger or FGEN Start signals. There isn't any PWM/counter functionality.

 

There isn't a way to generate a real PWM signal on the DIO pins, nor can you give a digital waveform to Dig Write. Going from the FGEN might be your best option here.

 

 

Another possible alternative might be to (ab)use the SPI mastering functionality. The following VI will generate a pulse-width modulated signal on dig/1 (MOSI). It will also generate signals on dig/0 (CLK) and dig/3 (CS), which may not be desired, and you'll have "gaps" between every call to SPI Write Read.

pwm_through_spi_abuse.png

——
Brandon Streiff
ni.com/compactdaq · ni.com/daq
Message 2 of 2
(4,724 Views)