三星2440A板子 用按键控制led反转,但是按键没反应
时间:10-02
整理:3721RD
点击:
#include <S3C2440.H>
void EINT_ISR() __irq
{
if(INTPND &(1<<2))
{
SRCPND &=~(1<<2);
INTPND &=~(1<<2);
GPBDAT ^=(1<<5);
}
if(INTPND &(1<<4))
{
if(EINTPEND &(1<<4))
{
EINTPEND |=(1<<4);
SRCPND &=~(1<<4);
INTPND &=~(1<<4);
GPBDAT ^=(1<<6);
}
if(EINTPEND &(1<<7))
{
EINTPEND |=(1<<4);
SRCPND &=~(1<<7);
INTPND &=~(1<<7);
GPBDAT ^=(1<<7);
}
}
}
int main()
{
//*******************************初始化GPB口,并设置led亮,上拉电阻置1.
GPBCON &=~(1<<11);
GPBCON |=(1<<10);
GPBCON &=~(1<<13);
GPBCON |=(1<<12);
GPBCON &=~(1<<15);
GPBCON |=(1<<14);
GPBDAT |=(1<<5);
GPBDAT &=~(1<<6);
GPBDAT &=~(1<<7);
GPBUP |=(1<<5);
GPBUP |=(1<<6);
GPBUP |=(1<<7);
//******************************初始化GPF2,GPF4,GPF7口为中断功能,关闭上拉电阻
GPFCON |=(1<<5);
GPFCON &=~(1<<4);
GPFCON |=(1<<9);
GPFCON &=~(1<<8);
GPFCON |=(1<<15);
GPFCON &=~(1<<14);
GPBUP |=(1<<2);
GPBUP |=(1<<4);
GPBUP |=(1<<7);
//*****************************初始化中断寄存器ENIT2,ENIT4,ENIT7.
//*****设置EXTINT0 1,2,3位为010,为下降沿触发
EXTINT0 &=~(1<<10);
EXTINT0 |=(1<<9);
EXTINT0 &=~(1<<8);
//*****设置EXTINT0 16,17,18位为010,为下降沿触发
EXTINT0 &=~(1<<18);
EXTINT0 |=(1<<17);
EXTINT0 &=~(1<<16);
//*****设置EXTINT0 28,19,30位为010,为下降沿触发
EXTINT0 &=~(1<<30);
EXTINT0 |=(1<<29);
EXTINT0 &=~(1<<28);
//一级中断屏蔽打开
INTMSK &=~(1<<2); INTMSK &=~(1<<4);
EINTMASK &=~(1<<4); EINTMASK &=~(1<<7);
while(1);
}
求大神解难啊 刚刚入门 ,很多不懂,问题虽浅,莫笑莫笑!
void EINT_ISR() __irq
{
if(INTPND &(1<<2))
{
SRCPND &=~(1<<2);
INTPND &=~(1<<2);
GPBDAT ^=(1<<5);
}
if(INTPND &(1<<4))
{
if(EINTPEND &(1<<4))
{
EINTPEND |=(1<<4);
SRCPND &=~(1<<4);
INTPND &=~(1<<4);
GPBDAT ^=(1<<6);
}
if(EINTPEND &(1<<7))
{
EINTPEND |=(1<<4);
SRCPND &=~(1<<7);
INTPND &=~(1<<7);
GPBDAT ^=(1<<7);
}
}
}
int main()
{
//*******************************初始化GPB口,并设置led亮,上拉电阻置1.
GPBCON &=~(1<<11);
GPBCON |=(1<<10);
GPBCON &=~(1<<13);
GPBCON |=(1<<12);
GPBCON &=~(1<<15);
GPBCON |=(1<<14);
GPBDAT |=(1<<5);
GPBDAT &=~(1<<6);
GPBDAT &=~(1<<7);
GPBUP |=(1<<5);
GPBUP |=(1<<6);
GPBUP |=(1<<7);
//******************************初始化GPF2,GPF4,GPF7口为中断功能,关闭上拉电阻
GPFCON |=(1<<5);
GPFCON &=~(1<<4);
GPFCON |=(1<<9);
GPFCON &=~(1<<8);
GPFCON |=(1<<15);
GPFCON &=~(1<<14);
GPBUP |=(1<<2);
GPBUP |=(1<<4);
GPBUP |=(1<<7);
//*****************************初始化中断寄存器ENIT2,ENIT4,ENIT7.
//*****设置EXTINT0 1,2,3位为010,为下降沿触发
EXTINT0 &=~(1<<10);
EXTINT0 |=(1<<9);
EXTINT0 &=~(1<<8);
//*****设置EXTINT0 16,17,18位为010,为下降沿触发
EXTINT0 &=~(1<<18);
EXTINT0 |=(1<<17);
EXTINT0 &=~(1<<16);
//*****设置EXTINT0 28,19,30位为010,为下降沿触发
EXTINT0 &=~(1<<30);
EXTINT0 |=(1<<29);
EXTINT0 &=~(1<<28);
//一级中断屏蔽打开
INTMSK &=~(1<<2); INTMSK &=~(1<<4);
EINTMASK &=~(1<<4); EINTMASK &=~(1<<7);
while(1);
}
求大神解难啊 刚刚入门 ,很多不懂,问题虽浅,莫笑莫笑!