新聞中心

EEPW首頁(yè) > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > 單片機(jī)計(jì)算器設(shè)計(jì)

單片機(jī)計(jì)算器設(shè)計(jì)

作者: 時(shí)間:2013-04-02 來(lái)源:網(wǎng)絡(luò) 收藏

1.實(shí)驗(yàn)任務(wù)

(1.開(kāi)機(jī)時(shí),顯示“0”

(2.第一次按下時(shí),顯示“D1”;第二次按下時(shí),顯示“D1D2”;第三按下時(shí),顯示“D1D2D3”,8個(gè)全顯示完畢,再按下按鍵下時(shí),給出“嘀”提示音。

2.電路原理圖

點(diǎn)擊瀏覽下一頁(yè)

圖4.23.1

3.系統(tǒng)板上硬件連線

(1.把“系統(tǒng)”區(qū)域中的P1.0端口用導(dǎo)線連接到“音頻放大模塊”區(qū)域中的SPK IN端口上;

(2.把“系統(tǒng)“區(qū)域中的P3.0-P3.7端口用8芯排線連接到“4X4行列式鍵盤(pán)”區(qū)域中的C1-C4 R1-R4端口上;

(3.把“系統(tǒng)”區(qū)域中的P0.0-P0.7端口用8芯排線連接到“動(dòng)態(tài)數(shù)碼顯示”區(qū)域中的A-H端口上;

(4.把“單片機(jī)系統(tǒng):區(qū)域中的P2.0-P2.7端口用8芯排線連接到“動(dòng)態(tài)數(shù)碼顯示”區(qū)域中的S1-S8端口上;

4.相關(guān)程序設(shè)計(jì)內(nèi)容

(1.行列式鍵盤(pán)輸入及按鍵功能設(shè)定;

(2.動(dòng)態(tài)數(shù)碼顯示;

(3.?dāng)?shù)碼顯示方式處理;

5.匯編源程序

(略)

6. C語(yǔ)言源程序

#include AT89X51.H>

unsigned char code dispcode[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,

0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71,0x00};

unsigned char code dispbitcode[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};

unsigned char dispbuf[8]={0,16,16,16,16,16,16,16};

unsigned char dispbitcount;

unsigned char temp;

unsigned char i,j;

unsigned char key;

unsigned char keypos;

bit alarmflag;

void change(unsigned char *p,unsigned char count)

{

while(count>0)

{

*(p+count)=*(p+count-1);

count--;

}

}

c語(yǔ)言相關(guān)文章:c語(yǔ)言教程


單片機(jī)相關(guān)文章:單片機(jī)教程


單片機(jī)相關(guān)文章:單片機(jī)視頻教程


單片機(jī)相關(guān)文章:單片機(jī)工作原理


塵埃粒子計(jì)數(shù)器相關(guān)文章:塵埃粒子計(jì)數(shù)器原理

上一頁(yè) 1 2 3 下一頁(yè)

評(píng)論


相關(guān)推薦

技術(shù)專(zhuān)區(qū)

關(guān)閉