Skip to content

Instantly share code, notes, and snippets.

@abdul-rehman-2050
Created March 14, 2018 14:47
Show Gist options
  • Save abdul-rehman-2050/659763893066f60f35b0be7eaa109e1f to your computer and use it in GitHub Desktop.
Save abdul-rehman-2050/659763893066f60f35b0be7eaa109e1f to your computer and use it in GitHub Desktop.
Controlling LEDs or devices via UART in 8051 architecture using Assembly Language
:10000000758920758DFD759852D28EC2A2C2A0C28C
:10001000A17448114674451146744C1146744C1134
:100020004674301146740D1146740A1146114E1172
:1000300046B45204B2A080F5B45904B2A180EEB423
:1000400047EBB2A280E73099FDC299F5992230982A
:06005000FDC298E59922B3
:00000001FF
LED_RED BIT P2.0
LED_GRE BIT P2.2
LED_YEL BIT P2.1
ORG 0H
MOV TMOD,#20H ;TIMER 1 , MODE 2
MOV TH1,#-3 ;9600 BAUD RATE @11.059MHZ
MOV SCON,#52H ;8-BIT , 1 STOP , REN ENABLED
SETB TR1 ;START TIMER 1
;R,Y,G
MAIN:
CLR LED_GRE
CLR LED_RED
CLR LED_YEL
MOV A,#'H'
ACALL TX
MOV A,#'E'
ACALL TX
MOV A,#'L'
ACALL TX
MOV A,#'L'
ACALL TX
MOV A,#'0'
ACALL TX
MOV A,#13
ACALL TX
MOV A,#10
ACALL TX
ML1:
ACALL RX
ACALL TX
CJNE A,#'R',COMP_Y
CPL LED_RED
SJMP ML1
COMP_Y:
CJNE A,#'Y',COMP_G
CPL LED_YEL
SJMP ML1
COMP_G:
CJNE A,#'G',ML1
CPL LED_GRE
SJMP ML1
;======== SERIAL DATA TRANSMIT ==================
TX: JNB TI,$
CLR TI
MOV SBUF,A
RET
;======== SERIAL DATA RECEIVE ==================
RX: JNB RI,$
CLR RI
MOV A,SBUF
RET
END
@sanchari1980
Copy link

sir,
plz send me the8051 circuit diagram and asm program for display data by 7segment display. data through serial port

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment