標(biāo)題:
籃球計(jì)分牌Proteus仿真 單片機(jī)源程序
[打印本頁(yè)]
作者:
2362964811
時(shí)間:
2020-7-18 17:56
標(biāo)題:
籃球計(jì)分牌Proteus仿真 單片機(jī)源程序
籃球計(jì)分牌的程序和仿真
51hei.png
(14.12 KB, 下載次數(shù): 60)
下載附件
2020-7-21 01:51 上傳
單片機(jī)源程序如下:
#include "reg51.h"
sbit SEG1 = P1^7;
sbit SEG2 = P1^6;
sbit SEG3 = P1^5;
sbit SEG4 = P1^4;
sbit MARK1 = P3^0;
sbit MARK2 = P3^1;
sbit MARK3 = P3^2;
unsigned char MARK;
char code table[] = {0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71}; //段碼
void delay(unsigned int t)
{
while(t--);
}
void DigDisplay(void)
{
unsigned char i;
for(i = 0;i < 4;i++)
{
switch(i) //位選,選擇點(diǎn)亮的數(shù)碼管,
{
case(0):
SEG4 = 0;SEG3 = 1;SEG2 = 1;SEG1 = 1;P2 = table[MARK % 10];break;
case(1):
SEG4 = 1;SEG3 = 0;SEG2 = 1;SEG1 = 1;P2 = table[MARK % 100 / 10];break;
case(2):
SEG4 = 1;SEG3 = 1;SEG2 = 0;SEG1 = 1;P2 = table[MARK % 1000 / 100];break;
case(3):
SEG4 = 1;SEG3 = 1;SEG2 = 1;SEG1 = 1;P2 = table[MARK % 1000 / 1000];break;
}
delay(100); //間隔一段時(shí)間掃描
P2 = 0x00;//消隱
}
}
void Points(void)
{
if(MARK1 == 0)
{
delay(500);
if(MARK1 == 0)
{
MARK = MARK + 1;
}
while(!MARK1);
}
if(MARK2 == 0)
{
delay(500);
if(MARK2 == 0)
{
MARK = MARK + 2;
}
while(!MARK2);
}
if(MARK3 == 0)
{
delay(500);
if(MARK3 == 0)
{
MARK = MARK + 3;
}
while(!MARK3);
}
}
void main(void)
{
while(1)
{
Points();
DigDisplay();
}
}
復(fù)制代碼
所有資料51hei提供下載:
計(jì)分牌.zip
(78.96 KB, 下載次數(shù): 27)
2020-7-18 17:55 上傳
點(diǎn)擊文件名下載附件
下載積分: 黑幣 -5
作者:
faridzled
時(shí)間:
2020-7-26 02:13
Thanks for sharing
作者:
qsfan1
時(shí)間:
2024-10-9 09:28
Proteus8.13版本的仿真
作者:
declansang
時(shí)間:
2025-4-28 16:40
可以跑起來(lái)
歡迎光臨 (http://www.torrancerestoration.com/bbs/)
Powered by Discuz! X3.1