Software Controlled PWM

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 7.

Moderator: Benj

Post Reply
User avatar
Steve001
Valued Contributor
Valued Contributor
Posts: 1189
Joined: Wed Dec 31, 2008 3:37 pm
Has thanked: 460 times
Been thanked: 523 times
Contact:

Software Controlled PWM

Post by Steve001 »

Afternoon All,

Looking at an application that I would like 3 PWM channels my device only has two available only a cursory look on microchips part selector reviled that 4 channels tend to be on the high pin count devices. So thought of doing it in software have seen the software PWW example of a night rider LED chaser but this didn't make much sense, couldn't see how it was working.

A software PWM search - returned too many results "software" & "pwm"

Anybody got an example ?

I have toyed with the idea of a two timer approach using timer0 and timer2

Steve
Success always occurs in private and failure in full view.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Software Controlled PWM

Post by Benj »

Hi Steve,

A single timer may be all that is required.

There is a software PWM example here that should hopefully help.
https://www.matrixtsl.com/wiki/index.ph ... Interrupts

Let us know how you're getting on.

User avatar
Steve001
Valued Contributor
Valued Contributor
Posts: 1189
Joined: Wed Dec 31, 2008 3:37 pm
Has thanked: 460 times
Been thanked: 523 times
Contact:

Re: Software Controlled PWM

Post by Steve001 »

Hi Ben

Might be a few weeks before i can get back to you mega busy at work at the moment :(

Why do you say only 1 timer ?

was thinking on the lines of timer2 for the PWM frequency timer0 for the duty or is this OTT and heading on the lines of generating a headache ?

looking for a 0 - 240 count where 240 = 100% duty (trying to make the maths easy)

Steve
Success always occurs in private and failure in full view.

User avatar
Steve001
Valued Contributor
Valued Contributor
Posts: 1189
Joined: Wed Dec 31, 2008 3:37 pm
Has thanked: 460 times
Been thanked: 523 times
Contact:

Re: Software Controlled PWM

Post by Steve001 »

Afternoon All

After mooching around RS for some parts had a go with their part selector found a couple of suitable devices had another go with MPAS these parts didn't appear

Have found the following devices - so will order them and have a go. 4 PWM channels too and supported by V7 :mrgreen:

PIC16F1828-I/P

https://uk.rs-online.com/web/p/microcon ... s/7154393/

PIC16F1825-E/P

https://uk.rs-online.com/web/p/microcon ... s/7434700/

Steve
Success always occurs in private and failure in full view.

Post Reply