GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - mohsen-norouzi237/8086-keypad-ram-7segment: 8086 microprocessor lab (Proteus + emu8086): read digits from a 3×4 keypad, store them in external RAM, and replay them on a 7-segment display via an 8255A PPI — in two versions, a simple prototype and a full 8K×16 RAM / 32K×16 ROM design.

BranchesTags
Open more actions menu

Latest commit

 

History

2 Commits
2 Commits

Folders and files

NameName
Last commit message
Last commit date
v1
v1
 
 
v2
v2
 
 
LICENSE
LICENSE
 
 
README.fa.md
README.fa.md
 
 
README.md
README.md
 
 
gitignore
gitignore
 
 

Repository files navigation

8086 Keypad → RAM → 7-Segment Display (Proteus + emu8086)

Two implementations of the same microprocessor-lab project on an Intel 8086 (minimum mode): read digits from a 3×4 matrix keypad, store them in external RAM, and play them back on a 7-segment display (via a BCD→7-seg table kept in external ROM) using an 8255A PPI. Simulated in Proteus, assembled with emu8086.

Type digits → appended into RAM. Press * → shows the next stored digit (cycles through them in order). Press # → clears everything.


📸 Demo & Screenshots

Version 1

Demo (GIF) Schematic
v1 demo v1 schematic

Version 2

Demo (GIF) Schematic
v2 demo v2 schematic

📦 Two versions in this repo

Version 1 — version-1/ Version 2 — version-2/
Goal Simplified proof-of-concept Full assignment-compliant design
RAM 1× 6116 (2K×8) 8× 6116 → 8K×16, even/odd banks, 40000H–43FFFH
ROM 1× 2764 (8K×8) 8× 2764 → 32K×16, even/odd banks, F0000H–FFFFFH
Address latch 74LS373 74273
Chip-select decode 8-input NAND + inverters 74LS139 read/write bank decoders + NAND
Program loading #MAKE_BIN#, ORG 0000h, boots from external ROM Proteus Cheat Mode (Internal Memory = 0x10000), #MAKE_COM#, ORG 100h (CS=0x10, IP=0)
CPU clock 5 MHz 1 MHz
Segment setup ES = RAM/ROM as needed DS = SS = 0, SP = 0FFFEh
Key fixes latched address to decoder; first-write-lost → priming / write-verify; even-bank ×2 stack-segment crash (use SS=0); keypad pull-up logic contention

Shared by both: 8086 minimum mode · 8255A PPI · 3×4 keypad (rows → Port A, columns → Port C, active-low) · 7-seg → Port B · Control Word 81h · same 7-seg table · same behavior (store digits, * shows next cyclically, # clears).


🧩 Hardware / Components (shared)

Part Role
Intel 8086 (min mode) CPU
8255A PPI Keypad + display I/O
6116 SRAM Stores entered digits
2764 EPROM BCD→7-seg lookup table
Address latches (74LS373 / 74273) De-multiplex the address bus
74LS245 Data bus transceiver
NAND / inverters / 74LS139 Address decoding
3×4 matrix keypad + 10k pull-ups Digit input (1–9, *, 0, #)
Common-cathode 7-segment + resistors Display
Clock generator 5 MHz (v1) / 1 MHz (v2)

🗺️ Memory & I/O Map

8255 ports (both versions)

Port Address Direction Use
Port A 80h Output Keypad rows (PA0–PA3), active-low scan
Port B 82h Output 7-segment segments
Port C 84h Input (low 3 bits) Keypad columns (PC0–PC2), pull-ups
CWR 86h — Control word = 81h

Memory (Version 2, full spec)

Device Range Capacity Chips
RAM 40000H–43FFFH 8K×16 8× 6116 (4 even + 4 odd)
ROM F0000H–FFFFFH 32K×16 8× 2764 (4 even + 4 odd)

(Version 1 uses a single 6116 at segment 4000h and a single 2764 at segment F000h.)

7-segment table (common cathode) — stored in ROM cells 0–9:

3F 06 5B 4F 66 6D 7D 07 7F 6F   ; 0 1 2 3 4 5 6 7 8 9

⚙️ How It Works (both versions)

  1. Init – configure the 8255 (81h) and set up segments/pointers.
  2. Keypad scan (GET_KEY) – drive one row low at a time on Port A, read the 3 columns on Port C (active-low with pull-ups), map (row,col) → key value via a KEYMAP table, with debounce and wait-for-release so each press registers once.
  3. Store – a digit is appended to RAM at index×2 (even bank).
  4. Show next (*) – read the next stored digit, look up its 7-seg pattern in ROM (digit×2), drive it to Port B; the read index wraps back to the start after the last digit.
  5. Clear (#) – reset the counters and blank the display.

Even-bank addressing

Device A0 ← CPU A1, so every cell sits at an even CPU offset → multiply each index by 2 (SHL BX,1).


▶️ How to Run

Version 1 (version-1/)

  1. emu8086: assemble main.asm (#MAKE_BIN#, ORG 0000h) → main.bin; build the ROM table → seg_table.bin.
  2. Proteus: 8086 → Program File = main.bin; EPROM (U20) → Image File = seg_table.bin.
  3. Clock = 5 MHz → Play.

Version 2 (version-2/)

  1. emu8086: assemble main.asm (#MAKE_COM#, ORG 100h).
  2. Proteus Cheat Mode: set the 8086's Internal Memory Size = 0x10000; the program loads at physical 0x100 (CS=0x10, IP=0).
  3. Build rom.bin (#MAKE_BIN#, non-interleaved) and load it into the ROM chips with File Address Shift = 0 (same content in all 8 chips).
  4. Clock = 1 MHz → Play.

Quick test: type 7, 2, 5 (nothing shows — stored only); press * → 7, * → 2, * → 5, * → back to 7 …; # clears and blanks the display.


📁 Repository Structure

.
├── version-1/          # simplified single-chip prototype
│   ├── src/            # main.asm (#MAKE_BIN#), seg_table.asm
│   ├── bin/            # main.bin, seg_table.bin
│   ├── proteus/        # .pdsprj
│   └── docs/           # schematic + demo
├── version-2/          # full 8K×16 RAM + 32K×16 ROM (Cheat Mode)
│   ├── src/            # main.asm (#MAKE_COM#), rom.asm (#MAKE_BIN#)
│   ├── bin/            # main.com/.bin, rom.bin
│   ├── proteus/        # .pdsprj
│   └── docs/           # schematic + demo
├── README.md           # English (this file)
├── README.fa.md        # فارسی
├── LICENSE
└── .gitignore

🐞 Troubleshooting / Lessons Learned

Both versions

  • Keypad polarity: rows = Port A (output), columns = Port C (input) with 10k pull-ups → active-low (idle columns read 111, a pressed key reads 0). Wrong pull wiring causes logic contention on key press and a stuck wait-for-release loop (nothing displays).
  • Even-bank addressing: multiply every RAM/ROM index by 2.

Version 1 specifics

  • Chip-select decoders must use the latched upper address bits (AA16–AA19), not the raw multiplexed pins, or RAM writes silently fail.
  • The first memory write in Proteus is dropped → use a priming dummy write and/or a write-and-verify loop so no digit is lost.

Version 2 specifics

  • Cheat-Mode stack crash: do not set SS = CS (CS=0x10 puts the stack outside the internal 64K). Use XOR AX,AX / MOV DS,AX / MOV SS,AX / MOV SP,0FFFEh so DS = SS = 0.
  • Undriven clock (UNDRIVEN: U1,CLK) → attach a 1 MHz clock to pin 19.
  • Startup messages like CTRLW SET TO 9B and WARNING: VDD connected to VCC are harmless.

🚀 Possible Improvements

  • Multi-digit multiplexed display instead of a single 7-segment.
  • Show the whole stored sequence with auto-scroll.
  • Add a backspace key and RAM-buffer overflow protection.

📝 License

Released under the MIT License — free to use for learning. See LICENSE.

👤 Author

Mohsen Norouzi

  • GitHub: @mohsen-norouzi237
  • Email: [email protected]
  • LinkedIn: mohsen-norouzi

Built as a microprocessors course project (8086 + Proteus + emu8086).

About

8086 microprocessor lab (Proteus + emu8086): read digits from a 3×4 keypad, store them in external RAM, and replay them on a 7-segment display via an 8255A PPI — in two versions, a simple prototype and a full 8K×16 RAM / 32K×16 ROM design.

Topics

80868255aassemblycomputer-architecturedigital-logicembedded-systemsemu8086epromhardwarekeypadmicroprocessorppiproteusproteus-simulationseven-segments-displaysramuniversity-projectx86-assembly

Resources

Readme
MIT license
Activity

Stars

7 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.