Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

PIC 16f84 Programming Problem

Status
Not open for further replies.

manojanand

Member level 1
Joined
Nov 16, 2004
Messages
36
Helped
2
Reputation
4
Reaction score
1
Trophy points
1,288
Activity points
237
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
 

pic16f84a indf

There is no WHILE directive in assembler.
 

Friend i am using MPLAB. and here is some part regarding WHILE directive:

WHILE Execution of program section as long as condition is met Syntax:while<condition>. endwDescription:program lines between WHILE and ENDW would be executed as long as condition was met. If a condition stopped being valid, program would continue executing instructions following ENDW line. Number of instructions between WHILE and ENDW can be 100 at the most, and number of executions 256.Example:While i<10i=i+1endw
 

The directive will condition the assembling process not the running of the program it self.

Look for the definition of "Directive"
 

U r very true atferari , now tell me how can i acheive the desire goal.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top