#include <SPCE061v004.h>
#include <unspmacro.h>
//中断函数定义
void IRQ1(void) __attribute__((ISR));
void IRQ5(void) __attribute__((ISR));
void IRQ6(void) __attribute__((ISR));
enum { RUN, CHGSECOND, CHGMINUTE, CHGHOUR } clock_status; //时钟的状态
unsigned int hour,minute,second;
unsigned int show_hour, show_minute, show_second;
enum { NOKEY, PRESSING, PRESSED } key_status; //键盘按下与否的状态
unsigned key_code;
// 7段LED数码管的字形码,采用高八位输出,决定显示的字形,如: '0'、'1'等
const unsigned int zhixingma[] = { 0x 3f 00, 0x0600, 0x5b00, 0x 4f 00,
0x6600, 0x6d00, 0x 7c 00, 0x0700,
0x 7f 00,0x 6f 00 };
// 数码管选择的"位段码",决定哪一位数码管显示
const unsigned int weiduanma[] = {0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040};
//数码管的两个DD引脚, 为时,中间的冒号亮
const unsigned int wei_DD = 0x0081;
void display(unsigned int wei, unsigned int number)
{
*P_IOA_Data = zhixingma[number];
//设置位段码时,不能改变冒号的状态
*P_IOB_Data = weiduanma[wei] | (*P_IOB_Buffer & wei_DD);
}
//取反数码管中间的冒号
void opposite_dots()
{