Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

motor control using PXI-6602 (or similar) and xPC Target

I am trying to use a PXI-6602 (or similar counter/timer module) to generate PWM signals for AC motor control.  I am using Simulink to generate the control software, and I am using xPC Target to control the NI hardware.  Simulink has a blockset to generate PWM signals for the PXI-6602, but the functionality seems very limited.  It only allows you to command number of clock ticks high and number of clock ticks low for each counter (thus controlling PWM period and duty cycle).

 

For motor control, I need to generate PWM signals that are complementary to each other (when one is high, the other is low), ideally with deadband between their transitions.  I also need to synchronize my ADC with the PWM signal for accurate current measurements.  I need to somehow trigger the ADC to sample the currents in the middle of the PWM signal (generally centerline PWM).

 

Are these things possible using xPC Target and an NI counter/timer module?  Will I need to write my own device drivers for the PXI-6602, or does NI already have these drivers developed?

 

Thanks,

Will

0 Kudos
Message 1 of 10
(8,341 Views)

Hi Will,

 

You'll be able to use the DAQmx Driver found here.  It has a C interface that you should be able to call into. Here is how to find the C Function Reference.  Hope this helps!

 

Regards,

Dustin D

0 Kudos
Message 2 of 10
(8,303 Views)

To say for sure if the hardware is capable of what you need, we'll probably need some clarification on your application:

For motor control, I need to generate PWM signals that are complementary to each other (when one is high, the other is low), ideally with deadband between their transitions.  I also need to synchronize my ADC with the PWM signal for accurate current measurements.  I need to somehow trigger the ADC to sample the currents in the middle of the PWM signal (generally centerline PWM).

 

A diagram of the signals required would be extremely helpful.  How many channels of PWM signals do you need to generate?  Is an external inverter an option for generating the complimentary signals?  What do you mean by "in the middle of the PWM signal"?

 

DAQmx is our driver for controlling the 6602 and should hopefully have the functionality you need, depending on what exactly you are looking for.

 

 

Best Regards,

John Passiak
0 Kudos
Message 3 of 10
(8,286 Views)

Thanks to both of you for the replies.  Here is a diagram that I got from a Texas Instruments DSP manual.  It shows all 6 PWM signals that are required to control a 3 phase AC motor.  Each phase requires a pair of PWM signals, one for the high side and one for the low side (see second attachment).  As you'll see in the diagram, the low side signal is always the complement of the high side signal, except during the deadband around transitions.  This deadband width needs to be programmable.

 

You'll also see an up-down counter shown for each phase.  This particular method is called centerline PWM because the PWM signals are symmetric around the center of the up-down counter.  The ADC is triggered either at the top of the counter or the bottom so that the current is sampled exactly in the center of the PWM signals.  You can imagine that PWM voltage applied across an inductor (motor phase) produces a triangular current waveform, so sampling exactly in the middle (up or down direction) will give you the average current value.

 

I could make some hardware to do this externally, but that would defeat the purpse of using NI hardware.  It is more than a simple NOT operation because of the deadband.

 

I will have to look into the C interface for DAQmx, because I need to create an interface back to Simulink to use xPC target.  They already have a blockset that performs basic functionality for a lot of NI PCI and PXI cards, but the PWM functionality in the interface they provide is lacking.  Do you guys have suggestions for this?

 

I hope this description helps clarify things.

 

Thanks!

 

Download All
0 Kudos
Message 4 of 10
(8,273 Views)

What is the source of this signal:


2010-05-25_162330.png

 

 

It looks like the PWM depends on the number of counts of the above signal.  Is this signal a clock (perhaps one of the on-board timebases)?

 

If so, you could use 6 of the counters to generate the 6 PWM signals.  Using the above signal as the timebase, you can configure the pulses to remain high and low for a certain number of ticks.  You would need to set the "Initial Delay" appropriately so the PWM occurs at the appropriate time.


Sampling your ADC would be similar, just use a 7th counter to generate a pulse every N samples with an appropriate initial delay.  The pulse would be used as a sample clock for your ADC.

 


Best Regards,

John Passiak
0 Kudos
Message 5 of 10
(8,242 Views)

Dear John;

 

How can one set initial delay of a PWM signal?

 

0 Kudos
Message 6 of 10
(7,599 Views)

I'm not sure if your question is related to this thread or not, but counter output tasks have an Initial Delay as an input when you create the channel.

 

 

Best Regards,

John Passiak
0 Kudos
Message 7 of 10
(7,591 Views)

Hello, Mr Passiak

    I'm handling the same problem now. And the initial delay time seems not helpful, cause this property could only be set when the timer is stop. And to stop each timer then restart it costs 120+ us, it's too long for motor control. We must find other methods to solve it.

 

 

0 Kudos
Message 8 of 10
(7,256 Views)

Mr Cross,

    I'm trying to generate SVPWM using FPGA, with a 6251 multifunctional DAQ board's DOs to exchange data.

0 Kudos
Message 9 of 10
(7,255 Views)

Are you currently using a retriggerable task, or are you writing something different (with a different delay) to the motor each time?  Which FPGA device are you using?

 

Jon

Applications Engineer
National Instruments
0 Kudos
Message 10 of 10
(7,234 Views)