/****************PMS150G,PA.0中断******************/
/****************ID:共同学习stm8*******************/
/**************************************************/
/****************20240420**************************/
#include "extern.h"
bit led :pa.3;
/**************************************************/
void FPPA0 (void)
{
.ADJUST_IC SYSCLK=IHRC/4 // SYSCLK=IHRC/4
$ inten pa.0; //开pa.0中断
intrq =0; //清intrq
engint; //启用全局中断
//disgint; //停用全局中断
$ led out,low;
$ pa.0 in,ph;
//$ integs pa0_f;
integs=0b0000_0010;
while (1)
{
$ led out,high;
}
}
/**************************************************/
void Interrupt (void)
{
pushaf; //入栈
if(Intrq.pa0) //边沿进中断
{
if(pa==0)
{
$ led out,low;
.delay 1000000;
}
Intrq.pa0 =0;
}
popaf; //出栈
}
/**************************************************/
/**************************************************/
|