STC8A8K64D4 Series Manual
Use the falling edge interrupt of P3.0/INT4 to detect the serial port start signal
Method B is similar to method A, except that method A uses query mode, and method B uses interrupt mode.
Because the P3.0 port of the STC single-chip computer is the interrupt port of INT4.
C Language Code
// Operating frequency for test is 11.0592MHz
#include "reg51.h"
#include "intrins.h"
sfr
IAP_CONTR
=
sfr
INTCLKO
=
sfr
P3M0
=
sfr
P3M1
=
void Int4Isr() interrupt 16
{
IAP_CONTR = 0x60;
}
void main()
{
P3M0 = 0x00;
P3M1 = 0x00;
INTCLKO |= 0x40;
EA = 1;
while (1)
{
...
}
}
Use P3.0/RxD to receive and detect the 7F sent by the ISP download software
Method A and Method B are very simple, but easy to be interfered. If there is any interference signal on P3.0 port,
it will trigger the software Reset, so method C is to verify the serial port data.
When STC's ISP download software performs ISP download, it will first use the lowest baud rate (usually 2400)
+ even parity 9+1 stop bit to continuously send the handshake command 7F, so the user can set the serial port to 9 in
the program Bit data bit + 2400 baud rate, and then continue to detect 7F. For example, if 8 7Fs are continuously
detected, it means that ISP download is required, and then a software reset is triggered.
C Language Code
// Operating frequency for test is 11.0592MHz
#include "reg51.h"
#include "intrins.h"
#define
FOSC
11059200UL
#define
BR2400
(65536 - FOSC / 4 / 2400)
sfr
IAP_CONTR
=
sfr
AUXR
=
sfr
P3M0
=
0xc7;
0x8f;
0xb2;
0xb1;
0xc7;
0x8e;
0xb2;
//INT4 interrupt service routine
// UART start signal triggers INT4 interrupt
// Software reset to system area
// Enable INT4 interrupt
//User codes
- 842 -
Need help?
Do you have a question about the micro STC8A8K64D4 Series and is the answer not in the manual?
Questions and answers