This is the pin configurations for 40 pins PIC18F4550
PIC18F4550 can use same basic circuit of PIC16F877A. All pins are similar. PGC, PGD, MCLR, VDD, VDD are use for ICSP programming port.
Important setting in using PIC18F4550
#pragma config PLLDIV = 5 // This value has to be 5 for 20Mhz crystal
#pragma config FOSC = HSPLL_HS // High Speed oscillator for crystal more than 4Mhz
#define _XTAL_FREQ 16000000 // Use 16Mhz although 20Mhz crystal is used
Although 20Mhz crystal is used , _XTAL_FREQ 16000000 has to be define to be 16Mhz because the speed of this PIC is fix at 4Mhz, 16MHz, 48Mhz...If _XTAL_FREQ 20000000, __delay_ms() and __delay_us() function is not accurate. _XTAL_FREQ 16000000 is the only ways I can think to make it accurate.
**If you manage to get accurate delay with _XTAL_FREQ 20000000, please share with me...thanks
No comments:
Post a Comment