📄 int0aa.c
字号:
/***********************************************************************/
/* */
/* FILE :int0aa.c */
/* DATE :Sun, Jul 27, 2008 */
/* DESCRIPTION :main program file. */
/* CPU GROUP :62P */
/* */
/* This file is generated by Renesas Project Generator (Ver.4.8). */
/* */
/***********************************************************************/
#include "sfr62p.h"
#define CNTR_IPL 0x03 // TA0 interrupt priority level
void init_int0(void)
{
#define TIME_CONFIG 0x40
/*--- INT0 initialization ---*/
// int0ic = 0x01; /* INT0 interrupt control register */
/* xx000001 */
/* |||+++---- interrupt priority level */
/* ||+------- interrupt request bit */
/* |+-------- polarity select bit */
/* | (select falling edge)*/
/* +--------- reserved bit */
ifsr=0x01; //choice int0
_asm("fclr i");
ilvl0_int0ic=0;
ilvl1_int0ic=1;
ilvl2_int0ic=1;
ir_int0ic=0; //enable interrupt int2
pol_int0ic=0; //high-->low
/*ifsr=0x04; //choice int0
_asm("fclr i");
ilvl0_int2ic=0;
ilvl1_int2ic=1;
ilvl2_int2ic=1;
ir_int2ic=0; //enable interrupt int2
pol_int2ic=0; //high-->low
*/
_asm("fset i");
/*ta0 = 10000;
_asm (" fclr i") ; // turn off interrupts before modifying IPL
ta0ic |= CNTR_IPL; // Interrupt Control register for Timer A0
// use read-modify-write instruction to clear IPL
// (disable Timer A0 interrupts)
ta0mr = TIME_CONFIG; // Timer A0 mode register set to pulse output mode
_asm (" fset i");
ta0s = 1; // Count Start Flag register bit0, for Timer A0
/
*/
}
void main(void)
{
/* Port initialization */
//p2 = 0xfe; /* only turn on LED1 */
pd2=0xff; /* set Port P7 to output */
p2=0x55;
pd8=0x00; /* set Port P8 bit2(sw9) to input */
//_asm (" fclr i") ;
init_int0(); /* INT0 initialization */
//_asm (" fset i");
/* dead loop (all the processing is done in interrupt program) */
while(1){
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -