Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

why the code is not working in pic12f675

Status
Not open for further replies.

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
 

The first problem I have spotted is, there is no endc for your cblock.
 
  • Like
Reactions: Ukd123

    Ukd123

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top