Microchip Technology DM164130-9 User Manual

Page of 101
PICkit™ 3 Starter Kit User’s Guide
DS41628B-page 44
 2012 Microchip Technology Inc.
This is a very important directive that is used the most in the enhanced mid-range core. 
This is an instruction to the assembler and linker to generate bank selecting code to set 
the bank to the one containing the TRISC register. In our case, that is Bank 1. This 
takes one instruction cycle. 
This allows pin RC0 to be an output. A ‘1’ in the register configures the pin for an input 
and a ‘0’ for output. 
It is good practice to initialize all output registers to ‘0’. It is not guaranteed that all 
registers will be cleared on Reset. 
This turns on DS1 on PortC0. 
This merely tells the assembler to go to the current instruction, which it will do 
indefinitely. 
3.2.6.2
PIC18
EXAMPLE 3-5: 
The Configuration Words and the CONFIG directive are different hereThe PIC18 has 
more feature-rich configurations. Please see the PIC18F14K22 data sheet for more 
information on what each Configuration Word does. 
The most important different distinction here is the lack of having to change banks. All 
of the SFRs are in the Access Bank and do not require a banksel statement. 
bcf    TRISC, 0
clrf  LATC
bsf    LATC, 0
goto $
#include <p18F14K22.inc>
    ;Config settings 
    CONFIG IESO = OFF, PLLEN = OFF, FOSC = IRC, FCMEN = OFF, PCLKEN = OFF
    CONFIG BOREN = SBORDIS, BORV = 19, PWRTEN = OFF, WDTEN = OFF
    CONFIG MCLRE = OFF, HFOFST = OFF, DEBUG = OFF, STVREN = ON
    CONFIG XINST = OFF, BBSIZ = OFF, LVP = OFF
    CONFIG CP0 = OFF, CP1 = OFF
    CONFIG CPD = OFF, CPB = OFF
    CONFIG WRT0 = OFF, WRT1 = OFF
    CONFIG WRTB = OFF, WRTC = OFF, WRTD = OFF
    CONFIG EBTR0 = OFF, EBTR1 = OFF
    CONFIG EBTRB = OFF
    errorlevel -302         ;suppress the 'not in bank0' warning
    ORG 0
Start:
     bcf     TRISC,0        ;make IO Pin C0 an output
     clrf    LATC           ;init the LATCH by turning off everything
     bsf     LATC,0         ;turn on LED C0 (DS1)
     goto    $              ;sit here forever!
    end