Download Print this page

STC micro STC8A8K64D4 Series Reference Manual page 863

Advertisement

STC8A8K64D4 Series Manual
Appendix M Example Routine of ISP download for
STC8A8K64D4 series MCUs using third-party MCU
C language code
/*Note: When using this code to download the STC8A8K64D4 series of microcontrollers, you must execute the Download code before
powering on the target chip, otherwise the target chip will not download correctly.*/
#include "reg51.h"
typedef
bit
typedef
unsigned char
typedef
unsigned short
//Macro and constant definition
#define
FALSE
#define
TRUE
#define
LOBYTE(w)
#define
HIBYTE(w)
#define
MINBAUD
#define
MAXBAUD
#define
FOSC
#define
BR(n)
#define
T1MS
#define
FUSER
#define
RL(n)
sfr
AUXR = 0x8e;
sfr
P3M1 = 0xB1;
sfr
P3M0 = 0xB2;
// Variable definitions
BOOL f1ms;
BOOL UartBusy;
BOOL UartReceived;
BYTE UartRecvStep;
BYTE TimeOut;
BYTE xdata TxBuffer[256];
BYTE xdata RxBuffer[256];
char code DEMO[256];
// Functions declarations
BOOL;
BYTE;
WORD;
0
1
((BYTE)(WORD)(w))
((BYTE)((WORD)(w) >> 8))
2400L
115200L
11059200L
(65536 - FOSC/4/(n))
(65536 - FOSC/1000)
24000000L
(65536 - FUSER/4/(n))
//1ms flag
// Serial transmit busy flag
// Serial data receiving completion flag
// Serial data receiving control
// Serial communication timeout counter
// Serial data transmission buffer
// Serial data receiving buffer
// Demo code data
//Main chip working frequency
// Calculation formula of serial port baud rate of main chip
// 1ms timing initial value of main chip
//STC8 Series target chip operating frequency
//STC8 Serial target chip baud rate calculation formula
- 847 -

Advertisement

loading
Need help?

Need help?

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

Subscribe to Our Youtube Channel

This manual is also suitable for:

Micro stc8a8k64d4-64pinMicro stc8a8k64d4-48pin