Professional Documents
Culture Documents
#include "p16f877A.inc“
CBLOCK 0x20 ;Use CBLOCK and ENDC to reserve a block of register file locations
;starting at address 0x20 in register file space
count1 ;count1 = 0x20
count2 ;count2 = 0x21
count3 ;count3 = 0x22
count4 ;count4 = 0x23
ENDC
CBLOCK 0x20 ;Reserve reg file locns, starting at adr 0x20 in reg file
space
count3 ;count3 = 0x20
count4 ;count4 = 0x21
ENDC
org 0x05
beginpgm
banksel ADCON1
movlw 6
movwf ADCON1
banksel PORTA
clrf PORTA ;initialize port A by zeroing
;output data latches.
banksel TRISA
movlw 0x01 ;Set RA0 for input, RA1 for output
movwf TRISA
banksel PORTA