Electronics America 4-Bit Single-Chip Microcomputer User's Manual
48
CHAPTER 5. PERIPHERAL HARDWARE FUNCTIONS
(1) Bit handling instructions
Direct addressing of specific address bits (fmem.bit) can be used on all digital input/output ports.
Example To OR P50 and P31 and output the result to P61.
SET1 CY ; CY ← 1
AND1 CY, PORT5.0 ; CY ← CY
∧ P50
OR1 CY, PORT3.1 ; CY ← CY
∨ P31
SKT CY
BR CLRP
SET1 PORT6.1 ; P61 ← 1
CLRP : CLR1 PORT6.1 ; P61 ← 0
(2) 4-bit handling instructions
All 4-bit memory handling instructions can be used, such as MOV, XCH, ADDS and INCS, in addition to the IN/
OUT instructions.
Example 1. To output accumulator contents to port 3.
OUT PORT3, A
2. To add the accumulator value to the data output to port 5, and output the result.
MOV HL, #PORT5
ADDS A, @HL ; A ← A + PORT5
NOP
MOV @HL, A ; PORT5 ← A
Table 5-2 List of Input/Output Pin Handling Instructions
………
PORT 0 PORT 1 PORT2 PORT 3 PORT5 PORT 6
IN A, PORTn ●●
OUT PORTn, A – – ●●
SET1 PORTn.bit – – ●●
CLR1 PORTn.bit – – ●●
SKT PORTn.bit ●●
SKF PORTn.bit ●●
AND1 CY, PORTn.bit ●●
OR1 CY, PORTn.bit ●●
XOR1 CY, PORTn.bit ●●