Design of advertising lamp based on 8051 single chip microcomputer

Publisher:boczsy2018Latest update time:2011-09-20 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1. Experimental task
Use the table to make port P1 change a single light: move left 2 times, move right 2 times, and flash 2 times (delay time 0.2 seconds).
2. Circuit diagram



Figure 4.5.1
3. Hardware connection on the system board
Connect P1.0-P1.7 in the "MCU system" area to the L1-L8 ports in the "Eight-way LED indicator module" area with an 8-core cable. The requirements are: P1.0 corresponds to L1, P1.1 corresponds to L2, ..., P1.7 corresponds to L8.
4. Program design content
When using a table for programming, the following instructions must be used to complete
(1). Use the MOV DPTR, #DATA16 instruction to make the data pointer register point to the beginning of the table.
(2). Use the MOVC A, @A + DPTR instruction to add the value of the accumulator to the value of the DPTR, so that the program counter PC can point to the data to be retrieved from the table.
Therefore, as long as the control code is built into a table and MOVC A, @A + DPTR is used to perform the code retrieval operation, some complex control actions can be easily processed. The table retrieval process is shown in the figure below:
5. Program flow chart



Figure 4.5.2
6. Assembly source program
ORG 0
START: MOV DPTR,#TABLE
LOOP: CLR A
MOVC A,@A+DPTR
CJNE A,#01H,LOOP1
JMP START
LOOP1: MOV P1,A
MOV R3,#20
LCALL DELAY
INC DPTR
JMP LOOP
DELAY : MOV R4,#20
D1: MOV R5,#248
DJNZ R5,$
DJNZ R4,D1
DJNZ R3,DELAY
RET
TABLE: DB 0FEH,0FDH,0FBH,0F7H
DB 0EFH,0DFH,0BFH,07FH
DB 0FEH,0FDH,0FBH ,0F7H
DB 0EFH,0DFH,0BFH,07FH
DB 07FH,0BFH,0DFH,0EFH
DB 0F7H,0FBH,0FDH,0FEH
DB 07FH,0BFH,0DFH,0EFH
DB 0F7H,0FBH,0FDH,0FEH
DB 00H, 0FFH,00H, 0FFH
DB 01H
END
7. C language source program
#include
unsigned char code table[]={0xfe,0xfd,0xfb,0xf7,
0xef,0xdf,0xbf,0x7f,
0xfe,0xfd,0xfb,0xf7,
0xef,0xdf,0xbf,0x7f
unsigned char i ;
void delay ​ ​ ​(void) { unsigned char m,n,s; for(m=20;m>0;m--) for(n=20;n>0;n--) for(s=248;s>0;s--); } void main(void) { while(1) { if(table[i]!=0x01) { P1=table[i]; i++; delay(); } else { i=0; } } }




























Reference address:Design of advertising lamp based on 8051 single chip microcomputer

Previous article:Types of MCU Development Systems
Next article:Testing technology and the development of military aircraft maintenance system

Recommended ReadingLatest update time:2024-11-16 21:38

On the Proportional Electromagnet Control Technology of C8051F005 Single Chip Microcomputer
  introduction   As an actuator, the proportional solenoid is one of the key products of mechatronics and is widely used in various automatic control systems. The proportional solenoid has a large thrust, simple structure, convenient maintenance, and low cost. It is a widely used electro-mechanical converter . The ch
[Microcontroller]
On the Proportional Electromagnet Control Technology of C8051F005 Single Chip Microcomputer
Design of ocean current data collection and storage interface based on C8051F021 microcontroller and SD2300 chip
With the rapid development of science and technology, many applications in the field of modern industrial measurement and control require the regular collection and storage of large amounts of data. Taking the ocean current data acquisition and storage interface circuit designed for the ocean current meter as an examp
[Microcontroller]
Design of ocean current data collection and storage interface based on C8051F021 microcontroller and SD2300 chip
Using Oscillator to Implement Clock Configuration of High-speed Serial Communication for 8051 MCU
introduction In many real-time monitoring systems and communication equipment fields today, long-distance data transmission is often required. Therefore, how to achieve high-speed, reliable and low-cost data transmission is a new technology that the 8051 microcontroller as the front-end or sending stage urgently n
[Microcontroller]
Using Oscillator to Implement Clock Configuration of High-speed Serial Communication for 8051 MCU
8051 MCU - Software Reset
ISP_CONTR: ISP/IAP control register D7 D6 D5 D4 D3 D2 D1 D0 Reset value ISPEN SWBS SWRST - - WT2 WT
[Microcontroller]
Design of program-controlled constant current source based on C8051FF330D single chip microcomputer
Abstract: This paper presents a design method of using the internal current-type D/A converter and current/voltage conversion circuit of C8051FF330D to output 0~4V analog signal to control the output current of the constant current source and make it change according to the set value, thus completing the design of a pr
[Microcontroller]
Design of program-controlled constant current source based on C8051FF330D single chip microcomputer
8051/2 single chip microcomputer DHT11 air temperature and humidity sensor value
1. Description Experience in processing various signals is very important! DHT11 temperature and humidity values Each data transmission is 40 bits, including 8 bits of humidity integer, 8 bits of humidity decimal, 8 bits of temperature integer, 8 bits of temperature decimal and 8 bits of checksum. 2. Demonstrati
[Microcontroller]
8051/2 single chip microcomputer DHT11 air temperature and humidity sensor value
How to access bytes in int in 8051 microcontroller
In the use of single-chip microcomputer, unsigned int occupies 2 bytes, unsigned char occupies 1 byte. Single-chip microcomputer implements byte addressing. 16-byte bit addressing is really not easy to use. It is not useful because it cannot create arrays. In the actual development process, DPTR, as well a
[Microcontroller]
How to access bytes in int in 8051 microcontroller
Design of wireless transceiver system based on nRF905 module and C8051F microcontroller
Preface In a closed-loop drilling system, it is required to transmit the information from the wellbore to the surface in real time for manual monitoring. Usually, this task is completed by the mud pressure pulse generator in the MWD. ​​When a downhole power drill assembly is used, the near-bit sensor and th
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号