S3C2440-RTC中斷
void SetAlarm(){
rALMSEC = alarm_buffer[0];
rALMMIN = alarm_buffer[1];
rALMHOUR = alarm_buffer[2];
rALMDATE = alarm_buffer[3];
rALMMON = alarm_buffer[4];
rALMYEAR = alarm_buffer[5];
}
void __irq EINT0_ISR(void){
rSRCPND |= 1; //SRCPND 通過(guò)寫入數(shù)據(jù)清零,如果不清零,會(huì)反復(fù)進(jìn)行請(qǐng)求
rINTPND |= 1; //INDPND 通過(guò)置1清零
flag = 1;
}
void __irq EINT2_ISR(void){ //使用__irq這個(gè)關(guān)鍵字定義終端服務(wù)例程,這樣系統(tǒng)會(huì)自動(dòng)為我們保留一些變量,并能在中斷處理完后正確的返回
rSRCPND |= 1<<2;
rINTPND |= 1<<2;
rTICNT &= "(1<<7);
rGPBDAT = 0xfe; //如果按鍵被按下,關(guān)閉節(jié)拍時(shí)間中斷
}
void __irq Alarm_ISR(void){
rSRCPND |= 1<<30; //SRCPND 通過(guò)寫入數(shù)據(jù)清零,如果不清零,會(huì)反復(fù)進(jìn)行請(qǐng)求
rINTPND |= 1<<30; //INDPND 通過(guò)置1清零
rTICNT = (1<<7)|(127<<0); //開(kāi)啟節(jié)拍時(shí)間中斷,設(shè)置每1s中斷一次
}
void __irq Tick_ISR(void){
rSRCPND |= 1<<8; //SRCPND 通過(guò)寫入數(shù)據(jù)清零,如果不清零,會(huì)反復(fù)進(jìn)行請(qǐng)求
rINTPND |= 1<<8; //INDPND 通過(guò)置1清零
if(count%2 == 0)
rGPBDAT = 0x1;
else
rGPBDAT = 0xfe;
count++;
if(count == 20){
count = 0;
rGPBDAT = 0;
rTICNT &= "(1<<7); //中斷20次,然后停止節(jié)拍時(shí)間中斷
}
}
int Main(){
flag = 0;
count = 0;
t = 0;
rGPFCON &= 0xffcc; //0
rGPFCON |= (1<<1)|(1<<5);
rGPFUP = 0xfe;
rGPBCON &= 0xfffc;
rGPBCON |= 0x1;
rGPBUP = 0xfe;
rULCON0 = 0xfff00;
rULCON0 |= 0x3;
rUCON0 = 0x0800;
rUCON0 |= 0x05;
rUBRDIV0 = 26;
rRTCALM = (1<<1)|(1<<6); //主要全局報(bào)警使能,然后是分鐘報(bào)警使能
rSUBSRCPND |= 0x3;
rSRCPND |= (1<<0)|(1<<2)|(1<<8)|(1<<28)|(1<<30); //先清一下
rINTPND |= (1<<0)|(1<<2)|(1<<8)|(1<<28)|(1<<30); //先清一下
rINTMSK &= ("(0x1<<0))&("(0x1<<2))&("(0x1<<8))&("(0x1<<28))&("(0x1<<30)); //開(kāi)中斷
rINTSUBMSK &= ("(0x1<<0)) & ("(0x1<<1));
pISR_EINT0 = (U32)EINT0_ISR;
pISR_EINT2 = (U32)EINT2_ISR;
pISR_TICK = (U32)Tick_ISR;
pISR_RTC = (U32)Alarm_ISR;
pISR_UART0 = (U32)Uart_ISR;
Init_LCD();
Paint_background(0xffffff,0,0,320,240);
SetAlarm();
SetTime();
ShowTime();
while(1){
if(flag){
Paint_background(0xffffff,0,0,320,240);
ShowTime();
flag = 0;
}
}
}
關(guān)鍵詞:
S3C2440RTC中斷節(jié)拍中
相關(guān)推薦
技術(shù)專區(qū)
- FPGA
- DSP
- MCU
- 示波器
- 步進(jìn)電機(jī)
- Zigbee
- LabVIEW
- Arduino
- RFID
- NFC
- STM32
- Protel
- GPS
- MSP430
- Multisim
- 濾波器
- CAN總線
- 開(kāi)關(guān)電源
- 單片機(jī)
- PCB
- USB
- ARM
- CPLD
- 連接器
- MEMS
- CMOS
- MIPS
- EMC
- EDA
- ROM
- 陀螺儀
- VHDL
- 比較器
- Verilog
- 穩(wěn)壓電源
- RAM
- AVR
- 傳感器
- 可控硅
- IGBT
- 嵌入式開(kāi)發(fā)
- 逆變器
- Quartus
- RS-232
- Cyclone
- 電位器
- 電機(jī)控制
- 藍(lán)牙
- PLC
- PWM
- 汽車電子
- 轉(zhuǎn)換器
- 電源管理
- 信號(hào)放大器
評(píng)論