tailieunhanh - Thiết kế hệ thống nhứng -TS. Trương Quang Vinh-c7a

8/9/2016ĐẠI HỌC QUỐC GIA CHÍ ĐẠI HỌC BÁCH ĐIỆN-ĐIỆN MÔN KỸ THUẬT ĐIỆN TỬEmbedded System 7: Peripherals for Digital parallel input / LCD Analog input / Serial Môn Kỹ Thuật Điện Tử - ĐHBK11. Digital parallel input / output.• Commonly used input peripherals.– DIP switches, push‐button keys, keyboards, and A/D converters• DIP switch.– One side of the switch is tied high.• To a power supply through a resistor called a pull‐up resistor– The other side is grounded.– The logic level changes when the position is switched• Push‐button key .– Same as the DIP switch except that contact is momentaryBộ môn Kỹ Thuật Điện Tử - ĐHBKChapter 7 - ON I/O PORTSvery neededBộ môn Kỹ Thuật Điện Tử - ĐHBKthe circuit waste currentChapter 7 - p1when the switch is open,.the input floats to a noisesensitive3Switch InputBộ môn Kỹ Thuật Điện Tử - ĐHBKChapter 7 - input for PICActive môn Kỹ Thuật Điện Tử - ĐHBKTransistor InputChapter 7 - p15Switch hardware debouncingSwitch hardware debounce.(a) without debounce capacitor .(b) with debounce capacitor .Ex: With a 10k pull‐up resistor, a 10 would give a time constant of 100 ms, .which should be more than môn Kỹ Thuật Điện Tử - ĐHBKChapter 7 - Debouncing.• Debouncing the key.– Software technique.• Wait for 20 ms• Read the port pin again• If the reading is still 0 (for eg) , it .indicates that a key is in mechanical switches. When the switch closes, the mechanical pieces vibrate generating before settling. This transient normally lasts 20 msBộ môn Kỹ Thuật Điện Tử - ĐHBKChapter 7 - p17Interfacing Dip SwitchesBộ môn Kỹ Thuật Điện Tử - ĐHBKChapter 7 - Circuit with Input SwitchBộ môn Kỹ Thuật Điện Tử - ĐHBKChapter 7 - p19Tests an input with IF Statement.// Tests an input.#include " ".void main().{.int x; // Declare (0); // Clear all (1) // Loop always.{.x = input(PIN_C0); // Get input (x = = 1)output_high(PIN_D0); // Change output.}.}Bộ môn Kỹ Thuật Điện Tử - ĐHBKChapter 7 - p1105. | 8 9 2016 ĐẠI HỌC QUỐC GIA CHÍ MINH TRƯỜNG ĐẠI HỌC BÁCH KHOA KHOA ĐIệN-ĐIỆN Tử BỘ MÔN KỸ Thuật điện tử Embedded System Design Chapter 7 Peripherals for embedded systems Digital parallel input output LCD interfacing Analog input output Serial communication Bộ Môn Kỹ Thuật ĐiệnTử - ĐHBK 1. Digital parallel input output Commonly used input peripherals DIP switches push-button keys keyboards and A D converters DIP switch One side of the switch is tied high To a power supply through a resistor called a pull-up resistor The other side is grounded The logic level changes when the position is switched Push-button key Same as the DIP switch except that contact is momentary Bộ môn Kỹ Thuật ĐiệnTử - ĐHBK Chapter 7 -pl 2 1 8 9 2016 SWITCH ON I O PORTS very small current needed the circuit waste a large current when the switch is open the input floats to a noisesensitive Bộ môn Kỹ Thuật ĐiệnTử - ĐHBK Chapter 7 - p1 3 Switch Input Bộ môn Kỹ Thuật ĐiệnTử - ĐHBK Chapter 7 - p1 External pulllip When switch is pressed RB3 reads as O else reads as r. If pullup not present then input would float when switch is not pressed and input value may read as 0 or 1 because of system noise. 4 2 8 9 2016 Switch hardware debouncing Debounce Capacitor Pull-up Resistor Rp Switch PIC Vo Rp Ri Switch hardware debounce a without debounce capacitor b with debounce capacitor Ex With a 10k pull-up resistor a 10 nF w capacitor would give a time constant of 100 ms which should be more than adequate Bộ môn Kỹ T J- t Chapter 7 - pl

crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.