从某8051的手册上摘的:
1. Clear interrupt flags
2. Set individual interrupt enable bit in the peripherals SFR, if any
3. Set the corresponding individual,interrupt enable bit in the IEN0, IEN1,
or IEN2 registers to 1
4. Enable global interrupt by setting the IEN0.EA = 1
5. Begin the interrupt service routine at the corresponding vector address of that interrupt.
翻译为:
1、清中断标志位
2、有必要的话,在SFR寄存器中设置独立的中断使能位
3、在1中对应寄存器的IEN0, IEN1,or IEN2 中单独设置中断使能位
4、开全局中断IEN0.EA = 1
5、在中断响应向量地址中开始中断服务
其中4,是每次中断都要的吗?如果开了的话,是不是就不用再开了? |