18F46K22 Channel 2 PWM pin option not working

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

Moderator: Benj

Mark
Posts: 209
Joined: Thu Oct 19, 2006 11:46 am
Location: Bakewell, UK
Has thanked: 20 times
Been thanked: 16 times
Contact:

18F46K22 Channel 2 PWM pin option not working

Postby Mark » Mon Apr 21, 2014 11:33 am

Hi,

On the 18F46K22 Channel2 does not seem to output on C1, it outputs fine on the alternative of B3.
Channel 1 works fine on C2.
Channel 3 works fine on B5, not sure about E0.

I have tried the solution of Jan at

http://wwww.matrixmultimedia.com/mmforums/viewtopic.php?f=54&t=14564

but with no success.

Thanks in advance,
Go with the Flow.

Mark
Posts: 209
Joined: Thu Oct 19, 2006 11:46 am
Location: Bakewell, UK
Has thanked: 20 times
Been thanked: 16 times
Contact:

Re: 18F46K22 Channel 2 PWM pin option not working

Postby Mark » Sat May 10, 2014 10:47 am

Some input on this one would be appreciated.

If nothing else, where can I find the set-up code so I can see what values are being placed in the registers?
Go with the Flow.

User avatar
LeighM
Matrix Staff
Posts: 2008
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 480 times
Been thanked: 688 times
Contact:

Re: 18F46K22 Channel 2 PWM pin option not working

Postby LeighM » Tue May 20, 2014 10:51 am

Hi

If you look at the generated C code for your project, you will see the definitions such as

Code: Select all

#define MX_PWM_REF1
#define MX_PWM_PRESCALE1 (1024)
#define MX_PWM_PIN_1 (1)
#define MX_PWM_PORT_1 portc
#define MX_PWM_PERIOD 255
#define MX_PWM_TRIS_1 trisc
#define MX_PWM_CHANNEL_1 (2)

The PWM setup code is in the file PIC_CAL_PWM.c found in the Flowcode installation directory ..\CAL\PIC

Mark
Posts: 209
Joined: Thu Oct 19, 2006 11:46 am
Location: Bakewell, UK
Has thanked: 20 times
Been thanked: 16 times
Contact:

Re: 18F46K22 Channel 2 PWM pin option not working

Postby Mark » Tue May 20, 2014 11:50 am

Thanks, I will have a look.

The 18F46K22 timer 2 setup also does not work properly, it shows two prescalers but only one prescaler works (evidenced by the interrupt generated being way too fast). I used timer 6 instead and this works correctly.

Mark
Go with the Flow.