8 bit PIC with 4 PWM channels

Discuss PIC and electronic related things

Moderators: David Barker, Jerry Messina

Post Reply
User avatar
octal
Registered User
Registered User
Posts: 586
Joined: Thu Jan 11, 2007 12:49 pm
Location: Paris IDF
Contact:

8 bit PIC with 4 PWM channels

Post by octal » Mon May 11, 2015 7:57 pm

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

SHughes_Fusion
Posts: 219
Joined: Wed Sep 11, 2013 1:27 pm
Location: Chesterfield

Re: 8 bit PIC with 4 PWM channels

Post by SHughes_Fusion » Tue May 12, 2015 8:04 am

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.

Jerry Messina
Swordfish Developer
Posts: 1469
Joined: Fri Jan 30, 2009 6:27 pm
Location: US

Re: 8 bit PIC with 4 PWM channels

Post by Jerry Messina » Tue May 12, 2015 9:58 am

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.

User avatar
octal
Registered User
Registered User
Posts: 586
Joined: Thu Jan 11, 2007 12:49 pm
Location: Paris IDF
Contact:

Re: 8 bit PIC with 4 PWM channels

Post by octal » Wed May 13, 2015 9:24 am

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).

Post Reply