Free Electronic Circuits & 8085 projects

Electronic projects with circuit diagram and 8085 microprocessor projects.

Interfacing of 4×4 matrix keyboard and 4 digit 7 segment display

Statement: Interface 4 x 4 matrix keyboard and 4 digit 7-segment display and write an tssembly language program to read keycode of the pressed key and display same key on the 7 segment display.

HARDWARE FOR 4×4 MATRIX KEYBOARD & 4 DIGIT 7 SEGMENT DISPLAY INTERFACE

Fig. shows interfacing diagram. Here, 4 scan lines are sufficient to scan matrix keyboard and to select display digits. Hence decoded mode is used.

77.a-Interfacing of 4x4 matrix keyboard and 4 digit 7 segment displaySOFTWARE FOR 4×4 MATRIX KEYBOARD & 4 DIGIT 7 SEGMENT DISPLAY INTERFACE

To display 1 to 8 numbers on the eight 7-segment digits we have to load 7-segment codes for 1 to 8 numbers in the corresponding display locations.

  The three steps needed to write the software are:

Step 1: Find keyboard/display command word.

77.b-Interfacing of 4x4 matrix keyboard and 4 digit 7 segment display

Step 2: Find program clock command word

77.c-Interfacing of 4x4 matrix keyboard and 4 digit 7 segment display

Step 3: Find Read FIFO/sensor RAM command word.

77.d-Interfacing of 4x4 matrix keyboard and 4 digit 7 segment display

Step 4: Find Write FIFO RAM command word.

77.e-Interfacing of 4x4 matrix keyboard and 4 digit 7 segment display

Source program:

  • MVI A, 00H : Initialize keyboard/display in encoded
  • OUT 81H : scan keyboard 2 key lockout mode
  • MVI A, 34H
  • OUT 81H : Initialize pre-scalar count
  • MVI A, 0BH : Load mask pattern to enable RST 7.5
  • SIM : mask other interrupts
  • EI : Enable Interrupt
  • HERE: JMP HERE : Wait for the interrupt

Interrupt service routine:

  • MVI A, 40H : Initialize 8279 in read FIFO RAM mode
  • OUT 81H
  • IN 80H : Get keycode
  • MVI H, 62H : Initialize memory pointer to point
  • MOV L, A : 7-Segment code
  • MVI A, 80H : Initialize 8279 in write display RAM mode
  • OUT 81H
  • MOV A, M : Get the 7 segment code
  • OUT 80H : Write 7-segment code in display RAM
  • EI : Enable interrupt
  • RET : Return to main program

Flowchart for Source Program and Interrupt Service Routine

77.f-Interfacing of 4x4 matrix keyboard and 4 digit 7 segment display

 Related Programs (Click down)

Generate and display BCD up counter with frequency 1Hz

Generate and display BCD down counter

Generate and display the contents of decimal counter

Debug the delay routine