EasyManua.ls Logo

Cmsemicon SC8F577 Series - Page 58

Default Icon
181 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
V1.8
SC8F577x
58 / 181
www.mcu.com.cn
6.5 I/O Usage
6.5.1 Write I/O Port
The chip's I/O port register, like the general universal register, can be written through data transmission
instructions, bit manipulation instructions, etc.
Example: write I/O port program
LD
PORTA, A
;pass value of ACC to PORTA
CLRB
PORTB, 1
;clear PORTB.1
SET
PORTA
;set all output port of PORTA as 1
SETB
PORTB, 1
;set PORTB.1as 1
6.5.2 Read I/O Port
Example: write I/O port program
LD
A, PORTA
;pass value of PORTA to ACC
SNZB
PORTA, 1
; check whether PORTA, port 1 is 1, if it is 1, skip the next
statement
SZB
PORTA, 1
; check if PORTA, 1 port is 0, if 0, skip the next statement
Note: When the user reads the status of an I/O port, if the I/O port is an input port, the data read back
by the user will be the state of the external level of the port line. If the I/O port is an output port
then the read value will be the data of the internal output register of this port.

Related product manuals