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.

Bit addressing in a loop for 8051 assembly?

Status
Not open for further replies.

chicken_feet

Member level 4
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

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top