gc80c520a CORERIVER Semiconductor, gc80c520a Datasheet - Page 112

no-image

gc80c520a

Manufacturer Part Number
gc80c520a
Description
Midas1.0 Family Mask Rom/eprom/romless 8-bit Turbo Microcontrollers
Manufacturer
CORERIVER Semiconductor
Datasheet
DJNZ
Description:
Function:
Example:
<byte>, <rel-addr>
Decrement and Jump if Not Zero
DJNZ decrements the location indicated by 1, and branches to the address
indicated by the second operand if the resulting value is not zero. An original
value of 00h will underflow to 0FFh. No flags are affected. The branch
destination would be computed by adding the signed relative-displacement
value in the last instruction byte to the PC, after incrementing the PC to the first
byte of the following instruction.
The location decremented may be a register or directly addressed byte.
Note: When this instruction is used to modify an output port, the value used as
the original port data will be read from the output data latch, not the input pins.
Internal RAM locations 40h, 50h and 60h contain the values 01h, 70h, and 15h,
respectively. The instruction sequence,
DJNZ 40H,LABEL_1
DJNZ 50H,LABEL_2
DJNZ 60H,LABEL_3
will cause a jump to the instruction at label LABEL_2 with the values 00h, 6Fh,
and 15h in the three RAM locations. The first jump was not taken because the
result was zero.
This instruction provides a simple way of executing a program loop a given
number of times, or for adding a moderate time delay (from 2 to 512 machine
cycles) with a single instruction. The instruction sequence,
TOGGLE:
will toggle P1.7 eight times, causing four output pukes to appear at bit 7 of
output Port 1. Each pulse will last three machine cycles; two for DJNZ and one
to alter the pin.
Preliminary
MOV
CPL
DJNZ
Page 112 of 187
R2, #8
P1.7
R2, TOGGLE
Instruction Set

Related parts for gc80c520a