打印
[FPGA]

sopc时钟注册中断函数怎么有个警告:函数隐含定义

[复制链接]
801|0
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主

代码如下:
#include <stdio.h>
#include <sys/unistd.h>
#include <io.h>
#include <string.h>
#include "system.h"
#include "altera_avalon_timer_regs.h"
#include "altera_avalon_pio_regs.h"
#include "alt_types.h"
#include "sys/alt_irq.h"
#include <unistd.h>

unsigned char aa[16]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e};
unsigned char second=0;
unsigned char minute=0;
unsigned char hours=21;
unsigned int flag=0;

static void time_interrupts(void)
{
        IOWR_ALTERA_AVALON_TIMER_STATUS(TIMER_BASE,0);
//        if(flag<1000)
//                flag++;
//        else
        {
                flag=0;
                second++;
                if(second==60)
                {
                        second=0;
                        minute++;
                }
                if(minute==60)
                {
                        minute=0;
                        hours++;
                }
                if(hours==24)
                {
                        hours=0;
                }
        }
}

int main()
{
        alt_irq_register(TIMER_IRQ,TIMER_BASE,time_interrupts);
        IOWR_ALTERA_AVALON_TIMER_CONTROL(TIMER_BASE,5);
        while(1)
        {
                IOWR_ALTERA_AVALON_PIO_DATA(PIO_HEX2_BASE,aa[second%10]);
                IOWR_ALTERA_AVALON_PIO_DATA(PIO_HEX3_BASE,aa[second/10%10]);

                IOWR_ALTERA_AVALON_PIO_DATA(PIO_HEX4_BASE,aa[minute%10]);
                IOWR_ALTERA_AVALON_PIO_DATA(PIO_HEX5_BASE,aa[minute/10%10]);

                IOWR_ALTERA_AVALON_PIO_DATA(PIO_HEX6_BASE,aa[hours%10]);
                IOWR_ALTERA_AVALON_PIO_DATA(PIO_HEX7_BASE,aa[hours/10%10]);
        }
}

本来是想用数码管搞个时钟,可是下载进去始终不走,什么问题啊?

相关帖子

发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

28

主题

150

帖子

0

粉丝