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.
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
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Musk's "satellite dish" becomes a cat heater. Engineer: The cat is warm, but the Internet speed is so slow that it drives people crazy
- Does anyone have a good method for 4.2V disconnection monitoring?
- STM32 Project Outsourcing
- How to import CAD into AD?
- Can 5G Home Internet meet your broadband needs at home?
- Please help provide the code or download link for STM32 M0 to read and write AT24C256, thank you.
- Indoor positioning solution: UWB indoor positioning technology - Xindao Intelligent
- What are the most common wireless communication (data) transmission technologies?
- This week's review information, freshly arrived!
- CCS cannot build its own platform