51_LanQiaoBei/题目/真题/12 第十二届省赛_左岚/第一套/第十二届省赛1/Driver/Seg.c

22 lines
608 B
C
Raw Normal View History

2025-04-13 01:02:19 +08:00
#include <Seg.h>
// <20><>ѡ 0 1 2 3 4 5 6 7 8 9 <20><> C P A
unsigned char seg_dula[] = {0xc0, 0xf9, 0xa4, 0xb0, 0x99, 0x92, 0x82, 0xf8, 0x80, 0x90, 0xff,
0xc6, 0x8c, 0x88};
// λѡ 2^0,2^1,2^2,2^3,2^4,2^5<><35>2^6,2^7<><37>һ<EFBFBD><D2BB><EFBFBD>˸<EFBFBD><CBB8><EFBFBD><EFBFBD><EFBFBD>
unsigned char seg_wela[] = {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80};
void Seg_Disp(unsigned char wela, dula, point)
{
// <20>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>
P0 = 0xff;
P2 = P2 & 0x1f | 0xe0;
P0 = seg_wela[wela];
P2 = P2 & 0x1f | 0xc0;
P2 &= 0x1f;
P0 = seg_dula[dula];
if (point)
P0 &= 0x7f;
P2 = P2 & 0x1f | 0xe0;
P2 &= 0x1f;
}