(Solved) Question about PIC18F26K22 and PWM

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Post Reply
maharadga
Posts: 71
Joined: Mon Dec 01, 2014 1:38 pm
Location: Bulgaria
Has thanked: 17 times
Been thanked: 12 times
Contact:

(Solved) Question about PIC18F26K22 and PWM

Post by maharadga »

Hello, everybody.
I try make simple PWM using PIC18F26K22. I found in posts this: http://www.matrixtsl.com/mmforums/viewt ... pwm#p62906
Brendan posts answers, but I can't understand how tune PIC. I tried all the things I thought but I need a little nudge.
This PIC have true many, many settings. I want to use it because have lot of words and memory and I need of very simple PWM.
I will be happy if somebody loose 30 seconds for me. I'm sure for the experts this will be a toy, but it really hinders me.
Attachments
PWM_Simple.fcfx
(8.29 KiB) Downloaded 248 times
Last edited by maharadga on Wed Mar 29, 2017 12:29 pm, edited 1 time in total.

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: Question about PIC18F26K22 and PWM

Post by Benj »

Hello,

The only thing I have spotted is that in your configuration settings you have the Primary Clock Enable set to Disabled. Maybe this should be enabled.

Everything else seems to look ok.

Are you connecting the MCLR pin to VCC using say a 10K -100K resistor?

I would probably advise the one second flasher test to help double check the device is running as expected and at the right speed. Once this is correct the PWM should simply work.

https://www.matrixtsl.com/wikiv7/index. ... ED_flasher

maharadga
Posts: 71
Joined: Mon Dec 01, 2014 1:38 pm
Location: Bulgaria
Has thanked: 17 times
Been thanked: 12 times
Contact:

Re: Question about PIC18F26K22 and PWM

Post by maharadga »

Thanks, Benj for the answer. It's my mistake.
In my program I write duty=256 instead 255. I need glasses probably :lol:

Post Reply