EasyManua.ls Logo

STC micro STC8A8K64D4 Series - Page 858

Default Icon
901 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...
STC8A8K64D4 Series Manual
- 842 -
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 = 0xc7;
sfr INTCLKO = 0x8f;
sfr P3M0 = 0xb2;
sfr P3M1 = 0xb1;
void Int4Isr() interrupt 16 //INT4 interrupt service routine
{
IAP_CONTR = 0x60; // UART start signal triggers INT4 interrupt
// Software reset to system area
}
void main()
{
P3M0 = 0x00;
P3M1 = 0x00;
INTCLKO |= 0x40; // Enable INT4 interrupt
EA = 1;
while (1)
{
... //User codes
}
}
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 = 0xc7;
sfr AUXR = 0x8e;
sfr P3M0 = 0xb2;

Table of Contents

Related product manuals