Presentation is loading. Please wait.

Presentation is loading. Please wait.

Read Chapter 3 (David E. Simon, An Embedded Software Primer)

Similar presentations


Presentation on theme: "Read Chapter 3 (David E. Simon, An Embedded Software Primer)"— Presentation transcript:

1 Read Chapter 3 (David E. Simon, An Embedded Software Primer)
mP Based Systems Read Chapter 3 (David E. Simon, An Embedded Software Primer)

2 Embedded Systems Development Introduction Saâd Biaz
mP Based Systems mP based system Address Bus mP Digital outputs (parallel port) LED Memory System I/O Digital inputs (parallel input) Switch Serial port Analog input/output Temperature Sensor Data Bus Storage Embedded Systems Development Introduction Saâd Biaz (4/17/2017)

3 Embedded Systems Development Introduction Saâd Biaz
Memory and I/O mapping Consider an 8-bit mP (imaginary) with a 6-bit address bus. First instruction to execute (after power on) is at address 48. We have: 16B ROM components (16 x 1B) 16B RAM components (16 x 1B) We plan to ¼ of the memory with ROM, ½ of the memory in RAM, and ¼ I/O Embedded Systems Development Introduction Saâd Biaz (4/17/2017)

4 Memory and I/O mapping (2)
Let us map our address space What is the address range for the ROM space? What is the address range for the RAM space? What is the address range for the I/O space A5A4A3A2A1A0 = 0 = 15 26=64 I/O = 16 = 31 RAM 1 RAM 2 = 32 = 47 = 48 = 63 ROM Embedded Systems Development Introduction Saâd Biaz (4/17/2017)

5 Memory and I/O mapping (3)
1) What is the size of the address space? 2) What is the size of the address bus for the ROM and RAM components? mP Address Bus Data Bus 6 8 A3 A0 16B RAM D0 D7 16B ROM D0 D7 A3 A0 Embedded Systems Development Introduction Saâd Biaz (4/17/2017)

6 Embedded Systems Development Introduction Saâd Biaz
Memory Wiring A5A4 = 01 A5A4 = 10 A5A4 = 11 RAM A3 A0 D7-D0 R/W CS RAM A3 A0 D7-D0 R/W CS ROM A3 A0 D7-D0 R/W CS Address Bus 8 A3 A0 A4 A5 mP Data Bus D7-D0 R/W Embedded Systems Development Introduction Saâd Biaz (4/17/2017)

7 Embedded Systems Development Introduction Saâd Biaz
Input (switch) Wiring How to interface a switch? First, choose the address where to map the switch Second, build a circuit that connects the swich to data bus only when associated address is given by mP. VCC RAM A3 A0 D7-D0 R/W CS RAM A3 A0 D7-D0 R/W CS ROM A3 A0 D7-D0 R/W CS Address Bus 8 A3 A0 A4 A5 mP Data Bus D7-D0 R/W Embedded Systems Development Introduction Saâd Biaz (4/17/2017)

8 Embedded Systems Development Introduction Saâd Biaz
Input (switch) Wiring Let us choose the address 0 (bit D0) to map the switch A5A4A3A2A1A0 VCC RAM A3 A0 D7-D0 R/W CS RAM A3 A0 D7-D0 R/W CS ROM A3 A0 D7-D0 R/W CS Address Bus 8 A3 A0 A4 A5 mP Data Bus D7-D0 R/W D0 Embedded Systems Development Introduction Saâd Biaz (4/17/2017)

9 Embedded Systems Development Introduction Saâd Biaz
Output (LED) Wiring Exercise I : Interface a LED at address 1, data bus line D4 A5A4A3A2A1A0 RAM A3 A0 D7-D0 R/W CS RAM A3 A0 D7-D0 R/W CS ROM A3 A0 D7-D0 R/W CS Address Bus 8 A3 A0 A4 A5 mP Data Bus D7-D0 R/W D4 Embedded Systems Development Introduction Saâd Biaz (4/17/2017)

10 I/O: Device Controllers
The mP communicates with the device controller through registers accessible as if they are memory cells. Example: a device controller with 2m registers CS Chip R/W I/O Function Am-1 A0 D7-D0 Embedded Systems Development Introduction Saâd Biaz (4/17/2017)

11 Example of Device Controllers: Parallel I/O Port
Ports A, B, and C can be configured to be inputs or outputs. Configuration is made by writing in the 8-bit control register After configuration, ports A,B, or C can be read or written to as if they were memory cells. Intel 8255 8 CS RD WD A 8-bit Control Reg. B 8 A1 C 8 A0 D7-D0 Embedded Systems Development Introduction Saâd Biaz (4/17/2017)

12 Example of Device Controllers: UART or Serial I/O Port
The 8-bit configuration register is used to select the speed (110bps to 19200bps), parity check, number of bits per word, lentgh of stop bits. The mP writes to the data register the data to be sent serially on TX The mP reads from the data register data received serially on RX. CS Intel 8251 RD WD TX 8-bit Data Reg. RX 8-bit Config. Reg. A0 D7-D0 Embedded Systems Development Introduction Saâd Biaz (4/17/2017)

13 Example of Device Controllers: Timer
The mP initializes a counter Ci with some value. All counters are decremented at each tick of the clock input When the counter Ci reaches 0, an impulse is output on the corresponding output Oi. CS Intel 8253 RD WD O0 16-bit Counter 0 O1 16-bit Counter 1 CLK O2 16-bit Counter 2 A1 A0 D7-D0 8-bit Config. Reg. Embedded Systems Development Introduction Saâd Biaz (4/17/2017)

14 Direct Memory Access (DMA)
The idea is to transfer directly I/O stream to/from memory without using the CPU (long bus cycles) Reminder, to transfer a word from I/O to memory. The mP must: Fetch its “reading” instruction (IN AX,DX) Decode the instruction, execute it Fetch the “write” instruction Test if done (involves loops/jumps..etc) Embedded Systems Development Introduction Saâd Biaz (4/17/2017)

15 Direct Memory Access (DMA) (2)
Transfering CONTIGUOUS data can be made more efficiently: A counter is needed to generate increasing addresses and proper control signals to the memory. Embedded Systems Development Introduction Saâd Biaz (4/17/2017)

16 Direct Memory Access (DMA)
RAM mP Address/Control Bus Data Bus BusAck BusReq I/O DMA Controller DMAAck DMAReq Embedded Systems Development Introduction Saâd Biaz (4/17/2017)

17 Gluing a mP-based system
Decoding functions may require some components (especially if address bus very large 32 to 64 bits). PALs FGPAs Embedded Systems Development Introduction Saâd Biaz (4/17/2017)

18 Built-Ins on Microcontrollers
Address decoding Timers I/O DMA ADC-DAC (Analog-Digital Converter … ) Embedded Systems Development Introduction Saâd Biaz (4/17/2017)

19 mP Based Systems (Example: Microcontroller Rabbit 2000)
Read Chapter 1 and 2 (Rabbit Semiconductor, Rabbit 2000 Microprocessor User’s Manual)

20 Rabbit 2000 Characteristics
8-bit data bus 20-bit address bus (extensible) Software driven system clock 2 timers 40 bit parallel configurable I/O 4 serial ports 1 watchdog timer Embedded Systems Development Introduction Saâd Biaz (4/17/2017)

21 Rabbit 2000 Characteristics (2)
Embedded Systems Development Introduction Saâd Biaz (4/17/2017)

22 Embedded Systems Development Introduction Saâd Biaz
Rabbit 2000 System Clock Embedded Systems Development Introduction Saâd Biaz (4/17/2017)

23 Saving Power (By Software)
Add memory wait states Turn off clock doubler (if in use) Divide frequency by 8 (select f/8) Run code in RAM, not in flash Use for the CPU and peripheral clock the 32K oscillator (disable main oscillator) Embedded Systems Development Introduction Saâd Biaz (4/17/2017)

24 Embedded Systems Development Introduction Saâd Biaz
Timers RTC: 48-bit register driven by 32K Watchdog timer (0.25s, 0.5s, 1s, or 2s) Embedded Systems Development Introduction Saâd Biaz (4/17/2017)

25 Embedded Systems Development Introduction Saâd Biaz
Timers (2) Embedded Systems Development Introduction Saâd Biaz (4/17/2017)

26 Embedded Systems Development Introduction Saâd Biaz
Serial Communication Embedded Systems Development Introduction Saâd Biaz (4/17/2017)


Download ppt "Read Chapter 3 (David E. Simon, An Embedded Software Primer)"

Similar presentations


Ads by Google