1、PCB已经收到
2、正在采购元件中……
淘宝: 订单编号:110046258883874 成交时间:2011-11-27 11:42
3、12月5日收到元件,利用晚上业余时间把贴片元件焊完
做了一个数码电子表
不知道为什么,上传图片,按完“发送到服务器上”没有反应……(JPG,270+KB)
上传附件提示“ 您所请求的页面不存在!”……
贴贴主要代码吧:
static BYTE data s_flags = 0;
static BYTE data s_display = 0;
static BYTE s_ledigit[2][8];
void ledigit(BYTE b, BYTE c)
{
# define LED_DP 0x80
# define LED_SP 10
# define LED_MN 11
# define LED_UL 12
# define LED_CR 13
static const BYTE data LEDMASK[] = {
/* 0: --fedcba */ '\x3F',
/* 1: -----cb- */ '\x06',
/* 2: -g-ed-ba */ '\x5B',
/* 3: -g--dcba */ '\x4F',
/* 4: -gf--cb- */ '\x66',
/* 5: -gf-dc-a */ '\x6D',
/* 6: -gfedc-a */ '\x7D',
/* 7: --f--cba */ '\x27',
/* 8: -gfedcba */ '\x7F',
/* 9: -gf-dcba */ '\x6F',
/* : -------- */ '\x00',
/* -: -g------ */ '\x40',
/* _: ----d--- */ '\x08',
/* r: -g-e---- */ '\x50',
/* _: ----d--- */ '\x08',
/* _: ----d--- */ '\x08',
};
BYTE f = c & LED_DP;
P0 = 0;
P2 &= (~0x7);
P2 |= (b /*& 0x7*/);
P0 = LEDMASK[c & 0xF] | (f ? 0x80 : 0x0);
}
BYTE time_valid()
{
if (s_ledigit[0][0] > 2)
return 1;
if (s_ledigit[0][0] >= 2 && s_ledigit[0][1] >= 4)
return 2;
if (s_ledigit[0][2] > 5)
return 3;
return 0;
}
void do_display()
{
static BYTE tick = 0;
static BYTE count = 0;
BYTE b = count & 0x7;
if ((s_shut <= 0) || (count & 0xC0)) {
switch (s_display) {
default:
case 0: {
bit f = (5 == b || (1 == b && s_ledigit[0][6] >= 5) || (3 == b && s_ledigit[0][6] < 5)) ? 1 : 0;
if ((s_flags & FLAG_ADJ) && ((s_flags & FLAG_ADJ_MSK) == b) && (count & 0x80))
ledigit(b, LED_UL | (f ? LED_DP : 0));
else
ledigit(b, s_ledigit[0][b] | (f ? LED_DP : 0));
} break;
case 1:
ledigit(b, s_ledigit[1][b]);
break;
}
} else {
LEDOFF;
}
count++;
tick++;
if (tick >= (TM1HZ / 100) && !(s_flags & FLAG_ADJ)) {
tick = 0;
if (++s_ledigit[0][7] > 9) { // 0.09s
s_ledigit[0][7] = 0;
if (++s_ledigit[0][6] > 9) { // 0.9s
s_ledigit[0][6] = 0;
s_flags |= FLAG_SEC;
}
}
s_flags |= FLAG_RGC;
}
}
void timer1_isr() interrupt 3 using 1
{
do_display();
}
void main()
{
char lavg = 0;
P1M1 = 0x0;
P1M0 = 0x23; // P1^0,1,5 as output
LED2_NT = 1;
LED8_NT = 0;
LED7_NT = 0; // Relay to on
CLK_DIV = 0x3; // SYSclk = OSR / 8
AUXR = 0x0;
TMOD = 0x20;
TL1 = TH1 = TM1OF;
EA = 0x1;
ET1 = 0x1;
TR1 = 0x1;
if ((s_flags & FLAG_SEC)) {
s_flags &= ~FLAG_SEC;
if (++s_ledigit[0][5] > 9) { // 9s
s_ledigit[0][5] = 0;
if (++s_ledigit[0][4] > 5) { // 50s
s_ledigit[0][4] = 0;
}
if (++s_ledigit[0][3] > 9) { // 9m
s_ledigit[0][3] = 0;
if (++s_ledigit[0][2] > 5) { // 50m
s_ledigit[0][2] = 0;
if (++s_ledigit[0][1] > 9) { // 9h
s_ledigit[0][1] = 0;
++s_ledigit[0][0];
} else if (s_ledigit[0][0] >= 2 && s_ledigit[0][1] >= 4) { // 23h
s_ledigit[0][0] = s_ledigit[0][1] = 0;
} } } } } }
} // END OF while (1)
}