Hello there,i got my pickit3 with 18F45k20 44-pin demo board .I was trying about two weeks to figure out what is going on with the configure template code in MPLAB v8.92 in assembly language.First of all i start the project wizard ,i put in the source files the file "18f45k20TEMP.ASM " file and in Linker script the file called " 18f45k20_g.lkr " .Without changes in the code i press BUILD ALL and i get some errors like
Error[115] C:\USERS\NICKOLAS\DESKTOP\ATOD\18F45K20TEMP.ASM 148 : Duplicate label ("START" or redefining symbol that cannot be redefined)
Error[113] C:\USERS\NICKOLAS\DESKTOP\ATOD\18F45K20TEMP.ASM 150 : Symbol not previously defined (RP0)
Error[113] C:\USERS\NICKOLAS\DESKTOP\ATOD\18F45K20TEMP.ASM 152 : Symbol not previously defined (RP0)
i send you a picture to see clearly... --> http://prntscr.com/9hblv7
i cant figure out what is going on with this pic...and i wanna get started with simple projects such as flash led ,analog to digital e.t.c
i think the main ISSUE is the configure template,if i fix that everything will run ...the problem is that i cant understand what its going on.
i will send you the full code and template to see .... Please help me guys if anyone knows something for this...Thanks for your time !
Error[115] C:\USERS\NICKOLAS\DESKTOP\ATOD\18F45K20TEMP.ASM 148 : Duplicate label ("START" or redefining symbol that cannot be redefined)
Error[113] C:\USERS\NICKOLAS\DESKTOP\ATOD\18F45K20TEMP.ASM 150 : Symbol not previously defined (RP0)
Error[113] C:\USERS\NICKOLAS\DESKTOP\ATOD\18F45K20TEMP.ASM 152 : Symbol not previously defined (RP0)
i send you a picture to see clearly... --> http://prntscr.com/9hblv7
i cant figure out what is going on with this pic...and i wanna get started with simple projects such as flash led ,analog to digital e.t.c
i think the main ISSUE is the configure template,if i fix that everything will run ...the problem is that i cant understand what its going on.
i will send you the full code and template to see .... Please help me guys if anyone knows something for this...Thanks for your time !
Code:
LIST P=PIC18F45K20 ; list directive to define processor
#INCLUDE <P18F45K20.INC> ; processor specific variable definitions
;------------------------------------------------------------------------------
;
; CONFIGURATION WORD SETUP
;
; The 'CONFIG' directive is used to embed the configuration word within the
; .asm file. The lables following the directive are located in the respective
; .inc file. See the data sheet for additional information on configuration
; word settings.
;
;------------------------------------------------------------------------------
CONFIG FOSC = INTIO7, FCMEN = OFF, IESO = OFF, PWRT = OFF, BOREN = OFF
CONFIG BORV = 18, WDTEN = OFF, WDTPS = 1, MCLRE = ON, HFOFST = ON
CONFIG LPT1OSC = OFF, PBADEN = OFF, CCP2MX = PORTC, STVREN = OFF
CONFIG LVP = OFF, XINST = OFF, CP0 = OFF, CP1 = OFF, CP2 = OFF
CONFIG CP3 = OFF, CPB = OFF, CPD = OFF, WRT0 = OFF, WRT1 = OFF
CONFIG WRT2 = OFF, WRT3 = OFF, WRTB = OFF, WRTC = OFF, WRTD = OFF
CONFIG EBTR0 = OFF, EBTR1 = OFF, EBTR2 = OFF, EBTR3 = OFF
CONFIG EBTRB = OFF
;------------------------------------------------------------------------------
;
; VARIABLE DEFINITIONS
;
;------------------------------------------------------------------------------
CBLOCK 0x60 ; Sample GPR variable register allocations
MYVAR1 ; user variable at address 0x60
MYVAR2 ; user variable at address 0x61
MYVAR3 ; user variable at address 0x62
ENDC
W_TEMP EQU 0x000 ; w register for context saving (ACCESS)
STATUS_TEMP EQU 0x001 ; status used for context saving
BSR_TEMP EQU 0x002 ; bank select used for ISR context saving
;------------------------------------------------------------------------------
; EEPROM INITIALIZATION
;
; The 18F45K20 has non-volatile EEPROM starting at 0xF00000
;
;------------------------------------------------------------------------------
DATAEE ORG 0xF00000 ; Starting address for EEPROM for 18F45K20
DE "MCHP" ; Place 'M' 'C' 'H' 'P' at address 0,1,2,3
;------------------------------------------------------------------------------
; RESET VECTOR
;------------------------------------------------------------------------------
RES_VECT ORG 0x0000 ; processor reset vector
; go to beginning of program
;------------------------------------------------------------------------------
; HIGH PRIORITY INTERRUPT VECTOR
;------------------------------------------------------------------------------
ISRH ORG 0x0008
; Run the High Priority Interrupt Service Routine
GOTO HIGH_ISR
;------------------------------------------------------------------------------
; LOW PRIORITY INTERRUPT VECTOR
;------------------------------------------------------------------------------
ISRL ORG 0x0018
; Run the High Priority Interrupt Service Routine
GOTO LOW_ISR
;------------------------------------------------------------------------------
; HIGH PRIORITY INTERRUPT SERVICE ROUTINE
;------------------------------------------------------------------------------
HIGH_ISR
; Insert High Priority ISR Here
RETFIE FAST
;------------------------------------------------------------------------------
; LOW PRIORITY INTERRUPT SERVICE ROUTINE
;------------------------------------------------------------------------------
LOW_ISR
; Context Saving for Low ISR
MOVWF W_TEMP ; save W register
MOVFF STATUS, STATUS_TEMP ; save status register
MOVFF BSR, BSR_TEMP ; save bankselect register
; Insert Low Priority ISR Here
; Context Saving for Low ISR
MOVFF BSR_TEMP, BSR ; restore bankselect register
MOVF W_TEMP, W ; restore W register
MOVFF STATUS_TEMP, STATUS ; restore status register
RETFIE
;------------------------------------------------------------------------------
; MAIN PROGRAM
;------------------------------------------------------------------------------
START
BSF STATUS,RP0 ; select Register Bank 1
BCF TRISD,0 ; make IO Pin RD0 an output
BCF STATUS,RP0 ; back to Register Bank 0
BSF PORTD,0 ; turn on LED RD0 (DS0)
GOTO $ ; loop program counter
END
Attachments
-
18.7 KB Views: 3