manojanand
Member level 1
16f84 bsf instruction
Hello Friends , I have written a small code for PIC 16F84 microcontroller but i am facing some problem in it. Code is in assembly language. I am using WHILE directive with INDF register. It's purpose here is to check the contents of INDF register and if the contents are less than some particular value then increment the contents of INDF register by one and keep incrementing them untill it reaches that particular value which is defined using the WHILE directive. WHen the contents of INDF register reaches that particular valve , toggle the 0 bit of PORTB. But my code is not acheiving this purpose. please help me. Code is given below :
PROCESSOR 16F84
#include "p16f84.inc"
__CONFIG _CP_OFF &_WDT_OFF &_PWRTE_ON &_XT_OSC
org 0x00
goto Main
org 0x04
goto Main
Main
bcf STATUS , IRP
movlw 0x00
movwf TRISB
bsf STATUS , RP0
movlw 0xff
movwf TRISA
bcf STATUS , IRP
bsf STATUS , RP0
movlw 0x00
movwf FSR
movlw 0xf0
movwf FSR
loop movlw 0x00
movwf INDF
while INDF < 05
incf INDF
endw
bcf STATUS , RP0
bsf PORTB , 0
movlw 0x00
movwf INDF
while INDF < 05
incf INDF
endw
bcf PORTB, 0
goto loop
end
Hello Friends , I have written a small code for PIC 16F84 microcontroller but i am facing some problem in it. Code is in assembly language. I am using WHILE directive with INDF register. It's purpose here is to check the contents of INDF register and if the contents are less than some particular value then increment the contents of INDF register by one and keep incrementing them untill it reaches that particular value which is defined using the WHILE directive. WHen the contents of INDF register reaches that particular valve , toggle the 0 bit of PORTB. But my code is not acheiving this purpose. please help me. Code is given below :
PROCESSOR 16F84
#include "p16f84.inc"
__CONFIG _CP_OFF &_WDT_OFF &_PWRTE_ON &_XT_OSC
org 0x00
goto Main
org 0x04
goto Main
Main
bcf STATUS , IRP
movlw 0x00
movwf TRISB
bsf STATUS , RP0
movlw 0xff
movwf TRISA
bcf STATUS , IRP
bsf STATUS , RP0
movlw 0x00
movwf FSR
movlw 0xf0
movwf FSR
loop movlw 0x00
movwf INDF
while INDF < 05
incf INDF
endw
bcf STATUS , RP0
bsf PORTB , 0
movlw 0x00
movwf INDF
while INDF < 05
incf INDF
endw
bcf PORTB, 0
goto loop
end