Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Tools
Old 27th March 2009, 06:08 AM   #1
Default pic16f84 bsf in loop

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.
durgap is offline  
Old 27th March 2009, 06:41 AM   #2
Default

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 by mabauti; 27th March 2009 at 06:41 AM.
mabauti is offline  
Old 27th March 2009, 07:46 AM   #3
Default

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.
colin55 is offline  
Old 27th March 2009, 08:40 AM   #4
Default

I would say he is wanting to compare store_temp to count. But the code don't make any since
Quote:
molw D'7'
is movlw
Quote:
bsf store_temp, count_8
you can't do that

Last edited by be80be; 27th March 2009 at 08:41 AM.
be80be is offline  
Reply

Tags
bsf, loop, pic16f84

Thread Tools
Display Modes


Similar
Title Starter Forum Replies Latest
loop time out homemade24 Micro Controllers 3 12th February 2009 02:33 PM
Ac Loop Oscillator magnetman12003 Electronic Projects Design/Ideas/Reviews 1 29th March 2008 10:33 PM
Can PIC16F84 replaced by PIC16F877A with the same configurations in PIC16F84?? chunei Micro Controllers 6 3rd September 2007 10:57 PM
help in vhdl for loop abilash Electronic Projects Design/Ideas/Reviews 2 8th April 2007 08:54 AM
FOR loop in C eblc1388 Micro Controllers 12 10th January 2007 11:24 PM



All times are GMT. The time now is 04:48 AM.


Electronic Circuits  |  Learning Electronics
eXTReMe Tracker