Page 1 of 1
18F46K22 Channel 2 PWM pin option not working
Posted: Mon Apr 21, 2014 11:33 am
by Mark
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/mmforu ... 54&t=14564
but with no success.
Thanks in advance,
Re: 18F46K22 Channel 2 PWM pin option not working
Posted: Sat May 10, 2014 10:47 am
by Mark
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?
Re: 18F46K22 Channel 2 PWM pin option not working
Posted: Tue May 20, 2014 10:51 am
by LeighM
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
Re: 18F46K22 Channel 2 PWM pin option not working
Posted: Tue May 20, 2014 11:50 am
by Mark
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