4719 views|0 replies

1379

Posts

0

Resources
The OP
 

Experiment on using single chip microcomputer to control the lighting sequence of small lights in the chassis [Copy link]

org 0000h /* Set the starting address of the program segment */

ljmp main

org 000bh

ljmp ctc

org 0030h

main:

mov tmod,#01h /* set address pointer */

mov th0,#3ch

mov tl0,#0b0h

mov r2,#0ah

setb ea /*ea set to 1*/

setb et0 /* et0 set to 1*/

setb tr0 /* tr0 set to 1*/

mov a,#01h /* assign value to accumulator a */

sjmp $ /* step */

ctc:

mov th0,#3ch /* initialize t0 */

mov tl0,#0b0h

djnz r2,next /*r2=0?, If not equal, transfer to next*/

mov p1,a /* send the number in a to p1 */

mov r2,#0ah /* assign value to r2 */

rl a /* Shift the value in a to the left by one position */

next: reti /* Interrupt the subroutine and return to the main program */

end /* End of program */

start

Set the initial value of the address pointer

r2=0?

Modify the address pointer

N


Y

The number in a is sent to p1

R2 assignment

Numeric shift

END

flow chart:


Experimental steps:

1. Connect the wires on the microcontroller;

2. Input the program into the computer;

3. Turn on the power of the microcontroller and the display will show C_ ;

4. Run the program;

5. Observe the process of the small lamp lighting up;

6. Change the program to change the order in which the small lights light up;

7. Turn off the power and put the experimental device back to its original position.

Running result: The small lights on the chassis light up in a left-right cycle.
This is a program we use when we practice learning. I tried it and found it very interesting. I will show it to you.
If you have the opportunity, you can try it.
This post is from MCU
 

Guess Your Favourite
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list