Page 1 of 1

8 bit PIC with 4 PWM channels

Posted: Mon May 11, 2015 7:57 pm
by octal
Hello,
I have been far from 8bit chips for a while. I just wanted to know if anyone is aware of an 8bit chip (PIC preferably) having 4 PWM output channels and that can achieve about 30Hz up to 150KHz.

Thx

Re: 8 bit PIC with 4 PWM channels

Posted: Tue May 12, 2015 8:04 am
by SHughes_Fusion
Depends what you want to program it with!

There are a few PIC16 with four PWMs - I've used the F1503 with some success in the past.

Daft suggesting, but why not take a look on MAPS? You can filter by PWMs on there.

Re: 8 bit PIC with 4 PWM channels

Posted: Tue May 12, 2015 9:58 am
by Jerry Messina
I think you'll find a number of PIC18's that have 4 PWM's. There's the 18F26K22 that has 5 CCP peripherals.

The devil's in the details. Most chips only have a few timers to use as the timebase, so they're not all independant
PIC18's use the even number timers as PWM timebase (ie TMR2/4/6).

Also, you'll have a problem getting the freq range of 30Hz-150KHz. The PWM peripheral has a lot of resolution at the low end,
but not a lot of freq range without running the chip at a really slow clock freq. For example, FOSC=4MHz will get you 244Hz...
you'd have to drop all the way down to 500KHz to get 30Hz PWM.

Once you get that low in freq it's probably better to just skip using the PWM peripheral and do the PWM using timers and code.

One thing I've done when trying to get a low freq is to use one of the timers as a clock, say TMR2 set for 1KHz, and run that
output into one of the other timers as an input for a CCP set to compare mode (one of the odd number timers 1/3/5).
You usually need a little interrupt code to create/handle the output pin, but that depends on exactly what mode you use.

Re: 8 bit PIC with 4 PWM channels

Posted: Wed May 13, 2015 9:24 am
by octal
Thank you for your answers.

@SHughes_Fusion
I didn't used MAPS because it doesn't provide frequency range as a parameter.

@Jerry
This project is for a friend. If it was me I would have used an STM32 (Cortex-M) chip which has very nice timers (though more complex to use), but he need a DIP package.
The PIC18F26K22 is perfect for his needs. I also suggested to him to have a look at, eventually, PIC32 chips because they have fast bitbang I/O and he can use timers (nd CCP) to bitbang pins directly (care must be taken with mips PIC32 core cache though).