www.久久久久|狼友网站av天堂|精品国产无码a片|一级av色欲av|91在线播放视频|亚洲无码主播在线|国产精品草久在线|明星AV网站在线|污污内射久久一区|婷婷综合视频网站

當(dāng)前位置:首頁(yè) > 單片機(jī) > 單片機(jī)
[導(dǎo)讀] 合泰HOLTEK單片機(jī)寫的,對(duì)初學(xué)者來說里面的分析思路很有幫助。#includeht48c10-1.inc;-------------------------------------------------------data.section’data’;==datasection==tempdb?;temporar

合泰HOLTEK單片機(jī)寫的,對(duì)初學(xué)者來說里面的分析思路很有幫助。
#includeht48c10-1.inc
;-------------------------------------------------------
data.section’data’;==datasection==


tempdb?;temporarydataregister
dispdb?;keydisplayregister
count1db?;delayloopcounter
maskdb?;maskregister
matrixdb?;keymatrixregister
;-------------------------------------------------------
code.sectionat0’code’;==programsection==
org00h;
jmpstart;
org04h;externalinterruptsubroutine
reti;forguarantee
org08h;timer/event0interruptsubroutine
reti;forguarantee
org0ch;timer/event1interruptsubroutine
reti;forguarantee

start:;
clriNTC;initializeregisters
clrtmrc;toguaranteeperformance
clrtmr;(interrupts)
setPAC;(ports)
setpbc;(inputmode)
setpCC;
main:
setpac;(1);setportAtoinputmode
clrpbc;setportBtooutputmode
clrpa;zeroportA(latch=0)
setpb;offLEDs
keyloop:;
MOV a,0feh;(2);sCANfirstrowofkeys
MOV matrix,a;holdscancode
MOV pac,a;pa.0output0(latch)
MOV a,pa;readinputstate
cplacc;;distillinputstate
anda,0f0h;;
szacc;ifanyinput?
jmpget_key;yes.getinputinfo
MOV a,0fdh;(2);no.scansecondrow
MOV matrix,a;holdscancode
MOV pac,a;pa.1output0(latch)
MOV a,pa;readinputstate
cplacc;;distillinputstate
anda,0f0h;;
szacc;ifanyinput?
jmpget_key;yes.getinputinfo
MOV a,0fbh;(2);no.scanthirdrow
MOV matrix,a;holdscancode
MOV pac,a;pa.2output0(latch)
MOV a,pa;readinputstate
cplacc;;distillinputstate
anda,0f0h;;
szacc;ifanyinput?
jmpget_key;yes.getinputinfo
MOV a,0f7h;(2);no.scanfourthrow
MOV matrix,a;holdscancode
MOV pac,a;outputpa.30(latch)
MOV a,pa;readinputstate
cplacc;;distillinputstate
anda,0f0h;;
szacc;ifanyinput?
jmpget_key;yes.getinputinfo
jmpkeyloop;repeatfromkeyloop
get_key:;getinputkeyinfo
calldelays;debounce
MOV a,pa;testportA
ora,0fh;
cplacc;
szacc;anykeyhold?
jmpgo_on;yes.goon(somekeyispressed)
jmpkeyloop;no.returntoscankeyagain
go_on:
callkey_in;(3);calculatetableindex
tabrdldisp;(10);loaddisplaydata
MOV a,disp;;outputdatatoportB
MOV pb,a;(11);;
jmpkeyloop;repeatkeyloop
key_inproc;getkeynumber
MOV a,pa;;holdportAstate
MOV temp,a;(4);;
get_release:;waitforthekeytobereleased
MOV a,pa;;testportAstate
cplacc;;
anda,0f0h;;
szacc;(6);ifrelease?
jmpget_release;no.keepupwaiting
MOV a,0fh;yes.calculatekeynumber
andma,matrix;(7);masklownibbleofscancode
MOV a,0;keeptableindexatregisterA
get_row:;calculaterownumber
rrcmatrix;;checkeachbittogetrownumber
snzstatus.0;;
jmpget_next;ifbingogotoget_next
clrc;
adda,4h;(8);tableindex+4(4keysarow)
jmpget_row;continuecalculating
get_next:;
MOV tblp,a;holdtableindexatregisterTBLP
MOV a,0efh;
MOV mask,a;;mask=01111111
MOV a,0fh;
orma,temp;;temp=XXXX1111
get_column:;calculatecolumnnumber
MOV a,temp;loadtemp
xora,mask;;testcolumnnumber
snzz;;
jmpindex;no.testnextcolumn
ret;yes.return(TBLP)
index:;nextcolumn
inctblp;(9);tableindex+1
setc;
rlcmask;shiftmaskleft(LSB=1)
jmpget_column;repeatget_column
key_inendp
delaysproc;delaysubroutine
MOV a,0ffh;loadcounter
MOV count1,a;
d1:
sdzcount1;countdowncount1
jmpd1
ret
delaysendp

本站聲明: 本文章由作者或相關(guān)機(jī)構(gòu)授權(quán)發(fā)布,目的在于傳遞更多信息,并不代表本站贊同其觀點(diǎn),本站亦不保證或承諾內(nèi)容真實(shí)性等。需要轉(zhuǎn)載請(qǐng)聯(lián)系該專欄作者,如若文章內(nèi)容侵犯您的權(quán)益,請(qǐng)及時(shí)聯(lián)系本站刪除。
換一批
延伸閱讀

8位單片機(jī)在嵌入式設(shè)計(jì)領(lǐng)域已經(jīng)成為半個(gè)多世紀(jì)以來的主流選擇。盡管嵌入式系統(tǒng)市場(chǎng)日益復(fù)雜,8位單片機(jī)依然不斷發(fā)展,積極應(yīng)對(duì)新的挑戰(zhàn)和系統(tǒng)需求。如今,Microchip推出的8位PIC?和AVR?單片機(jī)系列,配備了先進(jìn)的獨(dú)立...

關(guān)鍵字: 單片機(jī) 嵌入式 CPU

強(qiáng)強(qiáng)聯(lián)手構(gòu)筑頂級(jí)運(yùn)營(yíng)傳播商業(yè)生態(tài) 北京2025年8月21日 /美通社/ -- 8月21日,2025GT世界挑戰(zhàn)賽北京亦莊站戰(zhàn)略合作座談會(huì)在京成功舉行,通過與權(quán)威媒體、新媒體傳播平臺(tái)及專業(yè)招商機(jī)構(gòu)的深度合作,這項(xiàng)國(guó)際頂級(jí)...

關(guān)鍵字: 5G 矩陣 中國(guó)汽車 可持續(xù)發(fā)展

在嵌入式系統(tǒng)開發(fā)中,程序燒錄是連接軟件設(shè)計(jì)與硬件實(shí)現(xiàn)的關(guān)鍵環(huán)節(jié)。當(dāng)前主流的單片機(jī)燒錄技術(shù)已形成ICP(在電路編程)、ISP(在系統(tǒng)編程)、IAP(在應(yīng)用編程)三大技術(shù)體系,分別對(duì)應(yīng)開發(fā)調(diào)試、量產(chǎn)燒錄、遠(yuǎn)程升級(jí)等不同場(chǎng)景。...

關(guān)鍵字: 單片機(jī) ISP ICP IAP 嵌入式系統(tǒng)開發(fā)

在嵌入式系統(tǒng)開發(fā)中,看門狗(Watchdog Timer, WDT)是保障系統(tǒng)可靠性的核心組件,其初始化時(shí)機(jī)的選擇直接影響系統(tǒng)抗干擾能力和穩(wěn)定性。本文從硬件架構(gòu)、軟件流程、安全規(guī)范三個(gè)維度,系統(tǒng)分析看門狗初始化的最佳實(shí)踐...

關(guān)鍵字: 單片機(jī) 看門狗 嵌入式系統(tǒng)

本文中,小編將對(duì)單片機(jī)予以介紹,如果你想對(duì)它的詳細(xì)情況有所認(rèn)識(shí),或者想要增進(jìn)對(duì)它的了解程度,不妨請(qǐng)看以下內(nèi)容哦。

關(guān)鍵字: 單片機(jī) 開發(fā)板 Keil

在這篇文章中,小編將對(duì)PLC的相關(guān)內(nèi)容和情況加以介紹以幫助大家增進(jìn)對(duì)它的了解程度,和小編一起來閱讀以下內(nèi)容吧。

關(guān)鍵字: PLC 模塊化 程序

香港2025年8月20日 /美通社/ -- 復(fù)銳醫(yī)療科技有限公司(英文"Sisram";簡(jiǎn)稱"復(fù)銳醫(yī)療科技"或"公司",股份代號(hào):1696.HK,連同其附屬公司統(tǒng)稱"集團(tuán)"),今日公布截至2025年6...

關(guān)鍵字: AI LM BSP 矩陣

隨著單片機(jī)系統(tǒng)越來越廣泛地應(yīng)用于消費(fèi)類電子、醫(yī)療、工業(yè)自動(dòng)化、智能化儀器儀表、航空航天等各領(lǐng)域,單片機(jī)系統(tǒng)面臨著電磁干擾(EMI)日益嚴(yán)重的威脅。電磁兼容性(EMC)包含系統(tǒng)的發(fā)射和敏感度兩方面的問題。

關(guān)鍵字: 單片機(jī) 電磁兼容

以下內(nèi)容中,小編將對(duì)單片機(jī)的相關(guān)內(nèi)容進(jìn)行著重介紹和闡述,希望本文能幫您增進(jìn)對(duì)單片機(jī)的了解,和小編一起來看看吧。

關(guān)鍵字: 單片機(jī) 復(fù)位電路

在這篇文章中,小編將為大家?guī)韱纹瑱C(jī)的相關(guān)報(bào)道。如果你對(duì)本文即將要講解的內(nèi)容存在一定興趣,不妨繼續(xù)往下閱讀哦。

關(guān)鍵字: 單片機(jī) 異常復(fù)位
關(guān)閉