PWM 18FxxK80 Series MCUs

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
Sefi
Posts: 56
Joined: Mon Sep 29, 2008 10:26 am
Has thanked: 9 times
Been thanked: 14 times
Contact:

PWM 18FxxK80 Series MCUs

Post by Sefi »

I have just resolved an issue with the pwm definitions of these MCUs in FC5 which I thought I would share with you.

I needed a controller with 5 pwm channels and the K80 family satisfies that. When setting up the pwms in FC, I noticed that the second channel was not working. In the datasheet this is set up as CCP2 on pin RC2. In the definitions file of Flowcode the pin allocated to the second CCP is RC1. I made the following change and it all works perfectly:

Original definition:
Define53=#define MX_PWM_2_PORT portc
Define54=#define MX_PWM_2_TRIS trisc
Define55=#define MX_PWM_2_PIN 1

Changed to:
Define53=#define MX_PWM_2_PORT portc
Define54=#define MX_PWM_2_TRIS trisc
Define55=#define MX_PWM_2_PIN 2

Sorry if this is trivial but it was a major discovery for me and I spent a long time discovering it. :) (still a novice to FC)

Sefi

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: PWM 18FxxK80 Series MCUs

Post by medelec35 »

Hi Sefi,
Nice find!
I don't think its trivial.
Any bugs reported (especially if solved as well) are appreciated by all.
You will be saving someone else loads of time (and hair pulling) who will also be using PWM ch2 on 18FxxK80 devices.
Its odd how microchip suddenly swap ccp1 and ccp2 around to their normal convection?
Martin

Post Reply