Design of intelligent electronic scale system based on 51 microcontroller (including code simulation and paper)

Written in front: It’s not easy to make and organize, so please give it a thumbs up

Code simulation file:[Free] Intelligent electronic scale system design based on 51 microcontroller (including code simulation and paper) does not require points! Resources-CSDN Library

Demonstration video[Open source] Smart electronic scale design based on 51 microcontroller (including paper simulation and code, etc.)_bilibili_bilibili

Summary

With the development of science and technology and the continuous improvement of market demand, smart electronic scales have been widely used in commercial, home and laboratory fields. This article mainly studies the design of an intelligent electronic scale system based on 51 microcontroller, aiming to improve the performance and practicality of the electronic scale.

This design uses the STC89C52RC microcontroller as the main control unit and uses the 8-bit AD conversion chip ADC0832 to perform A/D conversion on the collected analog quantities. The converted data is sent to the microcontroller for processing and display. The data display is implemented by LCD12864 liquid crystal. It has the following characteristics: the weighing range is 0~5Kg, and the error is not greater than ±0.005Kg; it has the function of measuring the mass of an object and displaying it through the display module; it can calculate the total price of the quantity of objects through the unit price of the object; it has the tare function, which is convenient Calculate the actual gravity of the object; when the measured weight exceeds the alarm threshold, it will buzz for overload alarm.

Through experimental verification, the intelligent electronic scale system based on 51 microcontroller designed in this article has high accuracy and stability, meets the needs of business, home and laboratory fields, and has strong practical value and broad application prospects.

Keywords: 51 microcontroller; intelligent electronic scale; weighing sensor; error analysis

Table of contents:

1 Design tasks

1 Design tasks

    1. Design task requirements

1. Design an electronic scale that can realize the basic weighing function of the electronic scale. When an object is placed, it can display the weight. The weighing range is 0~5Kg, and the error is not greater than ±0.005Kg.

2. The electronic scale has the function of inputting the unit price and calculating the total price. The unit price and total price amount are yuan. The maximum amount is 999.99 yuan, and the amount error is not greater than 0.01 yuan.

3. When the system exceeds the maximum measurement range of 5Kg, it has an alarm indication function.

4. The electronic scale is designed to have both tare function and weight calibration function.

1.2 Requirements analysis

Functional requirements: The system should be able to accurately measure the weight of objects, with a range of 0 to 5Kg, and an error not greater than ±0.005Kg; and should have an LCD screen to display the weight, unit price and total price of the object in real time. The system should allow users to enter the unit price of goods in order to calculate the total price; when the measured weight exceeds the maximum range, an alarm should be issued; and it should have a low-power design to extend battery life.

Performance requirements: The clock frequency of the main control chip needs to be between tens of MHz and hundreds of MHz to ensure sufficient computing power and data processing capabilities. Control requirements: The system should have clear control logic to achieve coordination and smooth operation of weight measurement, display, alarm and other functions. It has high-precision control capabilities and fast control response capabilities to ensure the accuracy of weight measurement results, and can complete functions such as weight measurement, display and alarm in a short time.

System reliability requirements: The system should have fast response capabilities and be able to complete weight measurement and display in a short time. The operation interface should be simple and clear to facilitate users to get started quickly; it should also have certain scalability to facilitate the addition of new functions or upgrades in the future.

System security requirements: The system should have electrical safety protection measures to prevent short circuits or electric shock accidents; it should have an anti-tampering function to prevent it from being used by unscrupulous merchants; it should have an overload protection function to prevent the measured weight from exceeding the maximum range. damage caused.

Compatibility requirements: The system should have a universal communication interface to facilitate data interaction with other devices or systems. The system should have broad power compatibility and be able to adapt to the needs of different power environments.

Cost requirements: On the premise of ensuring system performance, the system chooses materials with high cost performance to reduce costs. Optimize system design and reduce manufacturing difficulty and cost. Make the hardware cost no more than 70 yuan. The software cost and maintenance cost are low, making it easy for users to use it for a long time.

2 System hardware design

This design uses Proteus software for simulation and debugging. Potential problems can be discovered and solved before actual production, thereby reducing problems that arise during subsequent physical production and debugging. This approach can improve design reliability, save costs and reduce waste. After the simulation is successfully run, the procurement of components and the production of physical objects can ensure the correctness and feasibility of the design.

2.1 Overall system design plan

The main working principle of smart electronic scales: When there are items placed on the weighing plate, a pressure will be formed on the sensor, causing the sensor to produce a force-electric effect, converting the weight of the object into an analog electrical signal that is a certain functional relationship with the weight of the object being weighed. The signal is amplified by the circuit, converted to analog-to-digital (A/D), and sent to the processor for processing to obtain the corresponding weight of the item.​  

This system uses STC89C52 microcontroller as the core control hardware, which is composed of a weighing sensor, A/D conversion chip, processor chip, LCD display and buzzer alarm. The data is collected through the load cell and converted into voltage values, which are passed to the A/D converter and further passed to the STC89C52 microcontroller with calculation and processing functions. The microcontroller scans the button status and pin level to determine the button input information and function button switch status. At the same time, the received information is calculated and transmitted to the outside world through the buzzer alarm and display to control high-precision measurement, alarm, unit price adjustment, tare weight and other functions.

This system adopts modular design principles and combines hardware and software. The hardware part consists of circuits composed of microcontrollers, sensors, etc. to complete the hardware design of the system; the software part uploads the collected pressure sensor data to the LCD display to achieve quality measurement, price calculation and overweight alarm of objects.

The overall system design is shown in Figure 2.1, which is divided into six parts: microcontroller minimum system, sensor module, button module, display module, buzzer alarm module and A/D conversion module.

2.2 Minimum system module of microcontroller

Option 1: STM32 microcontroller

STM32 microcontroller has the characteristics of low power consumption, high performance and stability.

However, STM32 runs instructions and is suitable for running algorithms. However, for multi-channel signal processing, many DSPs are required for parallel processing. Moreover, the cost of chips is relatively high, and they are easily affected by the market and fluctuate greatly.

Option 2: STC89C52 microcontroller

STC89C52 microcontroller is a new generation of high-speed/low power consumption/super anti-interference microcontroller launched by Hongjing Technology. The instruction code is fully compatible with the traditional 8051 microcontroller. STC89C52 is a low-voltage, high-performance CMOS 8-bit microcontroller. It contains 8k bytes of rewritable Flash read-only program memory and 256 bytes of random access data memory (RAM). It is compatible with the standard MCS-51 instruction system and has built-in General-purpose 8-bit CPU and Flash memory unit. STC89C52 has 40 pins, 32 external bidirectional input/output (I/O) ports, and contains 2 external interrupt ports, 3 16-bit programmable timer counters, 2 full-duplex serial communication ports, 2 With a read and write port line, STC89C52 can be programmed according to conventional methods. It combines a general-purpose microprocessor and Flash memory, especially the repeatedly erasable Flash memory, which can effectively reduce development costs.

The minimum system of STC89C52 microcontroller mainly consists of crystal oscillator circuit, reset circuit, and power supply circuit, as shown in Figure 2.2.

 Figure 2.2 Minimum microcontroller system

Compared with the STM32 microcontroller, the STC89C52 microcontroller is a very cheap microcontroller, so it is very popular in some low-cost applications, easy to learn and use, and has low resource consumption. And because the 51 microcontroller has been around for a long time, there are many mature development tools and libraries available. Therefore, option 2 is selected for this design.

2.3 压力You sense organ model

Option 1: Piezoelectric sensor

Piezoelectric sensor is a typical active sensor, also known as self-generating sensor. Its working principle is based on the piezoelectric effect of certain materials that generate charges on their corresponding specific surfaces after being stressed.

Piezoelectric sensors are small in size, light in weight, simple in structure, and reliable in operation. They are suitable for measuring dynamic mechanical quantities. They are not suitable for measuring objects with too low frequency, let alone measuring static quantities. Currently it is mostly used for the measurement of acceleration and dynamic force or pressure. Weaknesses of piezoelectric devices: high internal resistance, low power. The power is small, the output energy is weak, and the distributed capacitance and noise interference of the cable affect the output characteristics, which places high requirements on external circuits.

Option 2: Resistive strain gauge sensor

Resistive strain sensor is a structural sensor that uses the resistive strain effect to convert various mechanical quantities into electrical signals. The core component of the resistance strain gauge type resistance strain sensor is based on the resistance strain effect of the material. The resistance strain gauge can be used alone as a sensor, or as a sensitive element combined with an elastic element to form a mechanical quantity sensor.

The phenomenon that the resistance of a conductor changes with mechanical deformation is called the resistive strain effect. After the resistance strain gauge converts the mechanical strain signal into △R/R, since the strain amount and the corresponding resistance change are generally very small, it is difficult to measure directly and accurately, and it is inconvenient to process. Therefore, a conversion circuit is used to convert the ΔR/R changes of the strain gauge into voltage or current changes. The conversion circuit commonly uses a measuring bridge.

The characteristic of the DC bridge is that the signal will not be affected by the distributed inductance and capacitance of each component and wire, and has strong anti-interference ability. However, due to the small output signal due to mechanical strain, it requires the use of a high-gain and high-stability amplifier for amplification.

Figure 2.3 shows a balanced resistor bridge powered by DC, connected to DC power supply E:

Figure 2.3 Sensor internal connection diagram

When the output end of the bridge is connected to an infinite load resistance, the visible output end is open circuit. At this time, the DC bridge is called a voltage bridge, that is, it only has a voltage output.

When the internal resistance of the power supply is ignored, the voltage dividing principle is:

        (2.1)

When the condition R1R3=R2R4 is met, that is

(2.2)

That is bridge balance. Equation (2.2) is called the equilibrium condition.

The strain gauge measuring bridge balances the bridge before measurement, so that the bridge output voltage during measurement is only related to the resistance change caused by the strain felt by the strain gauge.

If it works differentially, that is, R1=R-△R, R2=R+△R, R3=R-△R, R4=R+△R, according to equation (2.1), the bridge output is

 Resistance strain gauge sensors have the following characteristics:

(1) Wide application and measurement range, strain gauges can be made into various mechanical quantity sensors.

(2) High resolution and sensitivity, high precision.

(3) The structure is light and small, has little impact on the specimen, and has strong adaptability to complex environments. It can be used in special environments such as high temperature, high pressure, and strong magnetic fields, and has good frequency response.

(4) Commercialization, easy to use, and easy to achieve long-distance and automated measurement.

Through a comparative analysis of pressure sensors and resistance strain sensors, the second option was finally chosen. The question requires that the weighing range is 0~5Kg, and the full-scale error is no greater than plus or minus 0.005Kg. Taking into account the weight of the scale platform, vibration and impact components, and to avoid overweight damage to the sensor, the sensor range must be greater than the rated weighing 5Kg. We chose a resistance strain gauge pressure sensor with a range of 5Kg and an accuracy of 0.01%, which meets the accuracy requirements of this system.

Table 2.1 Sensor parameter description

Comprehensive error (%F.S)

0.05

Rated output temperature drift (%F.S/10℃)

≤0.15

Sensitivity (mv/v)

1.0±0.1

Zero point output (mv/v)

±0.1

Nonlinear (%F.S)

0.05

Input resistance (Ω)

1000±50

Repeatability (%F.S)

0.05

Output resistance (Ω)

1000±50

Hysteresis (%F.S)

0.05

Braided resistance (MΩ)

≥2000(100VDC)

Creep (%F.S/3min)

0.05

Recommended excitation voltage (V)

3~12

Zero point drift (%F.S/1min)

0.05

Working temperature range (℃)

-10~+50

Zero temperature drift (%F.S)/10℃

0.2

Overload capacity (% F.S)

150

Sensor signal output description:

The sensor output is an analog voltage, and the voltage value is determined by the excitation voltage (working voltage/). For example, if the excitation voltage is DC5V, then the full-scale output voltage value of the pressure sensor is: 5V*1.0mv/ V =5mV; that is, the signal voltage output The range is 0-5mV. The greater the applied pressure, the greater the corresponding output voltage value.

2.4ShojiModel 

Option 1: Digital tube display

The digital tube is a semiconductor light-emitting device, and its basic unit is a light-emitting diode. The digital tube is divided into seven-segment digital tube and eight-segment digital tube according to the number of segments. The eight-segment digital tube has one more light-emitting diode unit (one more decimal point display) than the seven-segment digital tube; it can be divided into 1 digit according to how many "8"s can be displayed. , 2-digit, 4-digit, etc. digital tubes; according to the connection method of the light-emitting diode unit, they are divided into common anode digital tubes and common cathode digital tubes. Common anode digital tube refers to a digital tube in which the anodes of all light-emitting diodes are connected together to form a common anode (COM). When using a common anode digital tube, the common pole COM should be connected to +5V. When the cathode of a certain field of light-emitting diodes is at a low level, the corresponding field will light up. When the cathode of a certain field is high, the corresponding field will not light up. Common cathode digital tube refers to a digital tube in which the cathodes of all light-emitting diodes are connected together to form a common cathode (COM). When using common cathode digital tubes, the common pole COM should be connected to the ground wire GND. When the anode of a certain field of light-emitting diodes is at a high level, the corresponding field will light up. When the anode of a certain field is low, the corresponding field will not light up.

The display information of digital tubes is limited. When displaying a lot of information, multiple digital tubes need to be cascaded, which will cause complex hardware connections and increase costs; the digital tubes cannot display most characters well, and it is not easy to process during dynamic scanning. Flickering occurs.

Option 2: LCD12864 display

LCD12864 is a dot matrix graphic liquid crystal display module with a display resolution of 128×64 and a built-in 128 16*8-point ASCII character set. Utilizing the flexible interface mode and simple and convenient operation instructions of this module, a full Chinese human-computer interaction graphical interface can be formed. Can display 8×4 lines of 16×16 dot matrix Chinese characters. Graphical display can also be completed. Low voltage and low power consumption is another notable feature. The liquid crystal display solution composed of this module is the same type of graphic dot matrix liquid crystal. Compared with display modules, the hardware circuit structure or display program is much simpler.

When LCD12864 displays letters and numbers, it is a 4*16 display character module, that is, it can display 4 lines, and each line can display 16 letters or numbers; when it displays Chinese characters, it is a 4*8 Chinese character display module, that is, it can display 4 lines, each line can display 8 Chinese characters. The following describes how parallel communication is displayed.

LCD12864 has a total of 20 pins. The specific functions of the pins are shown in Table 2.2. From the table, the LCD12864 pins are composed of an 8-bit data transmission port (DB0-DB7); two power supply pins (VCC, GND); two A power supply backlight pin (BLK, BLA), controls the background brightness of the LCD; a VO pin, connected to an external pull-up resistor (controls the character contrast of the LCD12864, making the characters more clearly visible); RST reset pin, low level Valid, connect the high level directly here; the 16th and 17th bits are empty pins, don't care; the remaining four pins RS, RW, EN and PSB are closely related to the writing of LCD12864, and the LCD12864 can be controlled through PSB. For the communication mode of the microcontroller, if the input level is high, the communication mode between LCD12864 and the microcontroller is parallel communication, and if the input level is low, the communication mode is serial communication. The microcontroller's write control of the RS, RW, and EN ports can control the data transmission mode of the LCD12864 and determine whether the microcontroller writes commands or data to the LCD12864 data port DB. Write commands can control the mode and working status of the LCD, and then write data to allow the LCD to display the required interface.

Table 2.2 LCD12864 pin function table

Pin number

Pin name

direction

Function introduction

1

GND

The ground pin of the module’s power supply

2

VCC

The positive pin of the module’s power supply

3

VO

LCD drive voltage input port

4

RS(CS)

H/L

Parallel command/data select signal; serial chip select signal

5

R/W(SID)

H/L

Parallel read and write selection signal; serial data port

6

EN(CLK)

H/L

Parallel enable signal; serial synchronous clock

7

DB0

H/L

Data port 0

8

DB1

H/L

Data port 1

9

DB2

H/L

Data port 2

10

DB3

H/L

Data port 3

11

DB4

H/L

Data port 4

12

DB5

H/L

Data port 5

13

DB6

H/L

Data port 6

14

DB7

H/L

Data port 7

15

PSB

H/L

Serial/parallel interface selection port H-parallel L-serial

16

NC

empty legs

17

/RST

H/L

Reset pin, active low

18

VOUT

Voltage double output pin (valid for VDD =+3.3)

19

LED_A

Backlight power supply positive +5V

20

LED_B

Backlight power supply negative pole 0V

2.5A/D 转换Model 

ADC0832 is an 8-pin dual in-line dual-channel A/D converter, which can realize analog-to-digital conversion of two analog signals respectively, and can be used in single-ended input mode and differential mode. ADC0832 uses serial communication to perform channel selection, data acquisition and data transmission through the DI data input terminal. 8-bit resolution (higher resolution can reach 256 levels), which can adapt to general analog conversion requirements. The multiplexing of its internal power input and reference voltage allows the chip's analog voltage input to be between 0~5V. It has dual data outputs that can be used as data verification to reduce data errors, with fast conversion speed and strong stability. The independent chip enable input makes multi-device mounting and processor control more convenient. The chip interface is shown in Figure 2.4.​ 

Table 2.3ADC0832 pins and their functions

serial number

name

Function

1

CS_

Chip select enable, low level chip enable

2

CH0

Analog input channel 0, or used as IN+/-

3

CH1

Analog input channel 1, or used as IN+/-

4

GND

Chip reference voltage zero potential (ground)

5

FROM

Data signal input, select channel control

6

DO

Data signal output, conversion data output

7

CLK

Chip clock input

8

VCC

Power input and reference voltage input (multiplexed)

Under normal circumstances, the interface between ADC0832 and the microcontroller should be 4 data lines, namely CS, CLK, DO, and DI. However, since the DO end and the DI end are not active at the same time during communication and the interface with the microcontroller is bidirectional, DO and DI can be used in parallel on a data line during circuit design.

The ADC0832 timing diagram is shown in Figure 2.5.

As can be seen in the timing diagram, CS serves as a strobe signal, starting from CS being set to low level and ending with CS being set to high level. CLK provides the clock signal. When the ADC0832 is not working, its CS input terminal should be high level. At this time, the chip is disabled, and the levels of CLK and DO/DI can be arbitrary. When A/D conversion is to be performed, the CS enable terminal must first be set to low level and remain low until the conversion is completed. At this time, the chip starts conversion work, and at the same time, the processor inputs clock pulses to the chip clock input terminal CLK, and the DO/DI terminal uses the data signal selected by the DI terminal input channel function. The DI terminal must be high before the sinking of the first clock pulse, indicating the start signal. Before the second and third pulses sink, the DI terminal should input 2-bit data (SGL, Odd) to select the channel function. When the 2-bit data is "1" or "0", only single-channel conversion is performed on CH0. . When the 2-bit data is "1", "1", only single-channel conversion is performed on CH1. When the 2-bit data is "0" or "0", CH0 is used as the positive input terminal IN+ and CH1 is used as the negative input terminal IN- for input. When the 2-bit data is "0" or "1", input CH0 as the negative input terminal IN- and CH1 as the positive input terminal IN+. After the input start bit and channel selection are completed, the input level of the DI terminal loses its input function after the third pulse sinks. After that, the DO/DI terminal begins to use the data output DO to read the conversion data. Starting from the fourth pulse sinking, the DO terminal outputs the highest bit of conversion data, DATA7, and then the DO terminal outputs the next bit of data with each pulse sinking. Until the lowest bit data DATA0 is sent out at the 11th pulse, the data output of one byte is completed. It is also from this bit that the next opposite byte of data is output, that is, DATA0 is output from the sinking of the 11th byte. Then 8-bit data is output, and the data output is completed by the 19th pulse, which also marks the end of an A/D conversion. Finally, set CS high to disable the chip. At this time, you can start reading the data. The converted data will be sent twice, once with the high bit first, and once with the low bit first, and sent out continuously.

3 System sequence design

The entire software program design is divided into four parts, including the main program module, ADC0832 processing subprogram module, LCD driver subprogram module and key polling subprogram module. The main program reads the data of ADC0832 in a loop and controls the display of the LCD screen. The ADC0832 processing subroutine module implements the initialization and reading operations of the ADC chip and is encapsulated into a function to facilitate the direct call of the main function. The LCD driver subroutine initializes the GPIO and Its clock and key interrupt subroutine handle key press events. In this design, the main purpose is to detect the quality of the object and calculate the price, and display the quality and price on the LCD screen.

3.1 Main control program design

The STC89C52 main control flow chart is shown in Figure 3.1.

In the main program, the analog signal in the ADC0832 chip is read in a loop and the converted digital signal is displayed on the LCD.

In the main function, the program first initializes and displays the LCD. Then, the program enters an infinite loop, continuously reading ADC data, calculating the corresponding weight, unit price and total price based on the ADC data, and displaying the calculation results on the LCD.

In each loop, the program first calls the Adc0832 function to read the ADC data and stores the read data in the variable ad_data. Then, the program calls other functions, such as data_pro, weight_alarm, total, etc., to calculate the corresponding weight, unit price and total price based on the read ADC data, and displays the calculation results on the LCD.

3.2 A/D conversionChild order design

The A/D conversion subroutine program uses the IO port of the microcontroller to simulate the SPI interface, communicates with the ADC0832 by controlling the status and timing of the IO port, and completes analog signal conversion. The program first converts the channel number into the channel code required by the ADC0832 chip, and sends the control command to the ADC0832 chip. Then, the program transmits data to the ADC0832 chip through the analog SPI interface, and reads the converted digital signal from the chip.

In the function, the program first converts the channel number into the channel code required by the ADC0832 chip, and sends control commands to the chip. Then, the program transmits data to the chip through the analog SPI interface and reads the converted digital signal from the chip. The program uses two for loops to read the data transmitted by the chip, combine the two bytes into a 16-bit digital signal, and return the digital signal.

3.3 LCD operationChild sequence design

The LCD driver subroutine includes some functions for controlling the LCD display effect.

The checkbusy function is used to detect whether the LCD is in a busy state. If so, wait for the LCD to complete the current operation before continuing to the next operation.

The writecode function is used to send commands to the LCD. It will first call the checkbusy function to detect the busy status, then set RS to 0, indicating that the command is written, and finally write the command data to the LCD.

The writedata function is used to send data to the LCD. It will also first call the checkbusy function to detect the busy status, then set RS to 1, indicating that data is written, and finally write the data to the LCD.

The displayzifu function is used to display a string. It will take out the font of each character in the string and display it on the left and right pages in an 8×16 format.

The clear function is used to clear the display content of the specified area of ​​​​LC. Its implementation is similar to the displayzifu function, except that space characters are displayed here.

The displayhanzi function is used to display Chinese characters. Its implementation is similar to the displayzifu function.

The lcdinti function is used to initialize the LCD. It sends a series of commands to set the display parameters and starting address of the LCD.

3.4 buttonsPolling subroutine design

按键中断子程序是一个在定时器1计数器溢出时被调用的定时器1中断函数。该函数主要是用来处理按键输入的,包括涨价按键1、涨价按键2、降价按键1、降价按键2、去皮按键、去皮清零按键、报警值增加按键和报警值减少按键。

当这些按键中的任意一个被按下时,按键中断子程序会对相应的变量进行递增或递减,并等待按键释放后才返回。为了确保程序能够正确地响应按键输入,按键中断子程序使用了一些while循环来等待按键释放。这些循环会一直执行,直到检测到按键已经释放,并且相应的变量已经得到更新。

在按键中断子程序中,单价、皮重和报警值都可以被调整。单价和皮重是用来计算净重的,而报警值用于判断是否超过了设定的重量范围。如果超过了报警值,程序会触发相应的报警机制,提醒用户进行相应的处理。

按键中断子程序在电子秤的控制中起着非常重要的作用。它能够实时响应用户的输入,并对相应的变量进行递增或递减,从而实现对电子秤的精准控制。

4 系统调试

在本章中,我们将进行实验验证,以检查系统是否具备设计任务书中要求功能和精度指标。

系统的功能与精度指标如表4.1所示:

表4.1 系统的功能与性能指标

序号

实验

测试内容

预期指标

1

系统整体功能验证

称重、计价、LCD显示等功能

功能良好

2

质量检测精度测试

质量测量精度

偏差小于±0.005Kg

3

超重报警功能测试

蜂鸣器报警

功能良好

4

去皮及重量校准测试

按键去皮,重量校准功能

功能良好

4.1仿真调试

在Proteus绘制出原理图后,将程序导入,然后按下开始键,仿真开始运行,AT89C52 单片机可以读取到 ADC0832 的数据,并在 LCD 屏幕上显示出重量、单价、报警值和总价,如图 4.2 所示。

点击单价调节对应的按键可以调节物品的单价,单片机计算出的总价也会随着实时改变,如图 4.3 所示。 

点击报警调节对应的按键可以调节报警值,物体重量超出报警值时,报警电路会开始工作,如图 4.4 所示。

点击去皮操作对应的按键可以将当时的物体重量算作皮重去除,之后再增加的重量为净重,如图 4.5 所示。

4.2实物调试

本次实验的目的是验证本文所设计的智能电子称系统的信号采集、参数测量、LCD显示等整体功能。实验设备为本文所设计的智能电子秤一台,包括单片机最小系统模块、压力传感器模块、A/D转换模块、显示模块。

4.2.1系统整体功能验证

实验步骤如下:首先选择需要测量的物体,将被测量物体放在置物盘正中央,(放置置物盘边缘上会影响测量精度),等待测量结果。如需要计算总价,首先通过按键调整商品单价,系统会自动计算总价,显示于LCD屏幕上。当物体质量超过设定好的值时,系统会自动报警;若需调整报警值,则需要按下报警值调整按键,调整报警数值。

接入5V直流电源,系统开机,初始显示如图4.6所示,此时重量自动归零,单价默认为12元/Kg,按下去皮键即可去皮。

将被测物体放上置物盘后,系统显示物体质量,并根据已设置的单价自动计算总价,并显示于LCD屏幕上,如图4.7所示,此时重量为0.072Kg,单价为12元/Kg,总价为0.072*12=0.864元,显示总价为0.86元。

按下报警值设置键,即可调整报警重量,如图4.8所示。当物体质量超过设置的报警重量时,蜂鸣器持续报警。

4.2.2 压力传感器模块验证

本次实验目的是验证系统测量质量的精度是否符合系统指标要求。实验共测量五种不同质量的物体,多次测量,将物体置于标准秤置物盘上,待读数稳定后记录数据;再将被测物体置于压力传感器上方置物盘上,测量结束后查看LCD显示屏上的数据并记录,对比两组数据验证测温精度。为避免因温度的不同而引起的误差,实验时需在同一温湿度环境下测量。对比结果如表4.2所示。

表 4.2系统测量结果与标准秤测量结果对照表

编号

测量结果/Kg

对照结果/Kg

误差/Kg

1

0.051

0.051

0.000

2

0.052

0.051

+0.001

3

0.341

0.343

-0.002

4

0.342

0.343

-0.001

5

6

7

8

9

10

0.836

0.837

1.565

1.567

2.530

2.532

0.837

0.837

1.565

1.565

2.531

2.531

-0.001

0.000

0.000

+0.002

-0.001

+0.001

根据表中数据可以得知,在10次的测量值,本系统对质量测量的最大误差为0.002Kg,满足小于或等于0.005Kg的测量精度要求。在测量过程中,还发现了当物体放在置物盘边时,测量数值会不准确,误差也会迅速增加。所以,可以通过尽量使被测物体置于置物盘中央来提高测量精度。

4.4调试心得

调试是将设计理论转化为实际的过程,对于这一阶段,我们需要具备扎实的理论知识和实践经验。调试过程中存在大量未知,稍有疏忽就可能导致连锁反应,影响整个结果,因此我们需要谨慎对待每一个细节,并不断改进调试方法。在调试过程中,我们往往会遇到各种问题,需要进行仔细排查和多方尝试,不要轻易放弃,总会找到解决方法。同时,记录和总结每次尝试的结果也是非常重要的,可以帮助我们更好地发现问题和避免同样的错误。

在调试的过程中,我遇到了许多问题,其中LCD12864显示模块的调试让我非常困扰,因为显示屏无法正常显示。我进行了一遍遍的引脚检查和代码检查,但是没有发现错误,这导致我的课程设计停滞了很长时间。最后,我进行了更加仔细的排查,发现其中一个地方虚焊了,才解决了问题。在软件调试时,我在尝试利用LCD12864显示中文汉字的过程中也遇到了很多困难,但是通过学习和搜集资料,我最终成功实现了这个功能。

调试的过程虽然可能会让人感到枯燥,但是在每一次尝试中,无论是失败还是成功,都能够激起我内心的激动和感动。在这次毕设的调试过程中,我深刻地体会到了失败是一件正常的事情,关键在于我们要从每次失败中吸取经验,不断地尝试,相信总会有一次属于自己的成功。因此,不断地坚持和努力才是最终走向成功的道路。同时,我们也要保持乐观的心态,对于每一次失败都要有信心和勇气去面对,相信自己能够克服困难,最终取得成功。因为每一次失败都是一次宝贵的经验积累,在未来的工作和学习中,这些经验也将会成为我们前进的强大支撑。

在调试这个过程中,我也发现了自己的不足之处。只有不断发现自己的不足并进行改进,才能不断提高自己的能力和水平。

当调试单片机电子秤时,以下是一些重要的注意事项和建议:

(1)确保电子秤的传感器与单片机正确连接,并且连接线路没有松动或错误。检查传感器和电源供应电路是否正确。

(2)在程序中使用合适的校准算法,以确保秤的读数准确。这通常涉及到将已知重量放在秤上,并将读数与期望值进行比较,然后进行校准。

(3)在进行校准时,应确保在秤上放置的物品是均匀分布的,并且不会造成传感器的过载。过载会导致读数不准确,甚至可能损坏传感器。

(4)在使用ADC0832时,需要注意接线和程序的编写,以确保正确读取和处理ADC0832的输出。

(5)在调试过程中,可以使用调试工具(如示波器、万用表)来检查信号和电路的正确性,以及确认程序的正确性。

(6)最后,应该对整个系统进行全面测试,以确保读数准确、响应速度快,并且能够稳定工作。

总之,调试单片机电子秤需要仔细检查硬件和软件,并进行适当的校准和测试,以确保其准确性和稳定性。同时也需要我们耐心和细心,只有不断改进和提高自己的调试能力,才能够取得最终的成功。


5 总结与展望

This design is based on the electronic scale of 51 microcontroller. It aims to design a high-precision and high-stability electronic scale to meet the needs for weighing accuracy and stability in actual production and life. This design adopts the traditional bridge weighing scheme. On this basis, it combines the characteristics of the 51 microcontroller to achieve high-precision and high-stability weighing functions, and displays the weighing results in real time through the LCD12864 display module.

This design has certain academic significance and application value. In terms of academics, this design combines the traditional bridge weighing scheme with modern single-chip microcomputer technology to achieve high-precision and high-stability weighing functions, providing a new idea and development for the research and development of electronic scales. method. In terms of application, this design can be widely used in various occasions that require accurate weighing, such as laboratories, industrial production, commerce and other fields, and has very broad application prospects.

This design has the following advantages, innovations and features:

(1) High precision and high stability: This design adopts the traditional bridge weighing scheme, and on this basis combines the characteristics of the 51 microcontroller to achieve high precision and high stability weighing functions.

(2) Strong practicability: This design uses the LCD12864 display module to display the weighing results in real time, which is simple, intuitive and easy to use.

(3) Flexible design: The hardware and software designs of this design are relatively independent and can be easily combined and improved.

(4) Low cost: The hardware devices used in this design are low in cost and easy to produce and promote.

At present, this design has reached a high level, but there are still some problems and improvement directions:

(1) Limited weighing range: The weighing range of this design is narrow, and the weighing range needs to be further expanded to meet more actual needs.

(2) Insufficient data processing capabilities: The 51 microcontroller used in this design has limited data processing capabilities, and the data processing capabilities need to be further improved to meet higher accuracy and stability requirements.

(3) Reliability needs to be improved: In actual use of this design, some failures may occur, and its reliability and stability need to be further improved.

To sum up, this electronic weighing course design based on the 51 microcontroller has certain academic significance and application value. It has the advantages and characteristics of high precision, high stability, strong practicability, flexible design, and low cost. However, there are still some problems and improvement directions, and the system can continue to be improved and perfected in the future to meet the needs of different occasions.

references

  1. Yang Sheding. Design of digital electronic scale under 51 microcontroller [J]. Electronic Technology and Software Engineering, 2019(22):2.
  2. Zhang Feifan, Zhou Zhibin. Design of electronic scale based on microcontroller control[J]. Digital Technology and Application, 2018, 000(001):15-16.
  3. Zhang Xiangyu, Lu Xikun, Hou Fanbo, et al. Design of electronic scale based on 51 microcontroller [J]. 2022(21).
  4. Guo Honglin. Design analysis of digital electronic scale under MCS-51 microcontroller[J]. Digital World, 2020.DOI:CNKI:SUN:SJSM.0.2020-02-307.
  5. Zhao Yun, Li Zhen, Li Haifeng, et al. Electronic scale weight alarm system based on 51 microcontroller [J]. Software, 2020, 41(4):5.DOI:CNKI:SUN:RJZZ.0.2020-04-021.
  6. Zhou Linhai, Liu Liqin. Design of electronic scale based on 51 microcontroller [J]. Guangdong Communication Technology, 2018, 38(11):5.DOI:CNKI:SUN:GUDO.0.2018-11-018.
  7. Shao Hua, Lobsang Langa. Measurement performance analysis of resistance strain sensor [J]. Shandong Transportation Science and Technology, 2022(1):3.
  8. Shen Qianqian. Research on text display at the junction of left and right half screens based on 51 microcontroller LCD12864 [J]. Journal of Chuzhou Vocational and Technical College, 2021(004):020.
  9. Zhang Xiangyu, Lu Xikun, Hou Fanbo, et al. Design of electronic scale based on 51 microcontroller [J]. Electronic Testing, 2019(21):3.DOI:CNKI:SUN:WDZC.0.2019-21-010.


Appendix

Appendix A Circuit Schematic Diagram

Appendix B Program Code

Main.c:

#include<reg51.h>

#include<intrins.h>

#include <ZM.h>

#define LCD P0

#define GPIO_KEY P1



sbit price_add1=P1^0;

sbit price_reduce1=P1^1;

sbit price_add2=P1^2;

sbit price_reduce2=P1^3;

sbit weight_reduce=P1^4;

sbit weigth_clear=P1^5;

sbit warning_add=P1^6;

sbit warning_reduce=P1^7;



sbit EN=P2^0;

sbit RW=P2^1;

sbit RS=P2^2;

sbit CS1=P2^3;

sbit CS2=P2^4;

sbit BUSY=P0^0;

sbit beep=P2^7;

sbit ADCS =P3^5;

sbit ADDI =P3^7;  

sbit ADDO =P3^7;  

sbit ADCLK =P3^6;







unsigned char a,i,j,k,ad_data;



float press=0.0,press_r=0.0;

float warning=2.5;

int b;

int num=1,num_t=0;







float sum=0;

float price1=10;

float weight_temp=0;



void delay(unsigned char a)

{

unsigned char i,j;

for(i=0;i<a;i++)

for(j=0;j<100;j++)

{

;

}



}





void temer1() interrupt 2

{

EX1=0;





 

  if(price_add1==0)//涨价按键1按下,单价增长0.5

{

while(!price_add1);

price1=price1+0.5;

}

else if(price_add2==0)//涨价按键2按下,单价增长1

{

while(!price_add2);

price1=price1+1;

}

else if(price_reduce1==0)//降价按键1按下,单价下降0.5

{

while(!price_reduce1);

price1=price1-0.5;

}

else if(price_reduce2==0)//降价按键2按下,单价下降1

{

while(!price_reduce2);

price1=price1-1;

}

else if(weight_reduce==0)//去皮按键按下,去除皮重

{

while(!weight_reduce);

weight_temp=press;

}

else if(weigth_clear==0)//去皮清零按键按下,清除皮重

{

while(!weigth_clear);

weight_temp=0;

}

else if(warning_add==0)//报警值增加按键按下,报警值增加0.5

{

while(!warning_add);

warning+=0.5;

}

else if(warning_reduce==0)//报警值减少按键按下,报警值减少0.5

{

while(!warning_reduce);

warning-=0.5;

}



 delay(100);

  EX1=1;

 }



 void weight_alarm(void)

{

 if(press_r>warning)                        

 {

           beep=0;          //则启动报警



 }    

  else

       beep=1;



}



//采集并返回

unsigned char Adc0832(unsigned char channel)     //AD转换返回结果

{

     unsigned char j,i=0,ndat=0;

    unsigned int dat=0;



    if(channel==0)channel=2;

    if(channel==1)channel=3;

    ADDI=1;

    _nop_();

    _nop_();

    ADCS=0;//拉低CS端

    _nop_();

    _nop_();

    ADCLK=1;//拉高CLK端

    _nop_();

    _nop_();

    ADCLK=0;//拉低CLK端,形成下降沿1

    _nop_();

    _nop_();

    ADCLK=1;//拉高CLK端

    ADDI=channel&0x1;

    _nop_();

    _nop_();

    ADCLK=0;//拉低CLK端

    _nop_();

    _nop_();

    ADCLK=1;//拉高CLK端

    ADDI=(channel>>1)&0x1;

    _nop_();

    _nop_();

ADCLK=0;//拉低CLK端,形成下降沿3

    ADDI=1;//控制命令结束

    _nop_();

    _nop_();

    dat=0;

    for(i=0;i<8;i++)

    {

        dat|=ADDO;//收数据

        ADCLK=1;

        _nop_();

        _nop_();

        ADCLK=0;//形成一次时钟脉冲

        _nop_();

        _nop_();

        dat<<=1;

        if(i==7)dat|=ADDO;

    }  

    for(i=0;i<8;i++)

    {

        j=0;

        j=j|ADDO;//收数据

        ADCLK=1;

        _nop_();

        _nop_();

        ADCLK=0;//形成一次时钟脉冲

        _nop_();

        _nop_();

        j=j<<7;

        ndat=ndat|j;

        if(i<7)ndat>>=1;

    }

    ADCS=1;//拉低CS端

    ADCLK=0;//拉低CLK端

    ADDO=1;//拉高数据端,回到初始状态

    dat<<=8;

    dat|=ndat;

    return(dat);            //return ad k         

}



void data_pro(void)

{       

if(0<ad_data<256)               

 {     

  int vary=ad_data;

  press=(0.019531*vary);   

  }     

}



void total(float w,float p)

{

sum=w*p;

}

unsigned char t1[6]={"000.00"};

void turn(float t_float)

{

int temp=(int)t_float;

t1[0]=temp/100+0X30;

t1[1]=(temp%100)/10+0X30;

t1[2]=temp%10+0X30;

temp=(int)(t_float*100);

t1[4]=(temp%100)/10+0X30;

t1[5]=temp%10+0X30;

}



void checkbusy(void)

{

EN=1;

RW=1;

RS=0;

LCD=0XFF;

if(BUSY);

}



void writecode(unsigned char dat)  //写命令

{

checkbusy();

EN=1;

RW=0;

RS=0;

LCD=dat;

EN=1;

EN=0;

}

void writedata(unsigned char dat)  //写数据

{

checkbusy();

EN=1;

RW=0;

RS=1;

LCD=dat;

EN=1;

EN=0;

}

void displayzifu(unsigned char page,unsigned char lineaddress,int n,  unsigned char table[])

{

unsigned char  temp[16];

if(lineaddress<0X80)

{

CS1=1;

CS2=0;

}

for(j=0;j<n;j++)

    {

if(lineaddress>=0X80)

{

CS1=0;

CS2=1;

lineaddress=lineaddress-0X40;

}

b=table[j]-0X20;

for(k=0;k<16;k++)

{

temp[k]=ch2[b][k];

}

writecode(page);

writecode(lineaddress);

for(i=0;i<8;i++)

{

writedata(temp[i]);

}

writecode(page+1);

writecode(lineaddress);

for(i=8;i<16;i++)

        {

writedata(temp[i]);

}

lineaddress+=8;

    }

}

void clear(unsigned char page,unsigned char lineaddress,int n,  unsigned char table[])

{

 unsigned char  temp[16];

   if(lineaddress<0X80)

  {CS1=1;

  CS2=0;}





  for(j=0;j<n;j++)

    {  

    if(lineaddress>=0X80)

      {

      CS1=0;

        CS2=1;

       lineaddress=lineaddress-0X40;

       }

     b=table[j]-0X20;

     for(k=0;k<16;k++)

       {temp[k]=ch2[b][k];}



        writecode(page);

        writecode(lineaddress);

       for(i=0;i<8;i++)

         { writedata(temp[i]);}



       writecode(page+1);

       writecode(lineaddress);

       for(i=8;i<16;i++)

        { writedata(temp[i]);}

  lineaddress+=8;

    }

}

void displayhanzi(unsigned char page,unsigned char lineaddress,int n,  unsigned char table[][16])

{

unsigned char  temp[32];

if(lineaddress<0X80)

   {

CS1=1; //left

CS2=0;

}

for(j=0;j<n;j++)

    {

if(lineaddress>=0X80)

{

CS1=0; //right

        CS2=1;

lineaddress=lineaddress-0X40;

}

for(k=0;k<16;k++)

{

temp[k]=table[j][k];

}

j+=1;

for(k=0;k<16;k++)

{

temp[16+k]=table[j][k];

}

        writecode(page);

        writecode(lineaddress);

for(i=0;i<16;i++)

        {

writedata(temp[i]);

}

writecode(page+1);

writecode(lineaddress);

for(i=16;i<32;i++)

        {

writedata(temp[i]);

}

lineaddress+=16;

    }

}



void lcdinti()

{   

writecode(0X3f);//显示开关关

    writecode(0XC0);//修改显示起始行

    writecode(0XB8);//修改页地址,x地址

    writecode(0X40);//修改列地址,y地址

     

}



void main()

{



unsigned char t[3]={'/','K','G'};

char m=':';

EA=1;

    EX1=1;

lcdinti();//LCD初始化

    /*LCD清屏*/

clear(0XB8,0X40,16,&table2);

clear(0XBa,0X40,16,&table2);

clear(0XBc,0X40,16,&table2);

clear(0XBe,0X40,16,&table2);

displayhanzi(0XB8,0X40,8,&TITLE);

/*显示报警值*/

    turn(warning);

displayzifu(0XB8,0X78,5,&t1[1]);

displayzifu(0XB8,0xB0,2,&t[1]);

displayhanzi(0XBa,0X40,4,&WEIGHT);

displayzifu(0XBa,0X60,1,&m);

displayhanzi(0XBc,0X40,4,&PRICE);

displayzifu(0XBc,0X60,1,&m);

displayhanzi(0XBE,0X40,4,&TOTAL);

displayzifu(0XBe,0X60,1,&m);

while(1)

{

/*读取ADC,并显示*/

ad_data =Adc0832(0);    //采样值存储单元初始化为0

data_pro();

press_r=press-weight_temp;

        /*根据ADC数据,判断是否报警*/

weight_alarm();

turn(warning);

displayzifu(0XB8,0X78,5,&t1[1]);

delay(100);

turn(press_r);

displayzifu(0XBa,0X68,5,&t1[1]);

displayzifu(0xba,0xB0,2,&t[1]);

delay(100);

/*显示单价*/

turn(price1);

displayzifu(0XBc,0X68,6,&t1[0]);

displayhanzi(0xbc,0x98,2,&YUAN);

displayzifu(0XBc,0XA8,3,&t);

delay(100);

        /*计算单价,并显示*/

total(press_r,price1);

turn(sum);

displayzifu(0XBe,0X68,6,&t1);

displayhanzi(0xbe,0xB0,2,&YUAN);

delay(100);



}

}  

ZM.h:

#ifndef __ZM_H__

#define __ZM_H__



char point='.';

char table2[16]={"               "};

unsigned char code ch2[95][16]={

{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},

{0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x33,0x30,0x00,0x00,0x00},

{0x00,0x10,0x0C,0x06,0x10,0x0C,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},

{0x40,0xC0,0x78,0x40,0xC0,0x78,0x40,0x00,0x04,0x3F,0x04,0x04,0x3F,0x04,0x04,0x00},

{0x00,0x70,0x88,0xFC,0x08,0x30,0x00,0x00,0x00,0x18,0x20,0xFF,0x21,0x1E,0x00,0x00},

{0xF0,0x08,0xF0,0x00,0xE0,0x18,0x00,0x00,0x00,0x21,0x1C,0x03,0x1E,0x21,0x1E,0x00},

{0x00,0xF0,0x08,0x88,0x70,0x00,0x00,0x00,0x1E,0x21,0x23,0x24,0x19,0x27,0x21,0x10},

{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xB0,0x70,0x00,0x00,0x00,0x00,0x00},

{0x00,0x00,0x00,0xE0,0x18,0x04,0x02,0x00,0x00,0x00,0x00,0x07,0x18,0x20,0x40,0x00},

{0x00,0x02,0x04,0x18,0xE0,0x00,0x00,0x00,0x00,0x40,0x20,0x18,0x07,0x00,0x00,0x00},

{0x40,0x40,0x80,0xF0,0x80,0x40,0x40,0x00,0x02,0x02,0x01,0x0F,0x01,0x02,0x02,0x00},

{0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x1F,0x01,0x01,0x01,0x00},

{0x10,0x16,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},

{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01},

{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x00,0x00},

{0x00,0x00,0x00,0x00,0x80,0x60,0x18,0x04,0x00,0x60,0x18,0x06,0x01,0x00,0x00,0x00},

{0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00},

{0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00},

{0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00},

{0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00},

{0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00},

{0x00,0xF8,0x08,0x88,0x88,0x08,0x08,0x00,0x00,0x19,0x21,0x20,0x20,0x11,0x0E,0x00},

{0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00},

{0x00,0x38,0x08,0x08,0xC8,0x38,0x08,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00},

{0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00},

{0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x00,0x31,0x22,0x22,0x11,0x0F,0x00},

{0x00,0x00,0x00,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00},

{0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x60,0x00,0x00,0x00,0x00},

{0x00,0x00,0x80,0x40,0x20,0x10,0x08,0x00,0x00,0x01,0x02,0x04,0x08,0x10,0x20,0x00},

{0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x00},

{0x00,0x08,0x10,0x20,0x40,0x80,0x00,0x00,0x00,0x20,0x10,0x08,0x04,0x02,0x01,0x00},

{0x00,0x70,0x48,0x08,0x08,0x08,0xF0,0x00,0x00,0x00,0x00,0x30,0x36,0x01,0x00,0x00},

{0xC0,0x30,0xC8,0x28,0xE8,0x10,0xE0,0x00,0x07,0x18,0x27,0x24,0x23,0x14,0x0B,0x00},

{0x00,0x00,0xC0,0x38,0xE0,0x00,0x00,0x00,0x20,0x3C,0x23,0x02,0x02,0x27,0x38,0x20},

{0x08,0xF8,0x88,0x88,0x88,0x70,0x00,0x00,0x20,0x3F,0x20,0x20,0x20,0x11,0x0E,0x00},

{0xC0,0x30,0x08,0x08,0x08,0x08,0x38,0x00,0x07,0x18,0x20,0x20,0x20,0x10,0x08,0x00},

{0x08,0xF8,0x08,0x08,0x08,0x10,0xE0,0x00,0x20,0x3F,0x20,0x20,0x20,0x10,0x0F,0x00},

{0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,0x20,0x3F,0x20,0x20,0x23,0x20,0x18,0x00},

{0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,0x20,0x3F,0x20,0x00,0x03,0x00,0x00,0x00},

{0xC0,0x30,0x08,0x08,0x08,0x38,0x00,0x00,0x07,0x18,0x20,0x20,0x22,0x1E,0x02,0x00},

{0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,0x20,0x3F,0x21,0x01,0x01,0x21,0x3F,0x20},

{0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00},

{0x00,0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00,0x00},

{0x08,0xF8,0x88,0xC0,0x28,0x18,0x08,0x00,0x20,0x3F,0x20,0x01,0x26,0x38,0x20,0x00},

{0x08,0xF8,0x08,0x00,0x00,0x00,0x00,0x00,0x20,0x3F,0x20,0x20,0x20,0x20,0x30,0x00},

{0x08,0xF8,0xF8,0x00,0xF8,0xF8,0x08,0x00,0x20,0x3F,0x00,0x3F,0x00,0x3F,0x20,0x00},

{0x08,0xF8,0x30,0xC0,0x00,0x08,0xF8,0x08,0x20,0x3F,0x20,0x00,0x07,0x18,0x3F,0x00},

{0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,0x0F,0x10,0x20,0x20,0x20,0x10,0x0F,0x00},

{0x08,0xF8,0x08,0x08,0x08,0x08,0xF0,0x00,0x20,0x3F,0x21,0x01,0x01,0x01,0x00,0x00},

{0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,0x0F,0x18,0x24,0x24,0x38,0x50,0x4F,0x00},

{0x08,0xF8,0x88,0x88,0x88,0x88,0x70,0x00,0x20,0x3F,0x20,0x00,0x03,0x0C,0x30,0x20},

{0x00,0x70,0x88,0x08,0x08,0x08,0x38,0x00,0x00,0x38,0x20,0x21,0x21,0x22,0x1C,0x00},

{0x18,0x08,0x08,0xF8,0x08,0x08,0x18,0x00,0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00},

{0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00},

{0x08,0x78,0x88,0x00,0x00,0xC8,0x38,0x08,0x00,0x00,0x07,0x38,0x0E,0x01,0x00,0x00},

{0xF8,0x08,0x00,0xF8,0x00,0x08,0xF8,0x00,0x03,0x3C,0x07,0x00,0x07,0x3C,0x03,0x00},

{0x08,0x18,0x68,0x80,0x80,0x68,0x18,0x08,0x20,0x30,0x2C,0x03,0x03,0x2C,0x30,0x20},

{0x08,0x38,0xC8,0x00,0xC8,0x38,0x08,0x00,0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00},

{0x10,0x08,0x08,0x08,0xC8,0x38,0x08,0x00,0x20,0x38,0x26,0x21,0x20,0x20,0x18,0x00},

{0x00,0x00,0x00,0xFE,0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x7F,0x40,0x40,0x40,0x00},

{0x00,0x0C,0x30,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x06,0x38,0xC0,0x00},

{0x00,0x02,0x02,0x02,0xFE,0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x7F,0x00,0x00,0x00},

{0x00,0x00,0x04,0x02,0x02,0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},

{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80},

{0x00,0x02,0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},

{0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x19,0x24,0x22,0x22,0x22,0x3F,0x20},

{0x08,0xF8,0x00,0x80,0x80,0x00,0x00,0x00,0x00,0x3F,0x11,0x20,0x20,0x11,0x0E,0x00},

{0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x0E,0x11,0x20,0x20,0x20,0x11,0x00},

{0x00,0x00,0x00,0x80,0x80,0x88,0xF8,0x00,0x00,0x0E,0x11,0x20,0x20,0x10,0x3F,0x20},

{0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x22,0x22,0x22,0x22,0x13,0x00},

{0x00,0x80,0x80,0xF0,0x88,0x88,0x88,0x18,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00},

{0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x6B,0x94,0x94,0x94,0x93,0x60,0x00},

{0x08,0xF8,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20},

{0x00,0x80,0x98,0x98,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00},

{0x00,0x00,0x00,0x80,0x98,0x98,0x00,0x00,0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00},

{0x08,0xF8,0x00,0x00,0x80,0x80,0x80,0x00,0x20,0x3F,0x24,0x02,0x2D,0x30,0x20,0x00},

{0x00,0x08,0x08,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00},

{0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x20,0x3F,0x20,0x00,0x3F,0x20,0x00,0x3F},

{0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20},

{0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00},

{0x80,0x80,0x00,0x80,0x80,0x00,0x00,0x00,0x80,0xFF,0xA1,0x20,0x20,0x11,0x0E,0x00},

{0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x0E,0x11,0x20,0x20,0xA0,0xFF,0x80},

{0x80,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x20,0x20,0x3F,0x21,0x20,0x00,0x01,0x00},

{0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x33,0x24,0x24,0x24,0x24,0x19,0x00},

{0x00,0x80,0x80,0xE0,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x1F,0x20,0x20,0x00,0x00},

{0x80,0x80,0x00,0x00,0x00,0x80,0x80,0x00,0x00,0x1F,0x20,0x20,0x20,0x10,0x3F,0x20},

{0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x00,0x01,0x0E,0x30,0x08,0x06,0x01,0x00},

{0x80,0x80,0x00,0x80,0x00,0x80,0x80,0x80,0x0F,0x30,0x0C,0x03,0x0C,0x30,0x0F,0x00},

{0x00,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x31,0x2E,0x0E,0x31,0x20,0x00},

{0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x80,0x81,0x8E,0x70,0x18,0x06,0x01,0x00},

{0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x21,0x30,0x2C,0x22,0x21,0x30,0x00},

{0x00,0x00,0x00,0x00,0x80,0x7C,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x3F,0x40,0x40},

{0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00},

{0x00,0x02,0x02,0x7C,0x80,0x00,0x00,0x00,0x00,0x40,0x40,0x3F,0x00,0x00,0x00,0x00},

{0x00,0x06,0x01,0x01,0x02,0x02,0x04,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},

};



unsigned char code TITLE[8][16]={



//报(0)警(1)值(2):(3)

{0x10,0x10,0x10,0xFF,0x10,0x90,0x00,0xFE,0x82,0x82,0x82,0x92,0xA2,0x9E,0x00,0x00},

{0x04,0x44,0x82,0x7F,0x01,0x00,0x00,0xFF,0x80,0x43,0x2C,0x10,0x2C,0x43,0x80,0x00},/*"报",0*/

/* (16 X 16 , 宋体 )*/



{0x12,0xEA,0xAF,0xAA,0xEA,0x0F,0xFA,0x02,0x88,0x8C,0x57,0x24,0x54,0x8C,0x84,0x00},

{0x02,0x02,0xEA,0xAA,0xAA,0xAB,0xAA,0xAB,0xAA,0xAA,0xAA,0xAA,0xEA,0x02,0x02,0x00},/*"警",1*/

/* (16 X 16 , 宋体 )*/



{0x00,0x80,0x60,0xF8,0x07,0x04,0xE4,0xA4,0xA4,0xBF,0xA4,0xA4,0xE4,0x04,0x00,0x00},

{0x01,0x00,0x00,0xFF,0x40,0x40,0x7F,0x4A,0x4A,0x4A,0x4A,0x4A,0x7F,0x40,0x40,0x00},/*"值",2*/

/* (16 X 16 , 宋体)*/



{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},

{0x00,0x00,0x36,0x36,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*":",3*/

/* (16 X 16 , 宋体)*/



};

unsigned char code WEIGHT[4][16]={

{0x10,0x10,0x14,0xD4,0x54,0x54,0x54,0xFC,0x52,0x52,0x52,0xD3,0x12,0x10,0x10,0x00},

{0x40,0x40,0x50,0x57,0x55,0x55,0x55,0x7F,0x55,0x55,0x55,0x57,0x50,0x40,0x40,0x00},/*"重",0*/



{0x20,0x20,0x20,0xBE,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xBE,0x20,0x20,0x20,0x00},

{0x00,0x80,0x80,0xAF,0xAA,0xAA,0xAA,0xFF,0xAA,0xAA,0xAA,0xAF,0x80,0x80,0x00,0x00},/*"量",1*/

};

unsigned char code PRICE[4][16]={

{0x00,0x00,0xF8,0x49,0x4A,0x4C,0x48,0xF8,0x48,0x4C,0x4A,0x49,0xF8,0x00,0x00,0x00},

{0x10,0x10,0x13,0x12,0x12,0x12,0x12,0xFF,0x12,0x12,0x12,0x12,0x13,0x10,0x10,0x00},/*"单",0*/



{0x00,0x80,0x60,0xF8,0x07,0x40,0x20,0x90,0x0C,0x03,0x0C,0x90,0x20,0x40,0x40,0x00},

{0x01,0x00,0x00,0xFF,0x00,0x80,0x60,0x1F,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00},/*"价",1*/

};

unsigned char code TOTAL[4][16]={

{0x00,0x00,0x00,0xF1,0x12,0x14,0x10,0x10,0x10,0x14,0x12,0xF1,0x00,0x00,0x00,0x00},

{0x40,0x30,0x00,0x03,0x39,0x41,0x41,0x45,0x59,0x41,0x41,0x73,0x00,0x08,0x30,0x00},/*"总",0*/



{0x00,0x80,0x60,0xF8,0x07,0x40,0x20,0x90,0x0C,0x03,0x0C,0x90,0x20,0x40,0x40,0x00},

{0x01,0x00,0x00,0xFF,0x00,0x80,0x60,0x1F,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00},/*"价",1*/

};



unsigned char code YUAN[2][16]={

{0x20,0x20,0x22,0x22,0x22,0xE2,0x22,0x22,0x22,0xE2,0x22,0x22,0x22,0x20,0x20,0x00},

{0x80,0x40,0x20,0x10,0x0C,0x03,0x00,0x00,0x00,0x3F,0x40,0x40,0x40,0x40,0x78,0x00},/*"元",0*/

};



#endif

Guess you like

Origin blog.csdn.net/MYSELFWJC/article/details/132306199