Presentation is loading. Please wait.

Presentation is loading. Please wait.

A Design Example A Programmable Calculator. Programmable Calculator Working in Exact Mode Receiving Program from RS232 Port Saving Programs using RS232.

Similar presentations


Presentation on theme: "A Design Example A Programmable Calculator. Programmable Calculator Working in Exact Mode Receiving Program from RS232 Port Saving Programs using RS232."— 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 CPU Pins in Maximum Mode GND AD14 AD13 AD12 AD11 AD10 AD9 AD8 AD7 AD6 AD5 AD4 AD3 AD2 AD1 AD0 NMI INTR CLK GND VCC AD15 A16/S3 A17/S4 A18/S5 A19/S6 RQ/GT0 RQ/GT1 QS0 READY RESET BHE/S7 MN/MX RD LOCK S2 S1 S0 QS1 TEST 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 31 30 29 28 27 26 25 24 23 22 21 40 39 38 37 36 35 34 33 32 8086 Max Mode GND

5 S2S1S0 Characteristics 000 Interrupt acknowledge 001 Read I/O port 010 Write I/O port 011 Halt 100 Code access 101 Read memory 110 Write memory 111 Passive State 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 Bank Write Control Logic Bank Read Control Logic A0 2 EPROMs Each 256KB = 256Kx8 = Eight 27512 or 28512 2 SRAMs Each 256KB = 256Kx8 = Eight 62512 or 61512 Total 1M

10 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 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 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 D0 - D7 D8 - D15 A1-A16 Y0 Y1 Y2 Y3 Y4 Y5 Y6 Y7 A0 A1 A2 G1 G2 A17 A18 A19 A0 DEN Y0 Y1 Y2 Y3 Y4 Y5 Y6 Y7 A0 A1 A2 G1 G2 A17 A18 A19 BHE DEN RDL RDU RDL RDU WRL WRU WRL WRU WRL WRU SRAMs

11 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 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 D0 - D7 D8 - D15 A1-A16 Y0 Y1 Y2 Y3 Y4 Y5 Y6 Y7 A0 A1 A2 G1 G2 A17 A18 A19 A0 DEN Y0 Y1 Y2 Y3 Y4 Y5 Y6 Y7 A0 A1 A2 G1 G2 A17 A18 A19 BHE DEN RDL RDU RDL RDU RDL RDU EPROMs

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

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

14 Address Definition Keyboard_BASEEQU0 Display_BASEEQU60H Timer_BASEEQU40H UART_BASEEQU0A0H DMA_BASEEQU0E0H 8259_BASEEQU0C0H

15 Connecting 8087 to Processor

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

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 Modem Status Register 00000001  A8 DTR Active 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 Baud RateDivisor(Decimal)Divisor(hex) 460,80011 115,20044 57,60088 28,8001610 3840012C 192002418 96004830

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 EQUDisplay_BASE DISPLAY_GND EQUDisplay_BASE +2 DISPLAY_CTRL EQUDisplay_BASE+ 6 KEYBOARD_ROW EQUKeyboard_BASE KEYBOARD_COL EQUKeyboard_BASE+2 KEYBOARD_CTRL EQUKeyboard_BASE+6 TIMER_CH0 EQU Timer_BASE TIMER_CH1 EQUTimer_BASE+2 TIMER_CH2 EQUTimer_BASE+4 TIMER_CTRL EQUTimer_BASE+6 IC8259_0 EQU8259_BASE IC8259_1 EQU8259_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_KEYBOARDINIT_KEYBOARD CALL INIT_DISPLAYINIT_DISPLAY CALL INIT_TIMERINIT_TIMER CALL INIT_8259INIT_8259 CALLINIT_DMA CALLINIT_RS232 STI Main_LOOP: CALLKeyboard_hit JZRS232 CALLGETCH ;Scan Code Available in AL CALL Process_Key RS232: CALLRX_AVAILABLE JZMain_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 OUTKEYBOARD_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_DISPLAYREFRESH_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:


Download ppt "A Design Example A Programmable Calculator. Programmable Calculator Working in Exact Mode Receiving Program from RS232 Port Saving Programs using RS232."

Similar presentations


Ads by Google