4-14 類比中斷 HT66F50.

Slides:



Advertisements
Similar presentations
The 8051 Microcontroller and Embedded Systems
Advertisements

Autumn 2012C.-S. Shieh, EC, KUAS, Taiwan1 The 8051 Family Microcontroller Chin-Shiuh Shieh Department of Electronic Engineering.
Week10 Boolean Instructions on the Boolean Instructions  Boolean (or Bit) addressable capability is unique to the 8051  Enables efficient handling.
A Design Example An Exact Calculator. Exact Calculator Manipulating Large Integer Values Operations: – +, -, *, /, %, And, Or, Xor, Not, Power Functions.
S04: MSP430 Microarchitecture
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.
Introduction of Holtek HT-46 series MCU
68HC11 Polling and Interrupts
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.
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 4.2 LED 查表. 2 HT46R23 程式記憶體 4096 個位址 (0000-FFFFh) 256 個位置為單一程式頁 TBLP 暫存器只有 8 個位元 TABRDC [m] 指令 依據 TBLP 所示位址將目前程 式頁之內容讀出 將低 8 位元存入資料記憶體 [m] 中 其餘位元存入.
Timer/Event. 2 利用 Timer/Event Counter 之中斷 及 PFD 控制喇叭 4.9 之 Timer 以 Poling 詢問方式檢查 TF 旗標 是否溢位.
Railway Foundation Electronic, Electrical and Processor Engineering.
ADC. 2 ADC 數位類比轉換器 解析度 10 bit 準確度 9 bit 類比輸入 PB 轉換結果 D9-D0 存放在 ADRH,ADRL.
ECE Lecture 1 1 L15 – Digital I/O Department of Electrical and Computer Engineering The Ohio State University ECE 2560.
Block Diagram of 4518 Dual BCD Counter The 4518 Dual BCD Counter has two BCD counters. Each counter is similar to the other. Each counter has a master.
1 Chapter 4 Timer Operation (I. Scott MacKenzie).
Input/Output Interface Circuits and LSI Peripheral Devices
Introduction to Holtek ASM Programming
Serial Communication Lec note 9.
1. Registers Used in Timer/Counter  TH0, TL0, TH1, TL1  TMOD (Timer mode register)  TCON (Timer control register) 2.
The 8051 Assembly Language Branching & Subroutines
8051 Micro controller. Architecture of 8051 Features of 8051.
ECE/CS-352: Embedded Microcontroller Systems The Silicon Laboratories C8051F020 Enhanced 8051 Part 4 Timer3, Temperature Sensor, AD0WINT.
4-12 外部中斷 HT66F50.
© 1999 Altera Corporation Configuration/Program Method for Altera Device.
Programmable Peripheral Interface Parallel port Interface 8255
Projects 8051.
ECE Lecture 1 1 L15 –I/O Part II Department of Electrical and Computer Engineering The Ohio State University ECE 2560.
Digital Electronics.
1 4-8 IO_speaker 利用 HT66F50 中 PC4 腳位輸出特 性 控制 speaker 發聲.
C Examples 1. Download Links dsPIC30F4011/4012 Data Sheet dsPIC30F4013/3014 dsPIC30F Family Reference Manual MikroC MikroC Manual MikroC Quick Reference.
HALT HT66F50. HALT 指令 進入省電模式 1. 關閉系統時脈, 若啟用 WDT 將繼續 WDT 時脈 (LXT, LIRC) 2. 內部資料 RAM 不變 3. 清除 WDT, 並重新開始計數 4. 所有 I/O 維持原來狀態 ( 若要省電周邊元件要關閉 ) 5. 清除.
x4 鍵盤 每按一次鍵盤 控制七段顯示器. 2 ;PROGRAM : 4-7.ASM (4-7.PRJ) 2002.DEC.30. ;FUNCTION: 4X4 MATRIX KEYPAD DEMO PROGRAM BY STEVEN #INCLUDEHT46R23.INC.CHIPHT46R23.
EE/CS-352: Embedded Microcontroller Systems Part V The 8051 Assembly Language Interrupts.
kashanu.ac.ir Microprocessors Interrupts Lec note 8.
80C51 Block Diagram 1. 80C51 Memory Memory The data width is 8 bits Registers are 8 bits Addresses are 8 bits – i.e. addresses for only 256.
8 085Microprocessor Temp Reg (8) Accumulator (A reg) Flag flip flops(8) Instruction Register (8) Arithmetic Logic Unit ALU Instruction Decoder and Machine.
DEPARTMENT OF ELECTRONICS ENGINEERING V-SEMESTER MICROPROCESSOR & MICROCONTROLLER 1 CHAPTER NO microcontroller & programming.
8255 Programmable Peripheral Interface
EKT 221 : DIGITAL 2.
Lecture 8: TI MSP430 Interrupts, ISRs
80C51 Block Diagram ECE Overview.
Symbol Definition—CODE, DATA, IDATA, XDATA
COMP2121: Microprocessors and Interfacing
Arduino.
Assembler Directives Code generation flow
The 8051 Family Microcontroller
UNIT 5 TIMRERS/COUNTERS
AVR ATmega128 microcontroller
Data Processing Instructions
ATmega103 Timer0 and Interrupts
Lecture 6 Assembler Directives.
Timer.
Introduction to Micro Controllers & Embedded System Design Addressing Mode Department of Electrical & Computer Engineering Missouri University of Science.
Microprocessor Lab CSL1543 0:0:2
Table Construction.
Introduction to Micro Controllers & Embedded System Design Instruction set Department of Electrical & Computer Engineering Missouri University of Science.
Interrupt Source: under
Programmable Peripheral Interface
Interrupt.
Interrupt Source: under
SLEEP1 HT66F50.
By Nasser Halasa Assembly Language.
Serial Communications
Presentation transcript:

4-14 類比中斷 HT66F50

CP0C C0SEL C0EN C0POL C0OUT C0OS - - C0HYEN Bit 7 6 5 4 3 2 1 0

CP0C Bit 7 6 5 4 3 2 1 0 C0SEL C0EN C0POL C0OUT C0OS - - C0HYEN C0HYEN:選擇Hysteresis控制

4-14 外部中斷 ;PROGRAM:4-14.ASM (4-14.PJT) 2009.1113 4-14 外部中斷 ;PROGRAM:4-14.ASM (4-14.PJT) 2009.1113 ;FUNCTION: LDR AND COMPARATOR CONTROL LEDS DEMO PROGRAM #INCLUDE HT66F50.INC ;=================================================================== MY_DATA .SECTION 'DATA‘ ;==DATA SECTION== DEL1 DB ? ;DELAY LOOP COUNT 1 DEL2 DB ? ;DELAY LOOP COUNT 2 DEL3 DB ? ;DELAY LOOP COUNT 3 COUNT DB ? ;===================================================================LED_PORT EQU PC ;DEFINE LEDS PORT LED_PORTC EQU PCC ;DEFINE LEDS PROT CONTROL REG

MY_CODE .SECTION 'CODE‘ ;==PROGRAM SECTION== ORG 00H ;HT66FX0 RESET VECTOR JMP INIT ORG 0CH ;HT66FX 0 COMPARATOR 0 INTERRUPT JMP ISR_CP0 INIT: MOV A,00001000B MOV CP1C,A ;Disable Comparator 1 Function CLR ACERL ;Digital I/O Pin is assigned as a I/O line CLR LED_PORTC ;CONFIG LED_PORT AS OUTPUT MODE CLR LED_PORT ;TURN OFF LEDS MOV A,11100001B ;CONFIG I/O PIN AS COMPARATOR ;INPUT PIN MOV CP0C,A ;ENABLE CP0 FUNCTION, COPOL=C0OS=1 SET CP0E ;ENABLECP0 INTRRRUPT SET EMI ;ENABLE GLOBAL INTERRUPT JMP $

;================================================================ ; COMPARATOR 0 INTRRRUPT SERVICE ROUTINE ISR_CP0: MOV A,8 MOV COUNT,A SNZ C0OUT ;C0VIN+ > C0VIN- ? JMP CP0_ISR_1 ;YES. CP0_ISR_0: ;NO. BRIGHT TO DARK SET C ;TURN LEDS ON RLC LED_PORT CALL DELAY SDZ COUNT JMP CP0_ISR_0 RETI

CP0_ISR_1: ;DARK TO BRIGHT CLR C ;TURN LEDS OFF RRC LED_PORT CALL DELAY SDZ COUNT JMP CP0_ISR_1 RETI

DELAY PROC MOV A,25 MOV DEL1,A ;SET DEL1 COUNTER DEL_1: MOV A,30 MOV DEL2,A ;SET DEL2 COUNTER DEL_2: MOV A,110 MOV DEL3,A ;SET DEL3 COUNTER DEL_3: SDZ DEL3 ;DEL3 DOWN COUNT JMP DEL_3 SDZ DEL2 ;DEL2 DOWN COUNT JMP DEL_2 SDZ DEL1 ;DEL1 DOWN COUNT JMP DEL_1 RET DELAY ENDP