Ask for Some Help regarding PIC16 series
Hi there,
I am new to the forum. I am currently doing an electrical engineering course which has some electronic parts. One part is about explaining the test result of a program. I find this quite difficult as I have never done this before and I am never going to use it in my job so I would just need help understand the changes happen in the program if the delay loop is changed from 0X32 to 0X02 in order to speed up the process. How the values stored in SFR and variable registers after the change can be explained?
This is the program:
; blinks LEDs on outputs in a rotating pattern, with input option to reverse direction
;Set microprocessor as 16F84
INCLUDE <P16F84.INC>
; Setup processor configuration
__config _RC_OSC & _WDT_OFF & _PWRTE_ON
; label 2 symbols as memory addresses for counting loops
J equ 1F
K equ 1E
SETUP:
org 0 ;
BANKSEL TRISB;
clrf TRISB;
bcf STATUS , RP0 ;
bcf STATUS , RP1 ;
movlw 0x01 ;
movwf PORTB ;
bcf STATUS,C ;
ROTATE:
btfss PORTA,0 ;
goto RR
rlf PORTB,f ;
goto DELAY
RR: rrf PORTB,f ;
DeLAY:
movlw 0x32 ;
movwf J ;
jloop: movwf K ;
kloop: decfsz K,f ;
goto kloop
decfsz J,f ;
goto jloop
DIRECTION:
movlw 0x02 ;
xorwf PORTA,0;
goto ROTATE ;
end ;
Thanks for your help.