Ukd123
Newbie level 4
- Joined
- Jun 6, 2010
- Messages
- 5
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Location
- Westbengal
- Activity points
- 1,325
i have assembled one simple code (given below) for blinking led and loadd into 12f675 which is also working well in MPLAB7 IDE. But practically it is not working at all.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
list p=12f675
#include <p12f675.inc>
#define ADCpresent
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
__CONFIG _CP_OFF & _MCLRE_OFF & _WDT_OFF & _INTRC_OSC_NOCLKOUT & _BODEN_OFF & _CPD_OFF &_PWRTE_OFF
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#DEFINE LED GPIO,0
#DEFINE LED_IO TRISIO,0
;;;;;;;;;;;;;;;;;;;;;;;
cblock 20h
CNT0
CNT1
CNT2
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ORG 0000H
MOVLW 07H
MOVWF CMCON ; TURN-OFF analog comparator
BSF STATUS,RP0 ; select bank 1
CALL 3FFH ; Load cal value
MOVWF OSCCAL
CLRF ANSEL
BCF LED_IO ; set as output
BCF STATUS,RP0 ; select bank 0
LOOP: BSF LED
CALL DELAY
BCF LED
CALL DELAY
GOTO LOOP
;---------------------------------
; DELAY 0.5 SECONDS ROUTINE
;---------------------------------
DELAY: MOVLW 03H
MOVWF CNT0
MOVLW 18H
MOVWF CNT1
MOVLW 02H
MOVWF CNT2
Delay_0 DECFSZ CNT0, f
GOTO $+2
DECFSZ CNT1, f
GOTO $+2
DECFSZ CNT2, f
GOTO Delay_0
GOTO $+1 ;delay 2 cycles
GOTO $+1 ;delay 2 cycles
GOTO $+1 ;delay 2 cycles
RETURN
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
END
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
list p=12f675
#include <p12f675.inc>
#define ADCpresent
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
__CONFIG _CP_OFF & _MCLRE_OFF & _WDT_OFF & _INTRC_OSC_NOCLKOUT & _BODEN_OFF & _CPD_OFF &_PWRTE_OFF
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#DEFINE LED GPIO,0
#DEFINE LED_IO TRISIO,0
;;;;;;;;;;;;;;;;;;;;;;;
cblock 20h
CNT0
CNT1
CNT2
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ORG 0000H
MOVLW 07H
MOVWF CMCON ; TURN-OFF analog comparator
BSF STATUS,RP0 ; select bank 1
CALL 3FFH ; Load cal value
MOVWF OSCCAL
CLRF ANSEL
BCF LED_IO ; set as output
BCF STATUS,RP0 ; select bank 0
LOOP: BSF LED
CALL DELAY
BCF LED
CALL DELAY
GOTO LOOP
;---------------------------------
; DELAY 0.5 SECONDS ROUTINE
;---------------------------------
DELAY: MOVLW 03H
MOVWF CNT0
MOVLW 18H
MOVWF CNT1
MOVLW 02H
MOVWF CNT2
Delay_0 DECFSZ CNT0, f
GOTO $+2
DECFSZ CNT1, f
GOTO $+2
DECFSZ CNT2, f
GOTO Delay_0
GOTO $+1 ;delay 2 cycles
GOTO $+1 ;delay 2 cycles
GOTO $+1 ;delay 2 cycles
RETURN
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
END