stc89c52并没有外部中断2、3引脚
只有stc11F以上系类的才有
STC12C5A60S2
这是STC15F104E除了电源跟P3.1脚外的所有引脚都是外部中断输入端。
追问stc89c52 pdip40封装没有中断2和3 其它两种封装有.提问之后在说明文档里面看见的,之前还郁闷说明文档上说有但没看见中断引脚.其它两种封装中断2和3引脚在P4^0,P^1;
追答哦 你说的那种44脚是把
STC下载软件里面就有例程
这就是官方的例程:
/* --- STC89-90xx Series MCU 外部中断2例程 -------------------------*/
#include "reg51.h"
sfr P4 = 0xe8; //for 89C5xRC/RD+ series and 90C5xRc/RD+, location at 0E8H
//sfr P4 = 0xc0; //for 90C5xAD series, location at 0C0H
sbit INT2 = P4^3;
sbit INT3 = P4^2;
sfr XICON = 0xc0; //for 89C5xRC/RD+ series and 90C5xRc/RD+, location at 0C0H
//sfr XICON = 0xe8; //for 90C5xAD series, location at 0E8H
sbit PX3 = XICON^7;
sbit EX3 = XICON^6;
sbit IE3 = XICON^5;
sbit IT3 = XICON^4;
sbit PX2 = XICON^3;
sbit EX2 = XICON^2;
sbit IE2 = XICON^1;
sbit IT2 = XICON^0;
//External interrupt2 service routine
void exint2() interrupt 6 //(location at 0033H)
{
P0++;
}
void main()
{
IT2 = 1; //set INT2 int type (1:Falling only 0:Low level)
EX2 = 1; //enable INT2 interrupt
EA = 1; //open global interrupt switch
while (1);
}
本回答被提问者采纳