8051 microcontroller programming: Interfacing with push button and displaying the button pressed using Keil

Displaying the number of the corresponding push button pressed on a seven segment display.
This a good practice program.
PROGRAM:
  ORG 00H
BACK: JNB P1.0,ZERO
  JNB P1.1,ONE
  JNB P1.2,TWO
  JNB P1.3,THREE
  JNB P1.4,FOUR
  JNB P1.5,FIVE
  JNB P1.6,SIX
  JNB P1.7,SEVEN
  SJMP BACK
ZERO: MOV P2,#0C0H
  SJMP BACK
ONE: MOV P2,#0F9H
  SJMP BACK
TWO: MOV P2,#0A4H
  SJMP BACK
THREE: MOV P2,#0B0H
  SJMP BACK
FOUR: MOV P2,#99H
  SJMP BACK
FIVE: MOV P2,#92H
  SJMP BACK
SIX: MOV P2,#82H
  SJMP BACK
SEVEN: MOV P2,#0F8H
  SJMP BACK
  END

Comments

Popular posts from this blog

8051 microcontroller programming:Tutorial-Fibonacci series in assembly with Keil