I am trying to get this new pic to run, never used it before so i dont know what bits to set in the config to get it just to light up leds on all ports A,B,C
here is the ASM file any clues what have i missed off?
here is the ASM file any clues what have i missed off?
Rich (BB code):
;******************************************************************************
; This file is a basic template for creating relocatable assembly code for *
; a PIC18F2220. Copy this file into your project directory and modify or *
; add to it as needed. *
; *
; The PIC18FXXXX architecture allows two interrupt configurations. This *
; template code is written for priority interrupt levels and the IPEN bit *
; in the RCON register must be set to enable priority levels. If IPEN is *
; left in its default zero state, only the interrupt vector at 0x008 will *
; be used and the WREG_TEMP, BSR_TEMP and STATUS_TEMP variables will not *
; be needed. *
; *
; Refer to the MPASM User's Guide for additional information on the *
; features of the assembler and linker. *
; *
; Refer to the PIC18F2221/2321/4221/4321 Data Sheet for additional *
; information on the architecture and instruction set. *
; *
;******************************************************************************
; *
; Filename: *
; Date: *
; File Version: *
; *
; Author: *
; Company: *
; *
;******************************************************************************
; *
; Files required: P18F2321.INC *
; *
;******************************************************************************
LIST P=18F2321, F=INHX32 ;directive to define processor and file format
#include <P18F2321.INC> ;processor specific variable definitions
;******************************************************************************
;Configuration bits
;Microchip has changed the format for defining the configuration bits, please
;see the .inc file for futher details on notation. Below are a few examples.
; This code will start executing when a reset occurs.
ORG 0x000 ; RESET VECTOR
goto Start
CONFIG WDT=off , BOR= off ,OSC = INTIO2 , FCMEN = off , MCLRE = off ,PBADEN = DIG , CP0 = OFF , CP1 = OFF
;internal osc i/o on ra6, ra7 ; RE3 input pin enabled; MCLR disabled ; wdt off re1 internal set to V+ ; brown out off
Banksel OSCCON
movlw b'01111111' ; 8mhz clock internal
movwf OSCCON
CLRF PORTA
CLRF PORTB
CLRF PORTC
CLRF LATA
CLRF LATB
CLRF LATC
MOVLW b'00001111' ; Configure A/D off vref internal to set A?D on AN0 inpt E0h
MOVWF ADCON1 ; for digital inputs
MOVWF b'00000111' ; Turn comparators off
MOVWF CMCON
MOVLW .0
MOVWF TRISA ; outputs
MOVWF TRISB ;outputs
MOVWF TRISC ; outputs
clrf PORTA
clrf PORTB
clrf PORTC
clrf PORTE ; port E,0 as input I/O
errorlevel -302 ; suppress banksel warning messages during assembly
errorlevel -311 ; suppress HIGH operator warning messages during assembly
errorlevel -207 ; suppress labels warning
;******************************************************************************
;Variable definitions
; These variables are only needed if low priority interrupts are used.
; More variables may be needed to store other special function registers used
; in the interrupt routines.
CBLOCK 0x20 ; user file mnames
Temp
HUNS
TENS
UNIITS
d1
d2
d3
d4
ENDC
;******************************************************************************
;EEPROM data
; Data to be programmed into the Data EEPROM is defined here
;DATA_EEPROM CODE 0xf00000
;DE "Test Data",0,1,2,3,4,5
;******************************************************************************
;High priority interrupt vector
; This code will start executing when a high priority interrupt occurs or
; when any interrupt occurs if interrupt priorities are not enabled.
;HI_INT_VECTOR CODE
; 0x0008
; bra HighInt ;go to high priority interrupt routine
;******************************************************************************
;Low priority interrupt vector
; This code will start executing when a low priority interrupt occurs.
; This code can be removed if low priority interrupts are not used.
;LOW_INT_VECTOR CODE 0x0018
; bra LowInt ;go to low priority interrupt routine
;******************************************************************************
;High priority interrupt routine
; The high priority interrupt code is placed here.
;******************************************************************************
;Low priority interrupt routine
; The low priority interrupt code is placed here.
; This code can be removed if low priority interrupts are not used.
;******************************************************************************
;Start of main program
Start
movlw .255
movwf PORTB
movwf PORTC
movwf PORTA
goto Start
END
Last edited by a moderator: