Thursday, March 14, 2013

Application Schematic Diagram and Source Code of AT89S51 for ON/OFF LED using Port Parallel

Robometricschool. - In this time we will present to you about some application of microcontroller AT89S51 for turn on and turn off LED that using port parallel. We will provide you schematic diagram and also source code using assembly programming of MCS-51 that you can use to practice your self to try this application.

Application Schematic Diagram AT89S51

Figure 1. AT89S51 for LED Application Schematic Diagram

Source Code with Assembly Programming

  • First Program for Flip-Flop Application
;----------------------------------------------------------------------------------
; FLIP-FLOP using port 2
;----------------------------------------------------------------------------------
                           ORG 0H
START:              MOV P2,#00001111B
                            CALL DELAY
                            MOV P2,#11110000B
                            CALL DELAY
                            SJMP START
DELAY:              MOV R0,#0FFH
DELAY1:            MOV R1,#0FFH
DELAY2:            DJNZ R1,DELAY2
                            DJNZ R0,DELAY1
                            RET
END
;------------------------------------------------------------------------------------

  • Second Program for Rotate LED to the LEFT and to the RIGHT
;----------------------------------------------------------------------------------
; Rotate LED to the LEFT and to the RIGHT
;----------------------------------------------------------------------------------
                           ORG 0H
                           MOV A,#0FEH
START1:           MOV P2,A
                           CALL DELAY
                           RL A
                           CJNE A,#07FH,START1
START2:           MOV P2,A
                           CALL DELAY
                           RR A
                           CJNE A,#0FEH,START2
                           SJMP START1
DELAY:              MOV R0,#0FFH
DELAY1:            MOV R1,#0FFH
DELAY2:            DJNZ R1,DELAY2
                            DJNZ R0,DELAY1
                            RET
END
;------------------------------------------------------------------------------------

Note:
We only give you two source codes for AT89S51 for ON/OFF LED using port parallel that you can try as your microcontroller project. You can develop the programs above for more applications. 

0 comments:

Post a Comment

Thank's for your visiting and reading this article, please share your idea with comment here