1. Trang chủ
  2. » Kỹ Thuật - Công Nghệ

2 chapter 2 addressing methods

27 132 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 27
Dung lượng 1,87 MB

Nội dung

MICROCONTROLLERS CHAPTER ADDRESSING METHODS Dr Vo Tuong Quan HCMUT - 2011 Addressing Methods 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 !!!  2011 – Vo Tuong Quan Addressing Methods 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  2011 – Vo Tuong Quan Addressing Methods  2011 – Vo Tuong Quan Addressing Methods 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  2011 – Vo Tuong Quan Addressing Methods 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  2011 – Vo Tuong Quan Addressing Methods 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 1 1 1 1 1 1 0FFF 0 0 0 0 0 0 0 1000 0 1 1 1 1 1 1 1FFF 0 0 0 0 0 0 0 2000 0 1 1 1 1 1 1 2FFF 0 1 0 0 0 0 0 0 3000 0 1 1 1 1 1 1 1 3FFF 0 0 0 0 0 0 0 4000 0 1 1 1 1 1 1 4FFF 1 0 0 0 0 0 0 5000 1 1 1 1 1 1 1 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)  2011 – Vo Tuong Quan Addressing Methods 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  2011 – Vo Tuong Quan Addressing Methods 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  2011 – Vo Tuong Quan Addressing Methods 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 10  2011 – Vo Tuong Quan Addressing Methods PIG-PG2 Loading program: WinPicPro 13  2011 – Vo Tuong Quan Addressing Methods PIG-PG3 Loading program: ICPro 14  2011 – Vo Tuong Quan Basic I/O Functions Basic I/O functions PVN1 RESET •Output (Low/High) •Input (Low/High) 15 16 17 18 23 24 25 26 OSC1 OSC2 13 14 12 31 D3 R4 MCLR*/VPP RA0/AN0 RA1/AN1 RA2/AN2/VREF-/CVREF RA3/AN3/VREF+ RA4/T0CKI/C1OUT RA5/AN4/SS*/C2OUT RC0/T1OSO/T1CKI RC1/T1OSI/CCP2 RC2/CCP1 RC3/SCK/SCL RC4/SDI/SDA RC5/SDO RC6/TX/CK RC7/RX/DT RB0/INT RB1 RB2 RB3/PGM RB4 RB5 RB6/PGC RB7/PGD RD0/PSP0 RD1/PSP1 RD2/PSP2 RD3/PSP3 RD4/PSP4 RD5/PSP5 RD6/PSP6 RD7/PSP7 OSC1/CLKIN RE0/RD*/AN5 RE1/WR*/AN6 RE2/CS*/AN7 B1 B2 B3 B4 B5 B6 B7 B8 33 34 35 36 37 38 39 40 B1 19 20 21 22 27 28 29 30 10 B2 R5 R D4 LED B3 R6 R D5 LED B4 R7 R D6 LED B5 R8 R D7 LED B6 R9 R D8 LED B7 R10 R D9 LED B8 R11 R D10 LED R LED OSC2/CLKOUT VSS VSS VDD VDD Vcc 11 32 PIC16F877A R2 D1 Vcc C1 OSC1 J1A R3 LED R1 D2 22p Vcc 1A 2A 1K + 1K RESET Y1 20MHz OSC2 C2 10K LED SW1 + Nguon DC5V 22p 15  2011 – Vo Tuong Quan Basic I/O Functions #include #use delay (clock=200000000) #fuses hs,nowdt,noput,nolvp #byte portB=0x06 void led() {int a,i; {a=0x01; for (i=1;i

Ngày đăng: 07/11/2017, 14:17

TỪ KHÓA LIÊN QUAN

w