go_away

Author Topic: extra PWM on pic?  (Read 1968 times)

0 Members and 1 Guest are viewing this topic.

Offline RebelgiumTopic starter

  • Supreme Robot
  • *****
  • Posts: 638
  • Helpful? 0
  • It's called the future ... We like it here
extra PWM on pic?
« on: January 28, 2008, 12:23:37 PM »
I'm going to use a PIC 16F876A with two PWM pins available.
But I need four, and getting a bigger pic is kind of overkill...

is there a possibility to program a few I/O pins to output a PWM signal? Without being stuck in the loop all the time offcourse. ::)

It might be a newbie question, I tried searching but unsuccesfully.
tnx
To relax after some hard work on robotics: A very fun free online text based MMORPG
orgcrime.net

Offline JonHylands

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 562
  • Helpful? 3
  • Robot Builder/ Software Developer
Re: extra PWM on pic?
« Reply #1 on: January 28, 2008, 12:36:27 PM »
You can do it using one of the other hardware timers, but its non-trivial. Its easy to get a specific frequency going, but then you have to have the PWM line high or low for a specific duty cycle within that frequency, and of course the two lines are going to be set to different values.

You have two other options...

- switch to AVR - the ATmega168 has six hardware PWM pins, in the same size package
- use an external motor driver (assuming you're driving a motor) that has a serial interface, like the Sabertooth or whatever.

- Jon

Offline RebelgiumTopic starter

  • Supreme Robot
  • *****
  • Posts: 638
  • Helpful? 0
  • It's called the future ... We like it here
Re: extra PWM on pic?
« Reply #2 on: January 28, 2008, 03:44:14 PM »
You have two other options...

- switch to AVR - the ATmega168 has six hardware PWM pins, in the same size package
- use an external motor driver (assuming you're driving a motor) that has a serial interface, like the Sabertooth or whatever.

- Jon


I am making a motor driver with a dedicated pic :P, so the second option is out.
And I've looked around a bit and I found other pics with plenty of PWM outputs in the same packaging.

I'll get one of those, tnx
To relax after some hard work on robotics: A very fun free online text based MMORPG
orgcrime.net

Offline rargus

  • Jr. Member
  • **
  • Posts: 9
  • Helpful? 0
Re: extra PWM on pic?
« Reply #3 on: February 03, 2008, 04:04:14 PM »
Have a look at http://www.awce.com/pak5.htm -- I used 3 of these to drive 21 outputs about a year ago.

 


Get Your Ad Here