Bit addressing in a loop for 8051 assembly?

Status
Not open for further replies.

chicken_feet

Member level 4
Joined
Mar 3, 2005
Messages
69
Helped
2
Reputation
4
Reaction score
0
Trophy points
1,286
Activity points
2,138
Hi all,

I would like to know if there are anyway of writing a loop in assembly where for each loop, we can address a particular bit according the amount of loop cycle?

For example -

For COUNT = 0 until COUNT = 7, do
{
output_pin = bit(count) of variable
}
enddo

------------------------------

I need to know how to address bit(count) - if there are any ways of doing it....

thks.

rgds,
chicken_feet
 

You can use C (carry) bit, for example:
; A should contain desired byte

CLR C
MOV R0, #07h
Loop: RRC A
MOV PINx, C
DJNZ, R0, Loop
 
Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…