View previous topic :: View next topic |
Author |
Message |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sat Apr 03, 2010 9:59 pm |
|
|
Quote: |
I use 20MHz crystal.
|
First try blinking an LED with the PIC running at 20 MHz, as shown in
the program below. Does this work ?
Code: |
#include <18F4550.h>
#fuses HS, NOWDT, PUT, BROWNOUT, NOLVP
#use delay(clock=20000000)
//====================================
void main()
{
// Blink an LED on pin B0.
while(1)
{
output_high(PIN_B0);
delay_ms(500);
output_low(PIN_B0);
delay_ms(500);
}
}
|
If that works, change the fuses to run in PLL mode:
Code: |
#include <18F4550.h>
#fuses HSPLL,NOWDT,NOPROTECT,NOLVP,USBDIV,PLL5,CPUDIV1
#use delay(clock=48000000)
//==========================
void main()
{
while(1)
{
output_high(PIN_B0);
delay_ms(500);
output_low(PIN_B0);
delay_ms(500);
}
} |
|
|
|
rudy
Joined: 27 Apr 2008 Posts: 167
|
|
Posted: Sun Apr 04, 2010 5:59 am |
|
|
Yes, the problem was the port address, I was calling 0x80 but, in 18F4550 is 0xf80.
works fine now,
regards. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|