Download Print this page

Example Routines; Usart1 Switch - STC micro STC8A8K64D4 Series Reference Manual

Advertisement

STC8A8K64D4 Series Manual

3.2 Example Routines

3.2.1 USART1 switch

C language code
// Operating frequency for test is 11.0592MHz
#include "reg51.h"
sfr
P_SW1
sfr
P0M1
sfr
P0M0
sfr
P1M1
sfr
P1M0
sfr
P2M1
sfr
P2M0
sfr
P3M1
sfr
P3M0
sfr
P4M1
sfr
P4M0
sfr
P5M1
sfr
P5M0
void main()
{
P0M0 = 0x00;
P0M1 = 0x00;
P1M0 = 0x00;
P1M1 = 0x00;
P2M0 = 0x00;
P2M1 = 0x00;
P3M0 = 0x00;
P3M1 = 0x00;
P4M0 = 0x00;
P4M1 = 0x00;
P5M0 = 0x00;
P5M1 = 0x00;
P_SW1 = 0x00;
//
P_SW1 = 0x40;
//
P_SW1 = 0x80;
//
P_SW1 = 0xc0;
while (1);
}
Assembly code
; Operating frequency for test is 11.0592MHz
P_SW1
DATA
P0M1
DATA
P0M0
DATA
P1M1
DATA
P1M0
DATA
P2M1
DATA
P2M0
DATA
P3M1
DATA
=
0xa2;
=
0x93;
=
0x94;
=
0x91;
=
0x92;
=
0x95;
=
0x96;
=
0xb1;
=
0xb2;
=
0xb3;
=
0xb4;
=
0xc9;
=
0xca;
0A2H
093H
094H
091H
092H
095H
096H
0B1H
//RXD/P3.0, TXD/P3.1
//RXD_2/P3.6, TXD_2/P3.7
//RXD_3/P1.6, TXD_3/P1.7
//RXD_4/P4.3, TXD_4/P4.4
-
- 19 -

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