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.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…