Shop OBEX P1 Docs P2 Docs Learn Events
a real PWM (= ontime 0%-100%) with just set and forget counters? — Parallax Forums

a real PWM (= ontime 0%-100%) with just set and forget counters?

StefanL38StefanL38 Posts: 2,292
edited 2011-08-14 21:32 in Propeller 1
Hi counterexperts,

is it possible to configure the counter or maybe if using two counters to create an endless ongoing
(= not a pulsetrain) PWM-signal?

Setup 1/2 counter(s) f.e. 20% ontime and then "forget" it as the counter(s) are producing the PWM-signal
automatically without any additional repeated changing of counterregisters?

keep the answers coming
best regards

Stefan

Comments

  • MagIO2MagIO2 Posts: 2,243
    edited 2011-08-14 12:00
    Hmmm .... shouldn't that work with 2 pins and an external part?!

    You setup 2 counters each one is driving one pin. You then connect the pins with an XOR. (The output of the XOR is then the PWM signal.)
    Both pins in sync will give you 0%, both pins generating the exact opposite signal give you 100%. Each value in between will give you a value in between and is equivalent to the phase-shift.

    Right???
  • JonnyMacJonnyMac Posts: 9,208
    edited 2011-08-14 12:01
    If you want variable duty cycle with varying frequency as duty cycle changes, yes; if you want to maintain a fixed frequency with variable duty cycle (e.g., for motor control), then you cannot do it without a code loop (Spin or PASM).
  • kuronekokuroneko Posts: 3,623
    edited 2011-08-14 16:55
    StefanL38 wrote: »
    is it possible to configure the counter or maybe if using two counters to create an endless ongoing (= not a pulsetrain) PWM-signal?
    Yes. Check [post=940154]this post[/post].
  • Tracy AllenTracy Allen Posts: 6,666
    edited 2011-08-14 18:20
  • StefanL38StefanL38 Posts: 2,292
    edited 2011-08-14 21:32
    Hi Jon, kuroneko and tracy,

    thank you very much for pointing to the different solutions.

    best regards

    Stefan
Sign In or Register to comment.