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.

Calculating delays for a microcontroller...

Status
Not open for further replies.
The dollar sign ($) indicates the value of the active segment's location counter.
When you use the location counter symbol, keep in mind that its value changes with each instruction, but only after that instruction has been completely evaluated.
If you use $ in an operand to an instruction or a directive, it represents the code address of the first byte of that instruction.

In your case the code loops back to the first byte of the "djnz R2,$" instruction as long as R2 is not zero.
Clear ?

Edit: Please note that this is valid for the ASM51 assembler.
If you use another assembler, it could mean something else... ...
 
Last edited:
is that mean $ is from the label d2 , mean it replace this $ to become d2 ,Djnz r2,$ Subtract value r2 by one then loop back until not zero
 
Code:
D2:   mov R2,#29
     djnz R2,$

is equal to
Code:
D2:   mov R2,#29
D3:   djnz R2,D3

is not equal to
Code:
D2:   mov R2,#29
     djnz R2,$

If you use $ in an operand to an instruction or a directive, it represents the code address of the first byte of that instruction.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top