jenniferkpj
New Member
Hi all! I am having troubles understanding how the clock for PIC18F4682 works. I'm not doing anything fancy. i am using CCS C compiler with the following code:
#fuse HS
main()
{
while(1)
{
output_toggle(PIN_C7);
}
}
The crystals I used have the following frequency output (from PIN_C7):
8Mhz -> 333khz
10Mhz -> 416.67khz
16Mhz -> 666.7khz
It looks like the input for the PIC's clock (OSC1) is being divided by 24 for the output (ex: 8Mhz/333khz = 24, 10/416.67khz = 24, 16Mhz/666.7khz = 24). I saw people posting the system clock should be the input clock divided by 4 (ex. 10Mhz input should have a system clock of 2.5Mhz)
Are there a lot of low level assembly instructions for the function out_toggle() that would cause the low frequency when i output? or is there a setting I should look into to increase this output frequency?
Thanks a lot!
#fuse HS
main()
{
while(1)
{
output_toggle(PIN_C7);
}
}
The crystals I used have the following frequency output (from PIN_C7):
8Mhz -> 333khz
10Mhz -> 416.67khz
16Mhz -> 666.7khz
It looks like the input for the PIC's clock (OSC1) is being divided by 24 for the output (ex: 8Mhz/333khz = 24, 10/416.67khz = 24, 16Mhz/666.7khz = 24). I saw people posting the system clock should be the input clock divided by 4 (ex. 10Mhz input should have a system clock of 2.5Mhz)
Are there a lot of low level assembly instructions for the function out_toggle() that would cause the low frequency when i output? or is there a setting I should look into to increase this output frequency?
Thanks a lot!