Graphic LED screen based on STC single chip microcomputer and GPRS

Publisher:快乐家庭Latest update time:2011-12-24 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1 Preface

The emergence of GPRS (General Packet Radio Service) makes full use of the existing GSM network. It is not only suitable for intermittent, sudden or frequent, small data transmission, but also for occasional large data transmission. It combines mobile communication and data network into one. It uses a set of wireless transmission methods developed by the concept of "Packet Switch" to efficiently use the existing radio spectrum and provide users with services with the fastest data transmission rate of 115kb/s. In view of the current development of the network and the rapid popularization of short messages, it has become possible to control LED display advertisements, news and other public information with mobile phones. There are many technologies for controlling the display of small in-vehicle screens with SMS, but few can display small pictures. In view of this situation, this paper designs a software and hardware design system for displaying small in-vehicle screen advertisements that can display Chinese characters and some simple pictures.

2 Hardware Design System

As shown in Figure 1, this system mainly consists of three parts: GPRS module; single chip module; LED display module.

2.1 GPRS module

This module uses SIMCOM's SIM300 , and also requires a mobile phone card holder and a mobile phone card, which is used to receive text messages. The function of this module is to receive text messages from the mobile phone through the antenna, and to keep in touch with the microcontroller through the serial port to see if there is an AT command to read the text message, and then complete the AT command of the microcontroller to delete the text message after the microcontroller successfully reads the text message.

2.2 MCU Module

The main chip of this module is STC89C58RD+ microcontroller, which has fast processing speed and large enough RAM. Its main advantages are: the clock frequency can reach 80 MHz; it contains 32 KB flash memory, 1 280 B RAM, 8 K EEPROM ; IAP/ISP program download mechanism greatly reduces the cost of equipment development and use, and makes hardware encryption impeccable; it has 4 levels and 8 interrupt sources, and provides 2 additional external interrupt mechanisms and 4 I/O port resources. These features greatly simplify the design of the peripheral circuit of this system.

The main function of the single-chip microcomputer is to continuously send the existing screen display data to the LED screen, and at the same time send AT commands through the serial port to monitor whether there is new information from the GPRS module. Once there is, it will enter the serial port interrupt and process the data. The external FLASH mainly stores some commonly used Chinese characters and some symbol fonts. After the single-chip microcomputer processes the text information, it will obtain the Chinese character fonts through it for screen display.

2.3 LED screen

The main control chip of the terminal display device LED screen is 74HC595 , and there are also bidirectional driver chips 74LS245 and some auxiliary current amplifier chips. This screen can display 12 16*16 Chinese characters.

3. Software Design

The software design part can be regarded as the command center of the entire system. Only with this part of the design can the AT command read and delete information, decode information, and control the screen to display data in real time.

3.1 AT Commands

The commands used are mainly related to SMS:

(1) AT command to read the new message received: at +cmgr=1 press Enter;

(2) Delete the read message: at+cmgd=1 and press Enter.

3.2 Decoding methods for SMS , Chinese characters and pictures

SMS: Text message service. The content of a short message can be text, numbers or binary non-text data, but the average capacity of each SMS is 140 bytes, generally not more than 60 Chinese characters. If the user turns off the phone or is out of the service area, the short message can be stored in the short message center and can be automatically received when the user turns on the phone. There are three ways to send and receive SMS messages: Block Mode, Text Mode and PDU Mode. Block Mode is a thing of the past. Text Mode is a pure text mode, which is generally not supported by domestic mobile phones and is mainly used in Europe and the United States. All the text messages received in this article are PDU Mode.

3.21 PDU Mode PDU mode is the most common method for sending or receiving mobile phone short messages. It transmits the text of the short message after hexadecimal encoding. It can send up to 160 characters when using 7-bits encoding. 8-bit encoding (up to 140 characters) is usually not directly displayed by the mobile phone; it is usually used as data messages, such as pictures and ringtones in smart messaging) and OTA WAP settings. 16-bit information (up to 70 characters) is used to display Unicode (UCS2) text information and can be displayed by most mobile phones. The text information of this system uses Unicode (UCS2) and the small picture information uses 7-bits encoding. Since the information comes from the mobile phone, only the decoding process of the microcontroller after receiving the information is introduced. 3.22 Decoding process of Chinese characters The external FLASH stores the commonly used Chinese characters and character fonts after the Unicode (UCS2) code and the national standard code are matched one by one using the matlab tool, so the decoding process of the microcontroller is the process of finding the corresponding font. When a situation that needs to be processed occurs, the MCU reads the information received by the mobile phone module through the serial port, because this information has a message header: including the other party's mobile phone number, customer service center number, time, etc. When the display screen displays, only the subject content of the message is needed, so when the MCU processes the message, it uses the screen number as the first byte to convert the Unicode code corresponding to the Chinese character into a decimal number, and then separates the area code and bit number to find the font, and then stores it in the internal RAM of the MCU in the corresponding order, so that it is convenient to fetch data and send it to the screen. It can be described by Figure 2.

3.23 Image decoding process

Considering the large amount of image information, a 16*16 image has 32 bytes. When sending it via a mobile phone, 7-bit encoding is used, which can save half of the memory space. The microcontroller reads and selects information in the same way as text information. The key is the decoding of this part. When decoding this part, we must first understand the 7-bit encoding principle.

The encoding process is relatively easy to understand: divide the source string into groups of 8 characters for encoding, and compress the characters within the group, but there is no connection between each group. In each group, first convert each character into a 7-bit standard binary ASCII code, and then adjust the low bits of the following characters to the front bit by bit to make up for the difference in the front. Taking sending a 16*16 picture as an example, there are 28 bytes after encoding, but the microcontroller reads 56 bytes. This is because the mobile phone treats one byte as two bytes when sending data. When the microcontroller is responsible for decoding, the processing method adopted is to divide every seven bytes into a group, process them into eight bytes, and then convert these eight bytes into corresponding numbers and merge them two by two, that is, to restore the 32 bytes of the original picture. The program for this part is as follows:

for(j=0;j

{ h=j/7*4; a=gsm[j]&0x80;

chartemp1=gsm[j]&0x7f;

if(chartemp1<'A') chartemp1=chartemp1-48;

else chartemp1=chartemp1-55;

b=gsm[j+1]&0xc0;

chartemp3=((gsm[j+1]&0x3f)<<1)|(a>>7);

if(chartemp3<'A') chartemp3=chartemp3-48;

else chartemp3=chartemp3-55;

cun[h]=(chartemp1<<4)|chartemp3;

c=gsm[j+2]&0xe0;

chartemp5=((gsm[j+2]&0x1f)<<2)|(b>>6); if(chartemp5<'A') chartemp5=chartemp5-48;

else chartemp5=chartemp5-55;

d=gsm[j+3]&0xf0; chartemp7=((gsm[j+3]&0x0f)<<3)|(c>>5);

if(chartemp7<'A') chartemp7=chartemp7-48;

else chartemp7=chartemp7-55; cun[h+1]=(chartemp5<<4)|chartemp7; e=gsm[j+4]&0xf8; chartemp9=((gsm[j+4]&0x07)<<4)| (d>>4);

if(chartemp9<'A') chartemp9=chartemp9-48;

else chartemp9=chartemp9-55;

f=gsm[j+5]&0xfc;

chartemp11=((gsm[j+5]&0x03)<<5)|(e>>3);

if(chartemp11<'A') chartemp11=chartemp11-48;

else chartemp11=chartemp11-55;

cun[h+2]=(chartemp9<<4)|chartemp11;

g=gsm[j+6]&0xfe;

chartemp13=((gsm[j+6]&0x01)<<6)|(f>>2);

if(chartemp13<'A') chartemp13=chartemp13-48;

else chartemp13=chartemp13-55;

g=g>>1;

if(g<'A') g=g-48;

else g=g-55;

cun[h+3]=(chartemp13<<4)|g;}

3.3 Screen-related software design

These functions include writeyipin() function to write data to internal RAM, read data to temporary storage area, row scan and column scan functions, row and column data sending functions, and some delay functions. It is worth mentioning that writeyipin() function, when writing data, because the strip screen used can display 12 16*16 pictures, it is stored in the display order of one word, row and column, so that no other processing is required when reading data and sending it to the screen, saving time and resources.

In summary, the flowchart of the software is shown in Figure 3.

4 Conclusion

This system runs stably, can display Chinese characters and picture information clearly and accurately, and has low cost. It can be used to publish advertising information on small car screens and can also be used for policy propaganda in remote areas.

Reference address:Graphic LED screen based on STC single chip microcomputer and GPRS

Previous article:Design of a single bus single chip multi-machine communication system
Next article:The Application and Implementation of Time-Sharing Operating System Idea in Single-Chip Microcomputer Programming

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号