|
ORG 0000H
;
Defind value setting for Timer in using genarate Baud Rate in transfer data.
MOV IE,#00000000B
MOV
TMOD,#00100000
MOV TL1#,0FDH
MOV TH1,#0FDH
;
Defind value setting for SCON Register that select mode 1 and receive data setting to REN=1
MOV
SCON,#01010000B
SETB TR1
MOV P0,#00000000B ;;
Set value to parallet port P0 all bit is 0
Start to Main Program
INDEX:
ACALL SUB_RXD ;
Get data from Serial Port which sent from PC
ACALL
LEDOFF
; Function for command to microcontroller in send value to defined port is off all bit
ACALL LED1
; Function for command to microcontroller in send value to defined port P0.0
ACALL LED2
;Function for command to microcontroller in send value to defined port P0.1
ACALL LED3
;Function for command to microcontroller in send value to defined port P0.2
ACALL LED4
;
Function for command to microcontroller in send value to defined port P0.3
ACALL LED5
;
Function for command to microcontroller in send value to defined port P0.4
ACALL LED6
;
Function for command to microcontroller in send value to defined port P0.5
ACALL LED7
;
Function for command to microcontroller in send value to defined port P0.6
SJMP INDEX
;Goto Main Program
;
Function for receive data from Serial Port
RXD :
JNB RI,$
CLR RI
MOV A,SBUF
RET
LEDOFF: CJNE
A,#30H,NEXT
;Compare condition ,If it is TRUE then to do next step.
MOV
P0,#00000000B ;
Will be send value from parallel port P0 to off all LED.
ACALL SUB_TXD
;
Go to step in sent data to PC ,If it has command completed.
SJMP INDEX
; GoTo Main Program
; Function for control LED2-LED7 in display that data sending will be parallel singal.
LED1:
CJNE A,#31H,NEXT
;
Compare condition ,If it is TRUE then to do next step.
; This will be send value to parallel port number P0.0 which is going to convert value from 0 to 1
that LED1 On and convert 1 to 0 LED off.
CPL
P0.0
; Boolean command = Not using control bit status of ports.
ACALL SUB_TXD
;
Goto step in PC sending data which can know command completed.
SJMP INDEX
;Goto main program
; Function for control LED2-LED7 in display that data sending will be parallel singal.
LED2:
CJNE A,#32H,NEXT
CPL P0.1
ACALL SUB_TXD
SJMP INDEX
LED3:
CJNE A,#33H,NEXT
CPL P0.2
ACALL SUB_TXD
SJMP INDEX
LED4:
CJNE A,#34H,NEXT
CPL P0.3
ACALL SUB_TXD
SJMP INDEX
LED5:
CJNE A,#35H,NEXT
CPL P0.4
ACALL SUB_TXD
SJMP INDEX
LED6:
CJNE A,#36H,NEXT
CPL P0.5
ACALL SUB_TXD
SJMP INDEX
LED7:
CJNE A,#37H,NEXT
CPL P0.6
ACALL SUB_TXD
SJMP INDEX
NEXT:
RET
;
Function data sending to Serial Port for talk to PC program get command completed
TXD
: MOV SBUF,#43
JNB TI,$
CLR TI
RET
END
|