Greetings, i really need some help here. been debuging for 2 days ! :O please tell me what's wrong with this short code. it's to make a LED blink. that's all. i tried the delay routine on PIC16F84, it's working. the LED blink ! but not with PICF874. The LED will ON permenantly. any configuration i missed out ? Thanks ! regards, ckchan ;********************************************************************** list p=16F874 ; list directive to define processor #include ; processor specific variable definitions __CONFIG _BODEN_OFF & _LVE_OFF & _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC ;***** VARIABLE DEFINITIONS w_temp EQU 0x0C ; variable used for context saving status_temp EQU 0x0D ; variable used for context saving msec_20 equ d'20' ; delay variable l_msec equ d'30' ; long delay variable dv1 equ 0x0E ; delay variable register1 dv2 equ 0x0F ; delay variable register2 ldv equ 0x10 ; l_delay variable register ;***** VARIABLE DEFINITIONS (BIT) #DEFINE LED PORTD,2 ;********************************************************************** ORG 0x000 ; processor reset vector goto MAIN ; go to beginning of program ORG 0x004 ; interrupt vector location movwf w_temp ; save off current W register contents movf STATUS,w ; move status register into W register movwf status_temp ; save off contents of STATUS register ; isr code can go here or be located as a call subroutine elsewhere movf status_temp,w ; retrieve copy of STATUS register movwf STATUS ; restore pre-isr STATUS register contents swapf w_temp,f swapf w_temp,w ; restore pre-isr W register contents retfie ; return from interrupt ;********************************************************************** MAIN clrf PORTD ; initialize port d bsf STATUS,RP0 ; select bank movlw B'00000000' ; set port d as output pin movwf TRISD ; movlw 0H ; default low to port d movwf PORTD ; bcf STATUS,RP0 ; de-select bank MAIN2 bcf LED ; ON led call LDELAY ; bsf LED ; OFF led call LDELAY ; goto MAIN2 ; ;**************************************************************** ; Short Delay ; DELAY movlw msec_20 ; move constant to w movwf dv1 ; store to db1 DLY1 clrf dv2 ; clear db2 decfsz dv1 ; decrement and skip if zero goto DLY2 ; retlw 0 ; return from call DLY2 decfsz dv2 ; decrement and goto DLY1 if zero goto DLY2 ; goto DLY1 ; ;****************************************************************** ; Long Delay ; LDELAY movlw l_msec ; move constant to w movwf ldv ; store to ldv LDLY1 call DELAY ; decfsz ldv ; decrement and skip if zero goto LDLY1 ; retlw 0 ; return from call ;********************************************************************** END