?? 定時器成功.txt
字號:
#include <stdio.h>
#include "system.h"
#include "altera_avalon_pio_regs.h"
#include "altera_avalon_timer_regs.h"
#include "alt_types.h"
static void handle_Timer0_interrupts(void* context, alt_u32 id)
{
FILE*fp;
fp=fopen("/dev/lcd_display","r+");
if(fp)
fprintf(fp,"%s","timer out!\n");
fclose(fp);
IOWR_ALTERA_AVALON_TIMER_STATUS(SYS_CLK_TIMER_BASE, 0);
}
void init_timer()
{
IOWR_ALTERA_AVALON_TIMER_CONTROL (SYS_CLK_TIMER_BASE,
ALTERA_AVALON_TIMER_CONTROL_ITO_MSK |
ALTERA_AVALON_TIMER_CONTROL_CONT_MSK |
ALTERA_AVALON_TIMER_CONTROL_START_MSK);
alt_irq_register( SYS_CLK_TIMER_IRQ,NULL, handle_Timer0_interrupts);
}
void start()
{
FILE*fp;
fp=fopen("/dev/lcd_display","r+");
if(fp)
fprintf(fp,"%s","timer start!\n");
fclose(fp);
}
int main (void)
{
init_timer();
start();
fprintf(fp;"%s","timer start\n");
for(;;);
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -