Download Print this page

Reading And Writing Operation Of Bidirection Port - STC micro STC8A8K64D4 Series Reference Manual

Advertisement

STC8A8K64D4 Series Manual
P7M1
DATA
ORG
LJMP
ORG
MAIN:
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
JMP
END

9.4.2 Reading and Writing Operation of Bidirection Port

C language code
//Operating frequency for test is 11.0592MHz
#include "reg51.h"
#include "intrins.h"
sfr
P0M0
sfr
P0M1
sfr
P0M1
sfr
P0M0
sfr
P1M1
sfr
P1M0
sfr
P2M1
sfr
P2M0
sfr
P3M1
sfr
P3M0
sfr
P4M1
sfr
P4M0
sfr
P5M1
sfr
P5M0
sbit
P00
void main()
{
P0M0 = 0x00;
P0M1 = 0x00;
P1M0 = 0x00;
P1M1 = 0x00;
P2M0 = 0x00;
P2M1 = 0x00;
P3M0 = 0x00;
P3M1 = 0x00;
P4M0 = 0x00;
P4M1 = 0x00;
P5M0 = 0x00;
0E1H
0000H
MAIN
0100H
SP, #5FH
P0M0,#00H
P0M1,#00H
P1M0,#0FFH
P1M1,#00H
P2M0,#00H
P2M1,#0FFH
P3M0,#0FFH
P3M1,#0FFH
$
=
0x94;
=
0x93;
=
0x93;
=
0x94;
=
0x91;
=
0x92;
=
0x95;
=
0x96;
=
0xb1;
=
0xb2;
=
0xb3;
=
0xb4;
=
0xc9;
=
0xca;
=
P0^0;
;Set P0.0 ~ P0.7 as bidirectional port mode
;Set P1.0 ~ P1.7 as push-pull output mode
;Set P2.0 ~ P2.7 as high impedance input mode
;Set P3.0 ~ P3.7 as open-drain mode
-
- 173 -

Advertisement

loading
Need help?

Need help?

Do you have a question about the micro STC8A8K64D4 Series and is the answer not in the manual?

This manual is also suitable for:

Micro stc8a8k64d4-64pinMicro stc8a8k64d4-48pin