Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

pic16f84 bsf in loop

Status
Not open for further replies.

durgap

New Member
Hello everybody.
I have a simple problem, Please help me out.
The code snap goes this way

store_temp ;a defined variable
count_8 ; a counter variable to sit the bits of store_temp as desired

;************************
molw D'7'
movwf count_8
loop
bsf store_temp, count_8 ;setting bit one by one
incf count_8
decfsz count_8, 1
goto loop
end
;********************

The problem is the bsf is executed only once. Next cycle no bit is set in store_temp and the loop goes on
Thanks.
 
I get this

Code:
Warning[202] D:\DOCS\DOCS\ASM\TIMER.ASM 81 : Argument out of range.  Least significant bits used.
this is because you only can use a constant (i.e. 0,1,2,..,7 etc.), not a variable (i.e. count_8, counter, etc)
 
Last edited:
What are you trying to do in this instruction:


bsf store_temp, count_8 ;setting bit one by one


You are incf and then decf the same file (register)

What do you want to do?


After "goto loop" you should have a few instructions that output a bit to a LED to show the program has actually reached the end of what you are trying to do.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top