⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 interrupt.cpp

📁 dsp2812上的零耗时键盘 c++源代码例子
💻 CPP
字号:
#include "interrupt.h"

extern volatile unsigned int EintRegs;//在CMD文件中

interrupt void ISRTimer0(void)
{
    Keyboard.Exec();
	Lcd.DisplayBuffer();//
	PieCtrlRegs.PIEACK.bit.ACK7 = 1;
//    PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;
}

interrupt void ISRTimer1(void)
{
	Timer.Count1 &= 0x0f;
	if (Timer.Count1 < 0x08)
	{
		LedKeyRegs = 1 << Timer.Count1;
	}
	else
	{
		LedKeyRegs = 1 << (Timer.Count1 ^ 0x0f);
	}
	Timer.Count1++;
}

interrupt void ISRTimer2(void)
{
//以下定义为共阳数码管
static const unsigned char LedTab[] = 
{//显示字符表存放在ROM中
  LedChar0, LedChar1, LedChar2, LedChar3,
  LedChar4, LedChar5, LedChar6, LedChar7,
  LedChar8, LedChar9, LedCharA, LedCharB,
  LedCharC, LedCharD, LedCharE, LedCharF
};
	if ((Timer.Count1 & 0x0f) == 0)
	{
		System.SpiReadWrite(~LedTab[Timer.Count2 & 0x0f]);
		Timer.Count2++;
		SpiRclkRegs = 0;
		SpiRclkRegs = 1;
	}
}

interrupt void ISRExtInt1(void)
{
	PieCtrlRegs.PIEACK.bit.ACK4 = 1;
//CPLD测试,可认为是芯片ID测试	
	Lcd.SetDisplayPos(0, 0);//汉字定位到上行左端
	if ((SpiRclkRegs & 0xff)  == 0x5a)
	{
		Lcd.Display("CPLD可键盘测试");
	}
	else
	{
		Lcd.Display("CPLD无键盘测试");
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -