Guest
hey there,
i really need some help in the general area of PIC 16f877. i am using
the PICDEM 2 plus board that comes with the mplab icd 2 in circuit
debugger.
the code below is a simple code but i am unfamiliar with the coding as
i have just started assembly.
what does it all mean?
list p=16F877
#include <p16F877.inc>
__CONFIG _CP_OFF & _WDT_OFF & _BODEN_OFF & _PWRTE_OFF & _HS_OSC &
_WRT_ENABLE_ON & _LVP_OFF & _DEBUG_OFF & _CPD_OFF
; '__CONFIG' directive is used to embed configuration data within .asm
file.
;***** VARIABLE DEFINITIONS
ctr0 equ 0x20
ctr1 equ 0x21
ctr2 equ 0x22
ctr3 equ 0x23
work equ 0x24
;**********************************************************************
org 0x000 ; processor reset vector
clrf PCLATH ; ensure page bits are cleared
goto main ; go to beginning of program
main ;beginning of the program
banksel TRISB ;select the bank containing TRISB
movlw 0xf3 ;port B is the o/p
movwf TRISB ;
banksel PORTB ;select the bank containing TRISB
movlw 0x08
movwf work
movlw 0xf0
movwf PORTB
movlw 0xf4
movwf PORTB
mainlo movlw 0xff
movwf ctr2
loop1 movlw 0xff
movwf ctr0
loop decf ctr0,1
bnz loop
decf ctr2,1
bnz loop1
movf work,0
movwf PORTB
comf work,1 ; toggle led's
movf work,0
movwf PORTB
comf work,1
goto mainlo
END ; directive 'end of program'
because i am just trying to display the nightrider effect with the LEDs
but its a little more difficult than i thought.
any help would be much apprieciated,
Regards,
Colm
i really need some help in the general area of PIC 16f877. i am using
the PICDEM 2 plus board that comes with the mplab icd 2 in circuit
debugger.
the code below is a simple code but i am unfamiliar with the coding as
i have just started assembly.
what does it all mean?
list p=16F877
#include <p16F877.inc>
__CONFIG _CP_OFF & _WDT_OFF & _BODEN_OFF & _PWRTE_OFF & _HS_OSC &
_WRT_ENABLE_ON & _LVP_OFF & _DEBUG_OFF & _CPD_OFF
; '__CONFIG' directive is used to embed configuration data within .asm
file.
;***** VARIABLE DEFINITIONS
ctr0 equ 0x20
ctr1 equ 0x21
ctr2 equ 0x22
ctr3 equ 0x23
work equ 0x24
;**********************************************************************
org 0x000 ; processor reset vector
clrf PCLATH ; ensure page bits are cleared
goto main ; go to beginning of program
main ;beginning of the program
banksel TRISB ;select the bank containing TRISB
movlw 0xf3 ;port B is the o/p
movwf TRISB ;
banksel PORTB ;select the bank containing TRISB
movlw 0x08
movwf work
movlw 0xf0
movwf PORTB
movlw 0xf4
movwf PORTB
mainlo movlw 0xff
movwf ctr2
loop1 movlw 0xff
movwf ctr0
loop decf ctr0,1
bnz loop
decf ctr2,1
bnz loop1
movf work,0
movwf PORTB
comf work,1 ; toggle led's
movf work,0
movwf PORTB
comf work,1
goto mainlo
END ; directive 'end of program'
because i am just trying to display the nightrider effect with the LEDs
but its a little more difficult than i thought.
any help would be much apprieciated,
Regards,
Colm