Need help choosing a chip....

Discussion in 'Embedded Systems and Microcontrollers' started by khier, Apr 24, 2013.

  1. khier

    Thread Starter Member

    Jan 16, 2013
    30
    1
    Well, you might think What this guy is doing here if cannot solve this by his own, but believe me, I have tried and tried and tried and got even more confused each time.


    I have solid background in scientific programming, mostly FORTRAN and, in a previous life, in C. However, I am totally novice to Micro controllers. I read some books about the subject. While I could easily understand each element and concept separately (timers, interrupts, io,...etc.). I am still unable to get a global view how to put the different parts together.


    My objective is simple: read two inputs, an analog signal and a PWM signal, process and evaluate them, and use the information to define a single PWM output signal. I am thinking of using hardware PWM. Is there anything like input hardware PWM or is it limited to PWM output only?? In other words, do I need a chip with a single or double PWM channel(s)?


    The processing and evaluation is not sophisticated, which mean processor power and memory is not a major concern. Size is not an issue either. However, the smaller the better.


    To limit the selection difficulties I decided to stick to ATMEL chips. I do not know if they are the best for my purpose or not but I had to start somewhere. Now I am totally lost as the selection of the chip is concerned. And even in a more miserable situation when it comes to wiring and circuit design.


    Any hint will be highly appreciated..... Thanks in advance


    PS. What about educational kits?? Are they worth the money???
     
  2. kubeek

    AAC Fanatic!

    Sep 20, 2005
    4,670
    804
    Analog input is very simple, just feed whatever you want into the ADC input and ask the chip to do the conversion.
    With PWM input you have two choices: either use a timer/counter module to measure the on and off periods, or use an RC filter to convert from PWM to analog value that you can read with ADC.

    The output will most likely be from another timer/counter module that will generate the neccessary pwm in hardware. One timer/counter module usually has more possible outputs, so then these are called the pwm channels. Yes there are no hardware pwm input as in made specially for that, but the timer/counter is versatile enough to do what you need.
     
    khier likes this.
  3. khier

    Thread Starter Member

    Jan 16, 2013
    30
    1
    Correct me if I am wrong: The timer/interrup is the hardware PWM, right? Thanks for the suggestion, but the RC option does not apply in my case. So I must have a PWM input and PWM output. Does this mean I should select a chip with two PWM channels? I mean does the PWM input counts and must be read through a PWM channel?
     
  4. Meixner

    Member

    Sep 26, 2011
    116
    21
    When choosimg a microcontroller a lot depends on weather you are making one device or 10,000. There are many microcontrollers that can do what you want. You could convert the PWM signal into an analog signal with a simple low pass filter, then use a second ADC input to read that signal. Atmel makes both 8051 and AVR based microcontrollers.

    Oh I didnt notice Kubeek alresdy suggested the RC filter.
     
    khier likes this.
  5. MrChips

    Moderator

    Oct 2, 2009
    12,447
    3,363
    The timer module (hardware) is used to generate PWM output.

    There is no PWM input hardware.

    In order to measure PWM input it is best to use input capture feature of the timer module. With input capture you can measure pulse duration and pulse period.

    You do not need two PWM channels.
     
    khier likes this.
  6. khier

    Thread Starter Member

    Jan 16, 2013
    30
    1
    I have to measure the duty cycle of the input PWM, so the RC way does not work.
     
  7. kubeek

    AAC Fanatic!

    Sep 20, 2005
    4,670
    804
    Another important factor is, what is the frequency of the input and output PWM?
     
  8. khier

    Thread Starter Member

    Jan 16, 2013
    30
    1
    Very low....... around 100 Hz.
     
  9. khier

    Thread Starter Member

    Jan 16, 2013
    30
    1
    So if I understood correctly I need a chip with at least one PWM channel, two timers and one ADC, right?
     
    Last edited: Apr 24, 2013
  10. kubeek

    AAC Fanatic!

    Sep 20, 2005
    4,670
    804
    Exactly, but in atmegas the PWM channel is typically part of the timer module.
     
  11. khier

    Thread Starter Member

    Jan 16, 2013
    30
    1
    This is what I meant. One timer to capture the PWM input signal. Second timer to generate PWM output. ADC to read the analog signal. My original idea was to read the analog input each time the PWM input signal is captured (rising edge interrupt followed by falling edge interrupt). Or do you I need a separate timer for the analog signal?
     
  12. khier

    Thread Starter Member

    Jan 16, 2013
    30
    1
    Thank you all for your replies.
     
Loading...