LM3S9B96 中断映射表的配置
muxing for UART0 functions on port A0 and A1.
// This step is not necessary if your part does not support pin muxing.
GPIOPinConfigure(GPIO_PD0_U2RX);
GPIOPinConfigure(GPIO_PD1_U2TX);
// Initialize the UART for console I/O.
UARTStdioInit(2);
UARTprintf("Uart2 is ready ->\n");
}
//*****************************************************************************
//
// 主函数
//
//*****************************************************************************
int main(void)
{
// Set the clocking to run directly from the crystal.
SysCtlClockSet(SYSCTL_SYSdiv_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ);
LED_Init(); // 初始化LED,输出
InitConsole(); // UART2初始化
GPIO_PJ7_Init(); // 初始化PJ7管脚,输入
IntMasterEnable(); // 开总中断
GPIOPinWrite(LED_PORT, LED_PIN, LED_OFF);
Delay(0xFFFFF);
GPIOPinWrite(LED_PORT, LED_PIN, LED_ON);
Delay(0xFFFFF);
GPIOPinWrite(LED_PORT, LED_PIN, LED_OFF);
Delay(0xFFFFF);
GPIOPinWrite(LED_PORT, LED_PIN, LED_ON);
Delay(0xFFFFF);
GPIOPinWrite(LED_PORT, LED_PIN, LED_OFF);
Delay(0xFFFFF);
GPIOPinWrite(LED_PORT, LED_PIN, LED_ON);
Delay(0xFFFFF);
while (1)
{
Delay(0xFFFFF); // 646ms
}
}
//*****************************************************************************
//
// PJ7管脚的中断服务函数,双沿触发
//
//*****************************************************************************
void GPIO_Port_J_ISR(void)
{
// 读取中断状态,GPIOJ端口的8个管脚都可能触发中断
DWORD Status = GPIOPinIntStatus(GPIO_PORTJ_BASE, true);
// 清除中断状态,重要
GPIOPinIntClear(GPIO_PORTJ_BASE, Status);
if ((Status & GPIO_PIN_7) != 0)
{
// 上升沿中断处理函数
if (0x00000080 == GPIOPinRead(GPIO_PORTJ_BASE, GPIO_PIN_7))
{
UARTprintf("PJ7 is low to high ->\n");
Delay(0xFFFFF);
}
else if (0 == GPIOPinRead(GPIO_PORTJ_BASE, GPIO_PIN_7)) // 下降沿中断处理函数
{
UARTprintf("PJ7 is high to low ->\n");
Delay(0xFFFFF);
}
}
}
LM3S9B96中断映射表配 相关文章:
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)