Smart
Member level 4
I need complete schematic and code for a microcontroller which has a link with a pc via RS-232, and pc send a command for microcontroller to control 2 pcs of 24 volt relay.
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
#INCLUDE "8051EQU.INC"
; RESET ;reset routine
.ORG 0H ;locate routine at 00H
AJMP START ;jump to START
;
;**************************************************************************
;
; INTERRUPTS (not used) ;place interrupt routines at appropriate
;memory locations
.ORG 03H ;external interrupt 0
RETI
.ORG 0BH ;timer 0 interrupt
RETI
.ORG 13H ;external interrupt 1
RETI
.ORG 1BH ;timer 1 interrupt
RETI
.ORG 23H ;serial port interrupt
RETI
.ORG 25H ;locate beginning of rest of program
;
;**************************************************************************
;
INITIALIZE: ;set up control registers
;
MOV TCON,#00H
MOV TMOD,#00H
MOV PSW,#00H
MOV IE,#00H ;disable interrupts
MOV P1,#0FCH
RET
;**************************************************************************
;
START: ;main program (on power up, program starts at this point)
ACALL INITIALIZE ;set up control registers
MOV TMOD,#20H
MOV TCON,#41H
MOV TH1,#0FDH
MOV SCON,#50H
ACALL DELAY1S
CLR TI
MOV SBUF,#'1'
JNB TI,$
CLR TI
MOV SBUF,#'2'
JNB TI,$
CLR TI
MOV SBUF,#'3'
JNB TI,$
CLR TI
end.