1 4.7 4x4 鍵盤 每按一次鍵盤 控制七段顯示器. 2 ;PROGRAM : 4-7.ASM (4-7.PRJ) 2002.DEC.30. ;FUNCTION: 4X4 MATRIX KEYPAD DEMO PROGRAM BY STEVEN #INCLUDEHT46R23.INC.CHIPHT46R23.

Slides:



Advertisements
Similar presentations
Flow of Control Instruction/Control structure Looping structure Looping structure Branching structure Branching structure For assembly language program.
Advertisements

Lab 9: Matrix Keypad : ”No Key Press” Analysis Slide #2 Slide #3 ”Press and Hold Key 5” Analysis.
A Design Example An Exact Calculator. Exact Calculator Manipulating Large Integer Values Operations: – +, -, *, /, %, And, Or, Xor, Not, Power Functions.
Suranaree University Of Technology มทส  2002 Anant Oonsivilai 2002/4/8 Microcomputers and Microprocessors 1 Chapter 5 Addressing Modes.
1 Chapter 3 Jump, Loop, and Call Instructions. 2 Sections 3.1 Loop and Jump Instructions 3.2 Call Instructions 3.3 Time Delay Generation and Calculation.
//HDL Example 6-1 // //Behavioral description of //Universal shift register // Fig. 6-7 and Table 6-3 module shftreg.
8051 I/O Interfacing Need for more ports PPI 8255
Programmable Interval Timer
kashanu.ac.ir Microprocessors 6-1 I/O Devices Switches, LED, LCD Lec note 6.
1 4.3 單顆七段. 2 共陰極七段顯示器 C ommon Cathod (abcdefg) 七段接腳 gf(com)ab ed(com)cp HT46R23 接腳 VDD(20) RES(19) OSC1(21) OSC2(22) VSS(11) PA0-PA7(6,5,4,3,26,25,24,23)
1 4.4 指撥開關與單顆七段 當 DIP 為 ON 輸入接腳為 LOW 當 DIP 為 OFF 輸入接腳為 HIGH.
CSC Timers Since this is a microcontroller it mainly finds itself in embedded devices Quite often embedded devices need to synchronize events The.
Pulse-Width Modulated DAC
1 Timer 位元上數計數器 Up Counter 以 TMRC 暫存器設定 TMRC (TM1 TM0 – TON TE PSC2 PSC1 PSC0) 三種工作模式 (TM1 TM0 控制 ) 溢位時 TF(INT0.5) 位元設為 1.
© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e Interfacing a 4x4 Key Matrix Row Inputs.
Assembly Language for Intel-Based Computers Chapter 5: Procedures Kip R. Irvine.
1 Speaker. 2 喇叭發聲原理 利用喇叭上的線圈通上電流造成薄膜振動 振動推動空氣產生聲音.
1 Timer with PFD. 2 PFD 可程式除頻器 PAC.3=1 則 PA.3 被規劃為輸入模式 PAC.3=0 則 PA.3 被規劃為輸出模式 PA.3=1 即開始輸出 PFD 信號 產生的頻率為計時計數器溢位頻率之半 PA.3=0 即停止輸出 PFD 信號.
1 LCD. 2 LCD 液晶顯示器 文字型 繪圖型 Hitachi (HD44780A) 80 個位元組.
Embedded Systems 7763B Mt Druitt College of TAFE Electrical Engineering Lesson 2 LCD Display Interfacing.
Kip Irvine: Assembly Language for Intel-Based Computers
ADS design flow 7-segment. Build the Software Application Hook-UP the Emulator System Load and Run the demo Program 7 Segment.
7-1 Keypad Scanning interface Used for interfacing push-button(momentary) switches Used for large number(>8) push-buttons Relies on matrix arrangement.
1 4.2 LED 查表. 2 HT46R23 程式記憶體 4096 個位址 (0000-FFFFh) 256 個位置為單一程式頁 TBLP 暫存器只有 8 個位元 TABRDC [m] 指令 依據 TBLP 所示位址將目前程 式頁之內容讀出 將低 8 位元存入資料記憶體 [m] 中 其餘位元存入.
8.6 Multitasking User 1 PP User 2 User 3 User 4 User 1 User 2 User 3 User 4 User 1 User 2 User 3 User 4 User 1 User 2 User 3 User 4... time the time.
Timer/Event. 2 利用 Timer/Event Counter 之中斷 及 PFD 控制喇叭 4.9 之 Timer 以 Poling 詢問方式檢查 TF 旗標 是否溢位.
ADC. 2 ADC 數位類比轉換器 解析度 10 bit 準確度 9 bit 類比輸入 PB 轉換結果 D9-D0 存放在 ADRH,ADRL.
Embedded Systems Design 1 Lecture Set B Interfacing the MCS-51 to: –7 and 16 segment displays –a Multiplexed 7-Segment Display –a Keypad –an LCD.
Assembler When a source program is a assembly language and the target program is a numerical machine language then the translator is called as a assembler.
Verilog Descriptions of Digital Systems. Electronic Lock // // Electronic combinational lock // module lock(seg7,key, valid_key, col, row, mclk, resetL)
Dr. Hoganson CSIS Segment Display and Count by 16 This is our third lab using the 68HC11 microcontroller. We will write a program that counts by.
1 Chapter 4 Timer Operation (I. Scott MacKenzie).
1LAKSHMI.B.E.. Full step -clock 2LAKSHMI.B.E. Full step –anti clock 3LAKSHMI.B.E.
I/O devices Peripheral devices (also called I/O devices) are pieces of equipment that exchange data with a CPU Examples: switches, LED, CRT, printers,
Introduction to Holtek ASM Programming
BIOS and DOS Programming in DOS INT 10 and 21H. Interrupts There are some extremely useful subroutines within BIOS or DOS that are available to the user.
1 Chapter 5: Procedures and Interrupts Assembly Language for Intel-Based Computers, Kip R. Irvine 3rd edition 3/17/2000.
The 8051 Assembly Language Branching & Subroutines
8279 KEYBOARD AND DISPLAY INTERFACING
ECE 371 – Unit 9 Interrupts (continued). Example Set up Two Interrupt Request Inputs: –Port H[0] Set Interrupt Flag on “0” to “1” transition (rising edge)
4-12 外部中斷 HT66F50.
Lecture Set 4 Programming the 8051.
Keyboard interfacing.
Projects 8051.
8279 KEYBOARD AND DISPLAY INTERFACING
EE 316 Computer Engineering Junior Lab Project 2 Digital Yahtzee.
In Class Program Write, assemble and test a program: –Use the DB directive to define the following list of numbers and name it array: 31h, 32h, 33h, 34h.
1 4-8 IO_speaker 利用 HT66F50 中 PC4 腳位輸出特 性 控制 speaker 發聲.
KEYBOARD INTERFACING Keyboards are organized in a matrix of rows and columns The CPU accesses both rows and columns through ports. ƒTherefore, with two.
MICRO CONTROLLER PROGRAMMING & APPLICATIONS UNIT V Mr. S. VINOD LECTURER EEE DEPARTMENT.
HALT HT66F50. HALT 指令 進入省電模式 1. 關閉系統時脈, 若啟用 WDT 將繼續 WDT 時脈 (LXT, LIRC) 2. 內部資料 RAM 不變 3. 清除 WDT, 並重新開始計數 4. 所有 I/O 維持原來狀態 ( 若要省電周邊元件要關閉 ) 5. 清除.
I/O Devices Switches, LED, LCD
ECE 447: Lecture 12 Keypads ECE 447: Lecture 10. ECE 447: Matrix Keypad.
Department of Electronic & Electrical Engineering Lecture 4. ➢ Loops ➢ Delays ➢ Conditional instructions ➢ Simple clock example.
KEYBOARD/DISPLAY CONTROLLER - INTEL Features of 8279 The important features of 8279 are, Simultaneous keyboard and display operations. Scanned keyboard.
Applications examples. A binary count : stepped manually and reset with push buttons. Define ports Reset portd Reset =0? INCF portd no Step =0? yes.
EKT 221 : DIGITAL 2.
LCD AND KEYBOARD INTERFACING
Microprocessor and Assembly Language
LHO 15 C with assembly language
Keypad Source: under under
Microprocessor Lab CSL1543 0:0:2
Subroutines and the Stack
Table Construction.
4-14 類比中斷 HT66F50.
Computer Architecture and Assembly Language
Keypad Source: under under
Keypad Source: under under
SLEEP1 HT66F50.
LCD AND KEYBOARD INTERFACING
Presentation transcript:

x4 鍵盤 每按一次鍵盤 控制七段顯示器

2 ;PROGRAM : 4-7.ASM (4-7.PRJ) 2002.DEC.30. ;FUNCTION: 4X4 MATRIX KEYPAD DEMO PROGRAM BY STEVEN #INCLUDEHT46R23.INC.CHIPHT46R23 ; MY_DATA.SECTION'DATA' ;== DATA SECTION == DEL1 DB ? ;DELAY LOOP COUNT 1 DEL2 DB ? ;DELAY LOOP COUNT 2 DEL3DB ?;DELAY LOOP COUNT 3 COUNTDB ? KEYDB ? ;KEY CODE REGISTER ; SEG_PORTEQUPB;DEFINE 7-SEG PORT SEG_PORTCEQUPBC ;DEFINE 7-SEG PORT CONTROL REG. KEY_PORTEQUPA;DEFINE KEYPAD PORT KEY_PORTC EQUPAC;DEFINE KEY PORT VONTROL REG. MY_CODE.SECTIONAT 0'CODE' ;== PROGRAM SECTION == ORG 00H ;HT-46RXX RESET VECTOR CLRSEG_PORTC;CONFIG PA AS OUTPUT MODE

3 MAIN: CLR SEG_PORT;CLEAR DISPLAY CALL READ_KEY;READ KEYPAD MOVA,16 XORA,KEY SZZ;IS KEY NOT PRESSED(KEY=16)? JMP MAIN ;YES,RE-READ. MOVA,KEY CALLTRANS;GET 7 SEG DISPLAY CODE MOVSEG_PORT,A;DISPLAY KEY VALUE CALLDELAY;DELAY 1 SEC. JMPMAIN

4 ;******************************************************************** ; SCAN 4x4 MATRIX ON KEY PORT AND RETURN THE CODE IN KEY REGISTER ;IF NO KEY BEEN PRESSED, KEY=16. ;******************************************************************** READ_KEYPROC MOVA, B MOVKEY_PORTC,A;CONFIG PORT B BIT 7-4 input BIT 3-0 output SETKEY_PORT;INITIAL PORT B CLRKEY;INITIAL KEY REGISTER MOVA,04 MOVCOUNT,A;SET ROW COUNTER CLR C;CLEAR CARRY FLAG

5 Key_port.4=0 按下 SCAN_KEY: RLCKEY_PORT;ROTATE SCANNING BIT SET C;MAKE SURE C=1 SNZ KEY_PORT.4;COLUMN 0 PRESSED? JMPEND_KEY;YES. INCKEY;NO, INCREASE KEY CODE. SNZ KEY_PORT.5;COLUMN 1 PRESSED? JMPEND_KEY;YES. INCKEY;NO, INCREASE KEY CODE. SNZ KEY_PORT.6;COLUMN 2 PRESSED? JMPEND_KEY;YES. INCKEY;NO, INCREASE KEY CODE. SNZ KEY_PORT.7;COLUMN 3 PRESSED? JMPEND_KEY;YES. INCKEY;NO, INCREASE KEY CODE. SDZCOUNT;HAVE ALL ROWs BEEN CHECKED? JMPSCAN_KEY;NO, NEXT ROW. END_KEY: RET READ_KEY ENDP

6 ;******************************************************************** ; Delay about DEL1(100)*10mS ;******************************************************************** DELAY PROC MOVA,100 MOVDEL1,A DEL_1: MOV A,30 MOV DEL2,A;SET DEL2 COUNTER DEL_2:MOVA,110 MOVDEL3,A;SET DEL3 COUNTER DEL_3: SDZ DEL3 ;DEL3 DOWN COUNT JMP DEL_3 SDZ DEL2 ;DEL2 DOWN COUNT JMP DEL_2 SDZDEL1;DEL1 DOWN COUNT JMPDEL_1 RET DELAYENDP

7 ;******************************************************************** ; RETURN THE TABLE VALUE INDEX BY A ;******************************************************************** TRANSPROC ADDMA,PCL RET A, B;0 RETA, B;1 RETA, B;2 RET A, B;3 RET A, B;4 RETA, B;5 RET A, B;6 RET A, B;7 RET A, B;8 RET A, B;9 RETA, B;a RETA, B;b RETA, B;c RETA, B;d RETA, B;E RETA, B;F TRANSENDP END