Samsung KS57C2308 Manual page 139

Single-chip cmos microcontroller
Table of Contents

Advertisement

KS57C2308/P2308/C2316/P2316
LDB
— Load Bit
LDB
(Continued)
Examples:
1. The carry flag is set and the data value at input pin P1.0 is logic zero. The following instruction
clears the carry flag to logic zero.
LDB
2. The P1 address is FF1H and the L register contains the value 9H (1001B). The address
(memb.7–2) is 111100B and (L.3–2) is 10B. The resulting address is 11110010B or FF2H and
P2 is addressed. The bit value (L.1–0) is specified as 01B (bit 1).
LD
LDB
3. The H register contains the value 2H and FLAG = 20H.3. The address for H is 0010B and for
FLAG(3–0) the address is 0000B. The resulting address is 00100000B or 20H. The bit value is
3. Therefore, @H+FLAG = 20H.3.
FLAG EQU 20H.3
LD
LDB
4. The following instruction sequence sets the carry flag and the loads the "1" data value to the
output pin P2.0, setting it to output mode:
SCF
LDB
5. The P1 address is FF1H and L = 9H (1001B). The address (memb.7–2) is 111100B and (L.3–
2) is 10B. The resulting address, 11110010B specifies P2. The bit value (L.1–0) is specified as
01B (bit 1). Therefore, P1.@L = P2.1.
SCF
LD
LDB
6. In this example, H = 2H and FLAG = 20H.3 and the address 20H is specified. Since the bit
value is 3, @H+FLAG = 20H.3:
FLAG EQU 20H.3
RCF
LD
LDB
NOTE: Port pin names used in examples 4 and 5 may vary with different SAM47 devices.
C,P1.0
L,#9H
C,P1.@L
H,#2H
C,@H+FLAG
P2.0,C
L,#9H
P1.@L,C
H,#2H
@H+FLAG,C
; P1.@L specifies P2.1 and C
; C
FLAG (20H.3)
; C
"1"
; P2.0
"1"
; C
"1"
; P1.@L specifies P2.1
; P2.1
"1"
; C
"0"
; FLAG(20H.3)
"0"
SAM47 INSTRUCTION SET
P2.1
5-65

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

P2308C2316P2316Ks57p2308Ks57c2316Ks57p2316

Table of Contents