Society of Robots - Robot Forum
Software => Software => Topic started by: Rebelgium 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
-
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
-
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
-
Have a look at http://www.awce.com/pak5.htm -- I used 3 of these to drive 21 outputs about a year ago.