Connect with us

LF: Simple 4 channel analog to PWM IC. Does it exist?

Discussion in 'Electronic Design' started by [email protected], Mar 17, 2007.

Scroll to continue with content
  1. Guest

    Hi All,

    I need to produce 4 PWM signals to input to 4 power MOSFETs that are
    driving 4 DC motors. The MOSFET side of things is done/tested/working.
    Currently I'm producing the PWM signals with a computer I/O interface,
    however since I'm going with an embedded solution I want to give the
    PWM generation to the hardware to take some burden off of the embedded
    controller as it has other things to do.

    I've looked at ICs like the Tl494 or the UC1824 for PWM generation,
    but I'm not sure they are the best for motor control, and I've had a
    really hard time finding some simple application notes on these 2 ICs.
    Basically, I'm looking for a single IC solution that will allow me to
    give 4 analog signals to the chip and will produce 4 unique PWM
    signals with minimal external components. The PWM frequency is

    If a 4 channel Voltage-to-PWM IC is not available can anyone suggest
    the simplest single channel Voltage-to-PWM IC that will require
    minimal components for my application?

    If anyone has any suggestions, please let me know.

  2. Joerg

    Joerg Guest

    Easiest would probably be to spring for a little uC that does only PWM.
    If it really has to be analog chips it'll become more expensive: You can
    build that around a LM331 which is a precision V/F converter.
  3. John Barrett

    John Barrett Guest

    Look at the Atmel AVR microcontrollers -- they have versions with up to 3
    PWM outputs, and most all of them have A/D converters with 8 channel
    multiplexed inputs.... or just use 4 of them -- I've used the Atmega168 for
    PWM motor control and it had plenty of horepower for dealing with encoder
    inputs, PWM generation, and a serial configuration interface... it comes in
    an 18 pin dip and other packacging and is more than up to the single channel
    task with minimal programming... there are probably 8 pin atmel or pic
    controllers that can do the job if you want to hold down board space :)

    RE: minimal components -- the Atmega168 has onboard system clock (1mhz if I
    recall correctly.... external crystal up to 20mhz optional) so about the
    only external components needed are power-on-reset and power supply
    filtering, plus anything your specific application requires.
  4. Guest

    Thanks for the suggestions.

    The main reason I was looking for an analog chip solution is to avoid
    having to program a uC which requires additional interface hardware,
    and time etc. I'm not worried about the expensive of using analog
    chips so much as this project is a single prototype only.

    *Do you have any suggestions for a small uC that would be easy to
    program to generate 4 PWM from voltage?

    *Can you offer any additional info on where to find application/design
    notes on using an LM331 to generate a PWM signal? I searched a bit and
    can't find much.

  5. Joerg

    Joerg Guest

    Not really. I am only familiar with some 80C51 uC and some MSP430. The
    larger MSP430 might have enough CCRs in them but the smaller ones only
    contain 2-3 of them so that would not be enough for four PWMs unless you
    play some software tricks.

    In my cases the duty cycle of the LM331 didn't matter, and the data
    sheet is unfortunately quite silent about that. What you can do is hook
    a one-shot to its output. Now you'd have a true PWM with great
    linearity. You could also voltage-control a simple one-shot such as the
    555 timer directly but then linearity goes to pots.
  6. linnix

    linnix Guest

    Sometimes, you waste more time avoiding the right solution.
    The lm3s828 is a 48pins TQFP with 6 PWM channels. It can also A2D
    eight channels of 150,000 samples per second simultaneously. I know
    you don't need all the capabilities. but there are rooms to grow. You
    only need add a 6Mhz to 8MHz crystal for the uC.

    Your function can be implemented in less than 50 lines of codes. For
    example, this is alll you need to set up the auto sequenced A2D

    ADCSequenceConfigure(ADC_BASE, 0, ADC_TRIGGER_TIMER, 0);
    ADCSequenceStepConfigure(ADC_BASE, 0, 0, ADC_CTL_CH0 );
    ADCSequenceStepConfigure(ADC_BASE, 0, 7, ADC_CTL_CH7 | DC_CTL_IE |
    ADCSequenceEnable(ADC_BASE, 0);
    ADCIntEnable(ADC_BASE, 0);

    If you want it, I can post the complete solution.
  7. linnix

    linnix Guest

    OK, here is the code for a 4 channels Analog to PWM converter.
    The maximum sample rate is 125,000 per second for four
    channels. The chip is probably 90% idle waiting for interrupts.
    Of course, you can use it for something else to kill the idle time.
    One suggestion is to have a 920,000 baud serial link for debug and
    status reports.

    Preprogrammed chips are available for $10 (minimum 10) plus shipping.

    int adc;

    ADCIntClear(ADC_BASE, 0);
    ADCSequenceDataGet( ADC_BASE, 0, &val);
    PWMPulseWidthSet(PWM_BASE, PWM_OUT_0, adc);
    ADCSequenceDataGet( ADC_BASE, 0, &val);
    PWMPulseWidthSet(PWM_BASE, PWM_OUT_1, adc);
    ADCSequenceDataGet( ADC_BASE, 0, &val);
    PWMPulseWidthSet(PWM_BASE, PWM_OUT_2, adc);
    ADCSequenceDataGet( ADC_BASE, 0, &val);
    PWMPulseWidthSet(PWM_BASE, PWM_OUT_3, adc);

    // Divide 50 MHz system clock to 125,000 interrupts per second
    TimerConfigure(TIMER1_BASE, TIMER_CFG_32_BIT_PER);
    TimerLoadSet(TIMER1_BASE, TIMER_A, SysCtlClockGet() / 400);
    TimerControlStall(TIMER1_BASE, TIMER_A, true);
    TimerControlTrigger(TIMER1_BASE, TIMER_A, true);
    TimerEnable(TIMER1_BASE, TIMER_A);

    // Auto sequence A2D
    ADCSequenceConfigure(ADC_BASE, 0, ADC_TRIGGER_TIMER, 0);
    ADCSequenceStepConfigure(ADC_BASE, 0, 0, ADC_CTL_CH0 );
    ADCSequenceStepConfigure(ADC_BASE, 0, 1, ADC_CTL_CH1 );
    ADCSequenceStepConfigure(ADC_BASE, 0, 2, ADC_CTL_CH2 );
    ADCSequenceStepConfigure(ADC_BASE, 0, 3, ADC_CTL_CH3 | ADC_CTL_IE
    | ADC_CTL_END);
    ADCSequenceEnable(ADC_BASE, 0);
    ADCIntEnable(ADC_BASE, 0);

    // wait for interrupt
  8. Guest


    Thanks everyone for all of the reply's, and thanks Linnix for posting
    that code.

    I still haven't decided on what to go with yet. I may just go with an
    embedded solution that is powerful enough to do these 4 PWM channels,
    and all other A/D D/A and computations that I need it to do.

    Thanks again for the suggestions.
  9. whit3rd

    whit3rd Guest

    Why not just make a sawtooth generator (like with a '555) and
    use four comparators (one LM339)?
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day