skyrock
New Member
hi all,
i'm having some difficulty setting up the external xtal working with 16f628.. can anyone help?
i've connected a 4mhz crystal with 2 ceramic 22pf capacitors to RA7 & RA6. The code is as below. the program supposed to turn on PORTB but it didn't.
i'm having some difficulty setting up the external xtal working with 16f628.. can anyone help?
i've connected a 4mhz crystal with 2 ceramic 22pf capacitors to RA7 & RA6. The code is as below. the program supposed to turn on PORTB but it didn't.
Code:
LIST p=16F628 ;tell assembler what chip we are using
include "P16F628.inc" ;include the defaults for the chip
ERRORLEVEL 0, -302 ;suppress bank selection messages
__config _XT_OSC &_MCLRE_OFF & _WDT_OFF & _PWRTE_OFF & _BODEN_OFF & _LVP_OFF & _CP_OFF & _DATA_CP_OFF
cblock 0x20
CNT
endc
ORG 0x00
goto MAIN
MAIN
bsf STATUS, RP0
clrf TRISB
clrf TRISA
bcf STATUS, RP0
movlw b'11110010'
movwf PORTB
clrf CNT
LOOP
goto LOOP