1 / 33

A Design Example

A Design Example. A Programmable Calculator. Programmable Calculator. Working in Exact Mode Receiving Program from RS232 Port Saving Programs using RS232 Port Memory Fill/View/Edit/Search Switch to floating point calculator Using DMA for Large Data Transfer. Hardware Specifications.

julianj
Download Presentation

A Design Example

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. A Design Example A Programmable Calculator

  2. Programmable Calculator • Working in Exact Mode • Receiving Program from RS232 Port • Saving Programs using RS232 Port • Memory Fill/View/Edit/Search • Switch to floating point calculator • Using DMA for Large Data Transfer

  3. Hardware Specifications • Keyboard with 64 (8x8) Keys • 8 Seven-Segment Display • Timer Options: hh – mm – ss • 8087 Coprocessor  Maximum Mode • DMA 8237 for Fast Data Transfer • UART 8250 for RS232 Port • RAM (00000-7FFFF) – EPROM (80000-FFFFF) • Clock = 115200*16*4=7372800 Hz =7.3728MHz

  4. BHE/S7 MN/MX RD LOCK TEST CPU Pins in Maximum Mode GND 1 40 VCC AD14 2 39 AD15 AD13 3 38 A16/S3 AD12 4 37 A17/S4 AD11 5 36 A18/S5 AD10 6 35 A19/S6 AD9 7 34 GND AD8 8 8086 33 AD7 9 32 AD6 10 31 RQ/GT0 AD5 11 30 RQ/GT1 AD4 12 29 AD3 13 28 S2 AD2 14 27 S1 AD1 15 26 S0 AD0 16 25 QS0 NMI 17 24 QS1 INTR 18 23 CLK 19 22 READY GND 20 21 RESET Max Mode

  5. S0, S1 and S2 Signals

  6. 8086 System Maximum Mode

  7. 8284 Clock Generator for 8086 an 18-pin chip • specially designed to be used with 8088/86 microprocessors, • It provides the clock and synchronization for the microprocessor, • also provides the READY signal for the insertion of wait states into the CPU bus cycle.

  8. 7.3728MHz 22.1184MHz

  9. Bank Write and Bank Read Control Logic 2 EPROMs Each 256KB = 256Kx8 = Eight 27512 or 28512 2 SRAMs Each 256KB = 256Kx8 = Eight 62512 or 61512 Total 1M A0 A0 Bank Read Control Logic Bank Write Control Logic

  10. D0 - D7 SRAMs A1-A16 A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15 D0 D1 D2 D3 D4 D5 D6 D7 CS OE WE A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15 D0 D1 D2 D3 D4 D5 D6 D7 CS OE WE A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15 D0 D1 D2 D3 D4 D5 D6 D7 CS OE WE Y0 Y1 Y2 Y3 Y4 Y5 Y6 Y7 A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15 A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15 A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15 A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15 A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15 D0 D1 D2 D3 D4 D5 D6 D7 CS OE WE D0 D1 D2 D3 D4 D5 D6 D7 CS OE WE D0 D1 D2 D3 D4 D5 D6 D7 CS OE WE D0 D1 D2 D3 D4 D5 D6 D7 CS OE WE D0 D1 D2 D3 D4 D5 D6 D7 CS OE WE A17 A18 A19 A0 A1 A2 G1 G2 RDL RDL RDL RDU WRL WRL WRL WRL A0 DEN D8 - D15 A1-A16 Y0 Y1 Y2 Y3 Y4 Y5 Y6 Y7 A17 A18 A19 A0 A1 A2 G1 G2 RDU RDU RDU RDU WRU WRU WRU WRU BHE DEN

  11. D0 - D7 EPROMs A1-A16 A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15 D0 D1 D2 D3 D4 D5 D6 D7 CS OE A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15 D0 D1 D2 D3 D4 D5 D6 D7 CS OE A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15 D0 D1 D2 D3 D4 D5 D6 D7 CS OE A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15 D0 D1 D2 D3 D4 D5 D6 D7 CS OE Y0 Y1 Y2 Y3 Y4 Y5 Y6 Y7 A17 A18 A19 A0 A1 A2 G1 G2 RDL RDL RDL RDL A0 DEN D8 - D15 A1-A16 A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15 D0 D1 D2 D3 D4 D5 D6 D7 CS OE A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15 D0 D1 D2 D3 D4 D5 D6 D7 CS OE A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15 D0 D1 D2 D3 D4 D5 D6 D7 CS OE A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15 D0 D1 D2 D3 D4 D5 D6 D7 CS OE Y0 Y1 Y2 Y3 Y4 Y5 Y6 Y7 A17 A18 A19 A0 A1 A2 G1 G2 RDU RDU RDU RDU BHE DEN

  12. Peripherals • 8255 (Keyboard) • 8255 (Display) • Timer 8254 • 8259 Interrupt Controller • DMA 8237 • Coprocessor 8087 • UART 8250

  13. Address Decoding for the Peripherals Buffer D0-D7 8255A PPI 8086 A0 A1 A2 A3 A4 A5 A6 A7 Latch (‘373) Keyboard Y0 Y1 Y2 Y3 Y4 Y5 Y6 Y7 A0 A1 AD0-AD7 Timer X0 X1 X2 Display CS UART 8259 8259 DMA ALE • Keyboard Address: 000XXPP0 • Timer Address: 010XXPP0 • Display Address: 011XXPP0 • UART Address: 101XPPP0 • Address: 110XXXP0 • DMA Address: 111PPPP0 A0 IR0 IR1 CS

  14. Address Definition • Keyboard_BASE EQU 0 • Display_BASE EQU 60H • Timer_BASE EQU 40H • UART_BASE EQU 0A0H • DMA_BASE EQU 0E0H • 8259_BASE EQU 0C0H

  15. Connecting 8087 to Processor

  16. 8250/16450/16550 UART Connection A0 A2 A4 A6 A8 AA AC AD A0 A2 A3 A2 A1 (System) A2 A1 A0 (UART) Y5 (Decoder)  CS 101XPPP0 Line Drivers  RS232 io

  17. Registers • Transmitter holding register • Receiver buffer register • Interrupt enable register 00001111  A2

  18. Registers • Interrupt identification register 00000PPP  A4

  19. Line Control 00011111  A6 Even Parity, 2 Stop bits, 8 Data bits

  20. Modem Registers Modem Control Register 00000001  A8 DTR Active Modem Status Register status  AD

  21. Line Status Status  AA

  22. Divisor Register Input Clock : 7.3728MHz  Required Baud Rate: 9600 bps 10000000  A6 DLAB Set 0011 0000  A0 0  A2

  23. Intel Hex Data Format • : No – Address – Data – Check Sum • :0A 00400 56 78 F6 00 80 80 6C 40 03 02 75 • 56 + 78 + F6 + 80 + 80 + 6C + 40 + 3 + 2 = 375

  24. Commands From RS232 • Upload Data • Download Data • Dump Memory • Fill Memory • Go To Address • Breakpoint • Trace • Register …

  25. Definitions • DISPLAY_SEGMENTS EQU Display_BASE • DISPLAY_GND EQU Display_BASE +2 • DISPLAY_CTRL EQU Display_BASE+ 6 • KEYBOARD_ROW EQU Keyboard_BASE • KEYBOARD_COL EQU Keyboard_BASE+2 • KEYBOARD_CTRL EQU Keyboard_BASE+6 • TIMER_CH0 EQU Timer_BASE • TIMER_CH1 EQU Timer_BASE+2 • TIMER_CH2 EQU Timer_BASE+4 • TIMER_CTRL EQU Timer_BASE+6 • IC8259_0 EQU 8259_BASE • IC8259_1 EQU 8259_BASE+2

  26. Main Program ORG 0FFF0H ;Address FFFF0 • XOR AX,AX ;AX=0 • MOV DS,AX ;DS=0 • MOV AH,70H ;AX=7000H • MOV SS,AX ;STACK From 7FFFFH • MOV SP,0FFFFH ; SS*10H+SP=7FFFFH • JMP 0F000H:100

  27. Initialize & Main LOOP ORG 100H ;Address F0100 • CLI • CALL INIT_KEYBOARD • CALL INIT_DISPLAY • CALL INIT_TIMER • CALL INIT_8259 • CALL INIT_DMA • CALL INIT_RS232 • STI • Main_LOOP: • CALL Keyboard_hit • JZ RS232 • CALL GETCH ;Scan Code Available in AL • CALL Process_Key • RS232: • CALL RX_AVAILABLE • JZ Main_LOOP • CALL Process_RX • JMP Main_LOOP

  28. INIT_KEYBOARD • INIT_KEYBOARD: • MOV AL,00001011B ;Mode0 output for A & • ;Mode 0 input for B input for C • OUT KEYBOARD_CTRL,AL • MOV AL,0FFH ;OFF All Rows • OUT KEYBOARD_ROW,AL • XOR AL,AL ;Reset FIFO • MOV [Key_head],AL • MOV [Key_tail],AL • RET

  29. INIT_DISPLAY • INIT_DISPLAY: • MOV AL,00001001B ;Mode 0 and out for both A & B. C input • OUT DISPLAY_CTRL,AL • MOV AL,0FFH • OUT DISPLAY_GND,AL ;All 7-Segments off • XOR AX,AX ;Clear ALL Ms of Calc(X,Y,M0-M7) • MOV ES,AX • MOV DI,offset X_SIZE • CLD • MOV CX,10 • REP:STOSW ;X_SIZE=Y_SIZE=M_SIZE0-7=0 • CALL REFRESH_DISPLAY • RET

  30. REFRESH_DISPLAY • REFRESH_DISPLAY: ; Shows the content of X register • MOV DI,offset DISPLAY_DATA • MOV AX,[X_SIZE] • CMP AX,0 • JNE X_NOT_ZERO • XOR AX,AX • MOV WORD PTR [DI],AX • MOV WORD PTR [DI+2],AX • MOV WORD PTR [DI+4],AX • MOV BYTE PTR [DI+6],AL • MOV BYTE PTR [DI+7],10111111B • RET

  31. INIT_TIMER • INIT_TIMER: • MOV AL,00110110B ;Counter 0, 2 Bytes, Mode 3, Binary • OUT TIMER_CTRL,AL • MOV AX,36864 ;7.3728M/36864=200Hz; Refreshing Rate • OUT TIMER_CH0,AL • MOV AL,AH • OUT TIMER_CH0,AL • MOV AL,01110111B ;Counter 1, 2 Bytes, Mode 3, BCD • OUT TIMER_CTRL,AL • MOV AX,200H ;200Hz/200=1Hz; Time Refresh Rate • OUT TIMER_CH1,AL • MOV AL,AH • OUT TIMER_CH1,AL • RET

  32. INIT_8259 • INIT_8259: • MOV AL,00010011B ;ICW1: Edge - Single - ICW4 • OUT IC8259_0,AL • MOV AL,80H ; ICW2=Interupt Type • OUT IC8259_1,AL • MOV AL,00000001B ;ICW4: 8086 Processor • RET

  33. INIT_RS232 • INIT_RS232:

More Related