Shanghai Hangxin | Thermal Printer Scheme Share

With the improvement of electronic informatization and automation, the development of barcode recognition technology, the scope of thermal printer’s application is also expanding. From the traditional office and family fax documents, it has quickly rushed to commercial retail, industrial manufacturing, transportation, transportation, and transportation. Logistics, finance, lottery, medical care, education and other emerging professional applications expand.

This article will introduce the design scheme based on Shanghai Hangxin ACM32F403.

1

Print principle

上海航芯 | 热敏打印机方案分享

The principle of thermal printer is to cover a layer of thermal material on the medium base (usually paper), and heated the thermal material for a period of time into dark (usually black and blue). This chemical reaction is performed at a certain temperature. High temperature will accelerate this chemical reaction. When the temperature is lower than 60 ° C, the thermal material needs to be quite long, or even a few years to become dark; and when the temperature is 200 ° C, this reaction will be completed in a few micro seconds.

The thermist printer is optionally heated in the determined position of the thermist paper, which generates the corresponding graphics. Heating is provided by a small electronic heater on the print head that is in contact with thermal material. The form of the heater is discharged into a square point or strip form. The printer is controlled by the printer. When the drive is driven, a graphic corresponding to the heating element is generated on the thermal paper. The same logic circuit to control the heating element is also controlled at the same time, so graphics can be printed on the entire label or paper.

Figure 1. The principle of thermal printer

2

Use a chip

The thermist printer solution described in this article is designed based on the MCU of Shanghai Hangxin ACM32F403 series.

The ACM32F403 chip uses a high-performance core and supports Cortex-M33 and Cortex-M4F instruction sets. The chip kernel supports a set of DSP instructions for digital signal processing, supports single -precision FPU processing floating -point data, and also supports Memory Protection Unit (MPU) to improve the security of applications.

The maximum operating frequency of the ACM32F403 series chips can reach 180MHz, the muddy hardware accelerates, the maximum EFLASH built -in 512KB and the maximum 192kb SRAM. The chip integrates a 12 -bit multi -channel 2M SPS high -precision ADC, a 12 -bit 2 -channel DAC, as many as 3 routes, and the 2 -way comparator. 1 universal 32 -bit timer, 2 basic 16 -bit timer, 1 system watching dogs, 1 independent door dog, a low -power real clock (RTC), built -in multi -way UART, LPUART, SPI,, SPI, SPI, I2C, I2S, CAN, full -speed USB and other rich communication peripherals, built -in algorithm modules such as AES, CRC, TRNG.

3

Characteristic

U Support the printing method of multiple communication interfaces such as Bluetooth, USB, UART

进入 When supporting no task, automatically enter the power -off mode, and the battery life is longer

上海航芯 | 热敏打印机方案分享

Support printing high temperature, lack of paper and low -power alarm

S SPI FLASH stores the font, supports online updates, can adjust the font, size, thickness, etc.

Le Support MCU and BLE chip firmware online upgrade

4

Design

Figure 2. Based on ACM32F403 thermal sensitivity printer design scheme box diagram

5

上海航芯 | 热敏打印机方案分享

Features

1.1 Multi -interface printing process

This scheme can receive data through UART, USB, and Bluetooth interfaces, and use the Timer, GPIO, ADC, SPI and other modules of the ACM32F403 chip for printing work.

The specific process is as follows:

1) Receive data through UART, USB, and Bluetooth interfaces. The data needs to be sent through the GBK code and stored inside the chip;

2) Find the GBK code of each word to the corresponding data in the SPI Flash on the SPI Flash, and transmit it to the printing buffer;

3) The chip controls the speed of the step motor and the time of the printer head heating through the Timer. The GPIO controls the forward and backward and backward steps of heating and controlling the step motor. The ADC detects the temperature of the printer and finally completes the printing work.

Figure 3. Multi -interface printing process

1.2 Font Library Update Process

This plan’s internal Firmware realizes a UART receiving data, SPI download data system, which uses a data format similar to 7816 t = 1 for transmission, and downloads the BIN file of the font to SPI Flash to achieve the download and update of the font. Because of the size of the SPI Flash outside the film, the default only supports 24*24 font printing. If the font is replaced, the font file needs to be downloaded again.

上海航芯 | 热敏打印机方案分享

Figure 4. Font download process

This solution supports the update of the font library, which can adjust the fonts, size, thickness and other parameters of the printing font. After the font is updated, the Firmware code needs to be modified to achieve the printing of different fonts.

Figure 5. Font settings parameters

1.3 Font Library call process

The SPI Flash in this plan can store the font size of 16*16 or 24*24, and has a complete supporting FIRMware code.

The specific font call process is as follows:

1) GBK code that needs to be printed from UART, USB or BLE interface;

2) Calculate the inner code of the text in the font based on the GBK code;

上海航芯 | 热敏打印机方案分享

3) Read the data in the inner code in the font through the SPI interface. The data length is determined according to the font size;

4) Transfer the read data to the printing machine to complete the printing.

Figure 6. Fiber call processing process

上海航芯 | 热敏打印机方案分享

1.4 Data printing process

上海航芯 | 热敏打印机方案分享

Figure 7. Data printing software process

Figure 8. Print movement and step motor schematic diagram

Data printing process:

1) Pressing process of printer;

2) Transfer the printing data through the SPI interface to the printer cache;

3) Determine whether it is the first line, if it is turned on the motor Timer, and further;

4) Determine whether it is the last line or a lack of paper, if it is entering the printing process;

上海航芯 | 热敏打印机方案分享

5) Start heating, turn on the heating TIMER, and wait for heating to complete;

6) cycle 2) ~ 5) until the printing is completed.

Printer boot process:

1) Set the printer DST (selected pulse) signal to low level;

2) Set the printer LATCH (data lock) signal to high level;

3) Open the heat -sensitive head logic power supply;

4) Open the heating head heating power;

Printing machine process:

1) Stop heating Timer;

2) Turn off the heating head heating power;

3) Set the printer DST (selected pulse) signal to low level;

4) Set the printer LATCH (data lock) signal to high level;

上海航芯 | 热敏打印机方案分享

5) Turn off the heating head logic power supply.

1.5 Power Control System Introduction

Figure 9. Power control system introduction

1) Power supply: The system uses a single -section lithium battery 4.2V or USB 5V power supply;

2) Abnormal: When the internal program of MCU runs/crashes, you can first press the SW1 reset MCU.

3) Power power: When the system is not power, press the opening/shutdown key. At this time, the MCU is powered on, and the MCU starts starting from EFLASH. After the initialization is successful, the Power_ON/OFF signal is high. Light, full lithium battery charging _ Changliang), if the initialization fails or detects abnormal/error (such as the low battery power, the failure of the peripheral initialization, the communication is abnormal, etc.) Changliang, ERR2_1S Flash, ERR3_ Flash);

4) Ship off: When the system is powered on, hold the/shut down key, Power_check pin will detect a drop edge, and then there will be continuous low levels. After loosening the button, lower the power control signal;

5) The order of normal shutdown is: destroy the lights first, then disconnect the motor to drive the power and peripheral power supply, and then disconnect the MCU power supply;

6) PB1 is the opening/shutdown button and the system wake -up key. SW1 is the system wake -up button and reset key. Generally, the user presses the system to wake up, and the long press is normal.

7) When there is no printing task, the motor power and peripheral power are needed to save lithium battery power; so before the system enters the standby regularly, the MCU turns off the motor drive power/peripheral power supply, and enter the standby.

RELATED POST

Recommendation for home standby non -prescription medicines

Recommendation for home standby non -prescription medicines Take "Jilian Mei Tan: Chinese people should use medicine like this" Common symptoms…

Goddess of “BMW”: Belon Division C896 Baby carts use one week experience

Goddess of "BMW": Belon Division C896 Baby carts use one week experience Regarding the question of whether to buy a…

CPB skin key to the new clean skin series Jingyao listing

CPB skin key to the new clean skin series Jingyao listing In December 2021, Temple -level beauty luxury, Clé de…

Sichuan 5 -month -old baby girl’s kidney has been full of stones, but because of the parents did this!

Sichuan 5 -month -old baby girl's kidney has been full of stones, but because of the parents did this! 4…