51_LanQiaoBei/题目/真题/10 第十届国赛_左岚/第十届国赛/Driver/Seg.c

20 lines
512 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 L n P
code char seg_dula[] = {0xc0, 0xf9, 0xa4, 0xb0, 0x99, 0x92, 0x82, 0xf8,
0x80, 0x90, 0xff, 0xc6, 0xc7, 0xab, 0x8c};
void Seg_Disp(unsigned char wela, unsigned char dula, unsigned char point) {
// <20>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>
P0 = 0xff;
P2 = P2 & 0x1f | 0xe0;
// ѡ<><D1A1><EFBFBD><EFBFBD>ʾλ<CABE><CEBB>
P0 = 0x01 << wela;
P2 = P2 & 0x1f | 0xc0;
P2 &= 0x1f;
// ѡ<><D1A1><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
P0 = seg_dula[dula];
if (point) P0 &= 0x7f;
P2 = P2 & 0x1f | 0xe0;
P2 &= 0x1f;
}