📄 xint.c
字号:
#include <csl.h>
#include <csl_gpio.h>
#include <stdio.h>
#include "ICETEK-C6713-A.h"
int fKey=0;
static GPIO_Handle hGpio;
main()
{
/* Initialize CSL,must when using CSL. */
CSL_init();
/* Set GPIO. */
hGpio = GPIO_open(GPIO_DEV0,GPIO_OPEN_RESET);
GPIO_reset(hGpio);
GPIO_pinEnable(hGpio,GPIO_PIN13);
GPIO_pinDirection(hGpio,GPIO_PIN13,GPIO_OUTPUT);
InitInterrupt();
while ( 1 )
{
if(1==fKey)
{
GPIO_pinWrite(hGpio,GPIO_PIN13,0);
}
else
{
GPIO_pinWrite(hGpio,GPIO_PIN13,1);
}
Delay(16);
}
}
void InitInterrupt(void)
{
// 设置中断控制寄存器
CSR&=0xfffffffe; // 关中断 GIE=0
ISTP=0x00000c00; // 重置中断向量表到0C00h
IMH=0x0; // 指定xint5中断
IML=0x0a0;
ICR=0xff; // 清除等待的中断
IER=0x23; // 使能xint5中断
CSR=CSR|1; // 开中断
}
void interrupt XINT5() //中断响应函数
{
fKey ^= 1;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -