Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 22 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
22
Dung lượng
2,73 MB
Nội dung
MICROCONTROLLERS CHAPTERFUNDAMENTALOF MICROCONTROLLERS Dr Vo Tuong Quan HCMUT - 2011 Class Rules Class attendance: 10% (if a student absent more than time, the attendance score is zero) Quizes or Excercises in class: 10% Homeworks report: 15% (students will submit the homework via ELearning system) Teamwork project : 25% • Each team includes 3-4 students, each team will present their research topic at the final weeks of the semester • English power point and english presentation in class are encouraged Final exam: 40% (Students will allow to use their documents while doing the exam Time for final exam: 90 minutes) 2011 – Vo Tuong Quan Introduction What is a microcontroller ? -Microcontroller is a programmable digital processor with necessary peripherals - Both microcontrollers and microprocessors are complex sequential digital circuits meant to carry out job according to the program / instructions - Analog input/output interface makes a part ofmicrocontroller circuit of mixed mode(both analog and digital nature) 2011 – Vo Tuong Quan Introduction Architecture ofmicrocontrollerMicrocontroller PIC, ATMega, TI: RISC: Reduced Instruction Set Computer Other Microcontroller: CISC: Complex Instruction Set Computer 2011 – Vo Tuong Quan Introduction Some popular PIC families: Pic16xxxx Pic18xxxx dsPicxxxxx Pic33xxxx Some typical specifications of Pic families: - Flash memory, I/O, Timer-Counter 8bits - 16bits; - Communication: A/D, Rs232, SPI, I2C, CAN, LAN, USB,… - Control: ExINT, Output Compare, Input Capture, PWM, QEI,… 2011 – Vo Tuong Quan Introduction Typical structure ofmicrocontroller 2011 – Vo Tuong Quan Introduction PIC 16F877 2011 – Vo Tuong Quan Introduction PIC 16F877 2011 – Vo Tuong Quan Introduction What is Microprocessor ? Example? What is the differences between Microcontroller and Microprocessor? 2011 – Vo Tuong Quan Introduction The Addressing Methods Use to know the source address and destination address of data Register addressing Direct addressing* Indirect addressing* Immediate addressing* Relative addressing* Absolute addressing* Index addressing What is the register? REMEMBER !!! 10 2011 – Vo Tuong Quan Introduction How to solve the addressing mode problem? Review some popular IC using in addressing mode: - 74139: decoding - 74139: decoding - Some logical gates: AND, OR, XOR, EX-OR, EX-NOR 11 2011 – Vo Tuong Quan Introduction 12 2011 – Vo Tuong Quan Introduction ROM and RAM Typical using in the addressing problem A0 - An nCS ROM D0 - Dm A: Address D: Data C: Control The ability to addressing data is based on the number of address bus N line of address bus management ability is 2n 13 2011 – Vo Tuong Quan Introduction Solving the problem by examples: Design the address decoding circuit using ROM and RAM The capacity of ROM is 16KB using pieces of 4KB ROM and the capacity of RAM is 8KB using pieces of 4KB RAM The starting address of ROMs is 0000h and the address of RAMs is following after the ending address of ROMs How to solve this kind of problem? Step 1: Make the addressing table of all peripherals Step 2: Choose suitable address line to be the input signal to decoding ICs as 74138 or 74139 or 74142, and decide which output pins of the decoding ICs to connect to the appropriate peripherals Step 3: Draw the circuit 14 2011 – Vo Tuong Quan Introduction Solution A15 A14 A13 A12 A11 A10 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0 Hex 0 0 0 0 0 0 0 0 0000 0 0 111111 0FFF 0 0 0 0 0 0 0 1000 0 111111 1FFF 0 0 0 0 0 0 0 2000 0 111111 2FFF 0 1 0 0 0 0 0 0 3000 0 1111111 3FFF 0 0 0 0 0 0 0 4000 0 111111 4FFF 1 0 0 0 0 0 0 5000 1111111 5FFF ROM ROM ROM ROM RAM RAM Using IC 74138 with lines A12, A13, A14 to be the input of 74138 The output lines of 74138 are used to connect to CS line of ROMs and RAMs (Y0 – Y3 connect to ROM1 – ROM4 ; Y4 – Y5 connect to RAM1 – RAM2) 15 2011 – Vo Tuong Quan Introduction Exercises Design the address decoding circuit using ROM and RAM The capacity of ROM is 16KB using pieces of 8KB ROM and the capacity of RAM includes pieces of 4KB RAM and pieces of KB RAM The starting address of ROMs is 0000h and the address of RAMs is following after the ending address of ROMs Design the address decoding circuit using ROMs and RAMs The capacity of ROM is 32KB using pieces of 8KB ROM and the capacity of RAM is 4KB using pieces of 2KB RAM The starting address of RAMs is 0000h and the address of ROMs is following after the ending address of RAMs 16 2011 – Vo Tuong Quan Introduction Think about the three types of problems The starting addresses of each types of memory are given The capacity of the second type is bigger than the first type The capacity of the second type is smaller than the first type 17 2011 – Vo Tuong Quan Introduction Programing Language and Programing Softwares -Programing Language: C, Basic, ASM, -Programing Softwares: •MPLAB (Microchip) most popular C language •MikroC C language •PicBasic Basic Language -Compiler: •C16, C18, C30, (Microchip) •CCS-C •HiTechC 18 2011 – Vo Tuong Quan Introduction Some popular loading circuits FD-ICP Loading program: WinPicPro 19 2011 – Vo Tuong Quan Introduction PIG-PG1 Loading program: WinPicPro 20 2011 – Vo Tuong Quan Introduction PIG-PG2 Loading program: WinPicPro 21 2011 – Vo Tuong Quan Introduction PIG-PG3 Loading program: ICPro 22 2011 – Vo Tuong Quan