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

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Addressing MethodsThe Addressing Methods Use to know the source address and destination address of data... ROM and RAM Typical using in the addressing problem ROM A0 - An The ability to

Trang 1

CHAPTER 2

ADDRESSING METHODS

Dr Vo Tuong Quan

Trang 2

Addressing Methods

The Addressing Methods

Use to know the source address and destination address of data

Trang 3

How to solve the addressing mode problem?

Review some popular IC using in addressing mode:

- 74139: decoding 2  4

- 74139: decoding 3  8

- Some logical gates: AND, OR, XOR, EX-OR, EX-NOR

Addressing Methods

Trang 4

Addressing Methods

Trang 5

ROM and RAM

Typical using in the addressing problem

ROM

A0 - An

The ability to addressing data is based on the number of address bus N line of address bus  management ability

Addressing Methods

Trang 6

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.

Addressing Methods

Trang 7

Solution

5FFF

1 1 1 1

1 1 1 1

1 1 1

1

1 0

1

5000

0 0 0 0

0 0 0 0

0 0 0

0

1 0

1

0

4FFF

1 1 1 1

1 1 1 1

1 1 1

1

0 0

1

4000

0 0 0 0

0 0 0 0

0 0 0

0

0 0

1

0

3FFF

1 1 1 1

1 1 1 1

1 1 1

1

1 1

0

3000

0 0 0 0

0 0 0 0

0 0 0

0

1 1

0

0

2FFF

1 1 1 1

1 1 1 1

1 1 1

1

0 1

0

2000

0 0 0 0

0 0 0 0

0 0 0

0

0 1

0

0

1FFF

1 1 1 1

1 1 1 1

1 1 1

1

1 0

0

1000

0 0 0 0

0 0 0 0

0 0 0

0

1 0

0

0

0FFF

1 1 1 1

1 1 1 1

1 1 1

1

0 0

0

0000

0 0 0 0

0 0 0 0

0 0 0

0

0 0

0

0

Hex A0

A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11

A12 A13

A14 A15

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)

Addressing Methods

Trang 8

1 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 2 pieces of 4KB RAM and 2 pieces of 2 KB RAM The starting address of ROMs

is 0000h and the address of RAMs is following after the ending address of ROMs

2 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

Addressing Methods

Trang 9

Think about the three types of problems

1 The starting addresses of each types of memory are given.

2 The capacity of the second type is bigger than the first type

3 The capacity of the second type is smaller than the first type

Addressing Methods

Trang 10

Programing Language and Programing Softwares

-Programing Language: C, Basic, ASM,

Trang 11

Some popular loading circuits

1 FD-ICP

Loading program:WinPicPro

Addressing Methods

Trang 12

2 PIG-PG1

Loading program:WinPicPro

Addressing Methods

Trang 13

2 PIG-PG2

Loading program:WinPicPro

Addressing Methods

Trang 14

2 PIG-PG3

Loading program:ICPro

Addressing Methods

Trang 15

33 34 35 36 37 38 39 40 15

16 17 18 23 24 25 26

19 20 21 22 27 28 29 30 13

14

32 11 31

12

1

8 9 10

RA0/AN0 RA1/AN1 RA2/AN2/VREF-/CVREF RA3/AN3/VREF+

RA4/T0CKI/C1OUT RA5/AN4/SS*/C2OUT

RB0/INT RB1 RB2 RB3/PGM RB4 RB5 RB6/PGC RB7/PGD RC0/T1OSO/T1CKI

RC1/T1OSI/CCP2 RC2/CCP1 RC3/SCK/SCL RC4/SDI/SDA RC5/SDO RC6/TX/CK RC7/RX/DT

RD0/PSP0 RD1/PSP1 RD2/PSP2 RD3/PSP3 RD4/PSP4 RD5/PSP5 RD6/PSP6 RD7/PSP7 OSC1/CLKIN

OSC2/CLKOUT

VDD VDD VSS

VSS

MCLR*/VPP

RE0/RD*/AN5 RE1/WR*/AN6 RE2/CS*/AN7

B3 B1

LED B8

D2

LED

RESET

Y 1 20MHz

R B5

Trang 17

Basic I/O Functions

Some popular functions in CCS-C

•#include < > or #include ‘ ‘ //Declare the mcu

•byte id = x // Ex: byte PortB = 0xC6;

•define id text //Ex: define a 1234567

•#use ‘function name’(parameters) //#use delay (clock = 20M)

•delay_cycles(a)// a: instruction cycle

•input_X(value) //input from X port on MCU

•Set_tris_X(value)//X: name of port on MCU

Trang 18

Basic I/O Functions

Example: Control the 7 segment Leds

D2 LED

R5 R

33 35 36 38 40 15

17 23 24 26

19 21 27 28 30 13

14

32 31

1

8 10

RA0/AN0 RA2/AN2/ VREF-/CVREF RA3/AN3/ VREF+

RA4/T0CKI/C1OUT RA5/AN4/ SS*/C2OUT

RB0/INT RB1 RB3/PGM RB4 RB6/PGC

RC0/T1OSO/T1CKI RC1/T1OSI/CCP2 RC2/CCP1 RC3/SCK/SCL RC4/SDI/SDA RC5/SDO RC6/TX/CK RC7/RX/DT

RD0/ PSP0 RD1/ PSP1 RD3/ PSP3 RD5/ PSP5 RD7/ PSP7 OSC1/CLKIN

OSC2/CLKOUT

VDD VSS

MCLR*/VPP

RE0/RD*/AN5 RE1/WR*/AN6 RE2/CS*/AN7

Y 1 20MHz R3

Vcc

C1 22p

C

C2 22p

D

R2 1K

R6 R

R7 R

E

Trang 19

Basic I/O Functions

Example: Control the 7 segment Leds (Cont’d)

while(i<1000){output_b(led7[donvi]);output_d(0x7f);

delay_us(50);

output_d(0xff);

output_b(led7[chuc]);output_d(0xbf);

delay_us(50);

output_d(0xff);

output_b(led7[tram]);output_d(0xdf);

delay_us(50);

output_d(0xff);

output_b(led7[nghin]);output_d(0xef);

delay_us(50);

output_d(0xff);

i++;

Trang 20

Basic I/O Functions

Example: Control the 7 segment Leds (Cont’d)

Trang 21

Basic I/O Functions

Example: Control Led Matrix and LCD

RD5

SW17 NUT F

RD3

R2 1K

SW13 NUT B

RD4

SW3 NUT 1

SW15 NUT D

SW14 NUTC

SW8 NUT6

RD0

C1 22p

RD1

R6 R

RESET

C2 22p

D6

R3 1K

33 35 37 39

15 17 23 25

19 21 27 29

13

14

32 31

1

8 10

RA0/AN0 RA2/AN2/VREF-/CVREF RA3/AN3/VREF+

RA4/T0CKI/C1OUT RA5/AN4/SS*/C2OUT

RB0/INT RB1 RB3/PGM RB4 RB6/PGC

RC0/T1OSO/T1CKI RC1/T1OSI/CCP2 RC2/CCP1 RC3/SCK/SCL RC4/SDI/SDA RC5/SDO RC6/TX/CK RC7/RX/DT

RD0/PSP0 RD2/PSP2 RD4/PSP4 RD6/PSP6

OSC1/CLKIN

OSC2/CLKOUT

VDD VSS

MCLR*/VPP

RE0/RD*/AN5 RE1/WR*/AN6 RE2/CS*/AN7

SW4 NUT 2

SW10 NUT 8

R12 Chinh do sang

RD3

OSC2

RD0

SW11 NUT 9

R4 R

0

D2 LED

SW12 NUT A

RD7

Y 1 20MHz

SW16 NUT E

Vcc OSC2

D3

SW2 NUT 0

SW9 NUT 7

D1 LED

0

R8 R

Trang 22

Basic I/O Functions

Example: Control Led Matrix and LCD (Cont’d)

•LCD code table

Trang 24

Basic I/O Functions

Example: Control Led Matrix and LCD (Cont’d)

portd = 0B11111110;

delay_ms(1);

if(input(pin_d4)==0){

Trang 25

portB = 0x37;

du_lieu();

delay_ms(1);

while(input(pin_d7)==0);}

Trang 26

Basic I/O Functions

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

TỪ KHÓA LIÊN QUAN

w