#include <m8c.h> // part specific constants and macros
#include "PSoCAPI.h" // PSoC API definitions for all User Modules
void main(void)
{
// M8C_EnableGInt ; // Uncomment this line to enable Global Interrupts
// Insert your main routine code here.
M8C_EnableGInt; // Eable the globle interrupt
PRT2DM0 |=0x80;
PRT2DM1 &=~0x80;
PRT2DM2 &=~0x80;
PRT2DR &= ~0x80;
DigInv_1_EnableInt();
DigInv_1_Start();
while(1); // Loop forever
}
#pragma interrupt_handler DigInv_1_ISR
void DigInv_1_ISR()
{
DigInv_1_Stop();
PRT2DR |= 0x80;
Timer16_1_WritePeriod(365);
Timer16_1_EnableInt();
Timer16_1_Start();
}
#pragma interrupt_handler Timer16_1_ISR
void Timer16_1_ISR()
{
BYTE Mask = 0;
Mask = PRT2DR & 0x80;
if (Mask!=0)
{
PRT2DR &= ~0x80;
}
else
{
Timer16_1_Stop();
DigInv_1_Start();
}
}
P2_7连接一个LED灯,Timer16为500ms计时 |