FCD file for 18FxxK50

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

Moderators: Benj, Mods

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: FCD file for 18FxxK50

Post by kersing »

For USB usage I'm using the following settings (FC5 project, but should work for FC6):
Clock speed 48000000 (48MHz)

Chip settings:
chipsettings.JPG
(211.3 KiB) Downloaded 1708 times
At the start of the Main macro add a C code block to setup the oscillator:

Code: Select all

osccon = 0b01110000;
osccon2 = 0b00010000;
// wait for oscillator to tune
while (osccon2.PLLRDY != 1) ;

// enable USB tuning
actcon = 0b10010000;
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

User avatar
RobH
Posts: 95
Joined: Wed Sep 11, 2013 7:51 pm
Has thanked: 29 times
Been thanked: 17 times
Contact:

Re: FCD file for 18FxxK50

Post by RobH »

Still running way too fast. I set the clock speed on the general options tab back to 16000000 and like you suggested and double checked the target as 18F25K50, I have this in a C code box at the beginning of my flowchart:

osccon = 0b01110000;
osccon2 = 0b00010000;
// wait for oscillator to tune
while (osccon2.PLLRDY != 1) ;

// enable USB tuning
actcon = 0b10010000;


And here is my config. The only thing I changed from your version is MCLR to disabled so that PICkit3 will release the chip to run the hex while still being plugged in.

Image


And here's my flowchart:

Image

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: FCD file for 18FxxK50

Post by kersing »

The clock speed in the general options should be 48000000. When set to that, could you time (stopwatch) what the delay is? (Depending on the speed I usually time 10 on/off cycles and divide by 10)
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

User avatar
RobH
Posts: 95
Joined: Wed Sep 11, 2013 7:51 pm
Has thanked: 29 times
Been thanked: 17 times
Contact:

Re: FCD file for 18FxxK50

Post by RobH »

kersing wrote:The clock speed in the general options should be 48000000. When set to that, could you time (stopwatch) what the delay is? (Depending on the speed I usually time 10 on/off cycles and divide by 10)
'


That worked, although, I had to tweak a few config words to get things working smoothly with my current test code on hardware. It was having a hard time with some string functions.

Post Reply