At present, with the rapid development of the information industry, all kinds of ships need to be equipped with more high-quality and inexpensive small and medium-sized information monitoring terminals, which are used to monitor meteorological conditions and obtain navigation information to ensure navigation safety.Such as ARM, MIPS, led the 32-bit processor in the applications of information monitoring terminal, shows great advantages, but generally in 32-bit processor embedded systems often need to configure the external FLASH and SDRAM, which makes the development and maintenance of the high cost of the whole system, the design adopts high performance low power AVR microcontroller and LCD module to design information monitoring terminal, with low cost, stable performance, clear display and good man-machine interface, can satisfy the demand for small and medium-sized information monitoring terminal of the ship.
1 overall design
Information monitoring terminal is mainly composed of display control board, keyboard, communication interface and liquid crystal display module. It has functions of data receiving and sending, data display, human-computer interaction and screen brightness adjustment, etc., and its composition is shown in figure 1.
The working process is as follows: after the system is initialized, the information monitoring terminal receives data from the communication interface in accordance with the set working mode, and then sends the data to the LCD display screen through the LCD controller, and responds to the user's operation instructions in real time through the keyboard and display screen.
2 hardware design
2.Liquid crystal display module and single chip microcomputer
The LCD module of choice is EW32F00BCW, a 5-inch, 320-by-240-bit LCD display with performance comparable to the original Japanese DMF50081. However, the price is much lower.The device adopts CCFL backlight display, the display mode is full reflection display, the display color is blue with white characters, and the external size is 139.0 w x 102.5 h x 13.2 DMM.
The microcontroller adopts ATMEL AVR enhanced microcontroller AT90CAN128.Its main performance is: CMOS technology and RISC architecture;Chip integrated 128 kB FLASH program memory, 4 kB EEPROM and 4 kB SRAM data storage: with JTAG interface;It integrates 8-bit and 16-bit timer/counter, A/D converter, SPI synchronous serial port, UART asynchronous serial port and independent CAN controller.And on the software effective support assembly language and C high - level language.
2.Display control circuit
The RA8835 is a low-cost, versatile LCD controller.It fully covers the existing functions of SED1335, enhances its stability, and has the advantages of newer process and lower power consumption.RA8835 has rich command functions and USES 4-bit data to send in parallel. It can support mixed display of text and graphics, and can present dynamic effects such as three-layer overlapping display of text and graphics, horizontal and vertical scrolling on the LCD screen.Figure 2 is the schematic diagram of the display control circuit. AVR MCU is directly connected to RA8835 through the control line and data line to control the display content and display mode.To store the display content and display it, the RA8835 needs one or two external display caches 62256.The keyboard USES 2x4 matrix interface, two lines are connected at the same time, there are four direction keys, and four function keys of confirm, return, menu and page turning.
2.Communication unit circuit
Since different ship equipment manufacturers provide products and subsystems with different functions and adopt different communication interfaces, information monitoring terminals need to be configured with multiple communication interfaces to communicate with them. Therefore, three commonly used interfaces are designed: RS232 interface, RS422 interface and CAN interface. The circuit composition is shown in figure 3.
AT90CAN128 has a two-channel serial USART interface and outputs TTL level, one of which is converted to RS232 level by level conversion chip MAX232, and the other one is converted to RS422 level by level conversion chip MAX1482.Photoelectric isolation is added between the USART of AT90CAN128 and the level conversion chip, so that the input end and the output end are completely isolated in electricity without interference.AT9 0CAN128 has a built-in CAN controller. The CAN bus transceiver circuit CAN be formed by simply connecting the sending end and receiving end of the controller to the CAN bus transceiver.CTM1050 is a high-speed CAN transceiver chip with isolation. The chip converts the logic level of CAN controller into the differential level of CAN bus and has the isolation function of DC 2500V and ESD protection.In general, RS232 communication is directly connected to the upper computer, and the distance is relatively short, so the voltage regulator is used for simple protection on RS232 level.When using RS485 and CAN communication, the general distance is long, and more in the cabin, lightning may cause bus damage, so in addition to the design level conversion, must also add isolation protection circuit.
2.Power supply unit circuit
The power supply unit USES the ac 220v power supply when the ship electricity is normal, and automatically realizes the charging, and automatically cuts off the power after being fully charged;In the case of ship electric failure, lithium battery pack is used for power supply, and the circuit composition diagram of power supply unit is shown in figure 4.The external ac 220v power supply is converted to 14 via the adapter.The dc of about 8v is charged through the charging circuit for the lithium battery pack. The protection circuit is used to prevent overcharge, overdischarge, overcurrent and short circuit, and then output two dc 5v through the voltage stabilizing module to supply the AVR MCU system.Due to the special power supply required by LCD backlight display, dc 5v is converted into ac 1 300V by cold cathode backlight inverter to supply LCD backlight lamp.MAX5437 is a 128-level, high-voltage digital potentiometer, using simple SPI interface instead of mechanical adjustment, the DC/DC output of -24 V power supply into -10 ~ 24 V range adjustable, so as to provide negative power supply and contrast adjustment voltage for the LCD module.
3 software design
The system software design adopts the integrated development platform of AVR Studio+Winavr.AVR Studio is under the Windows operating system to write and debug AVR application of embedded development environment (IDE), Winavr is free of AVR development assemblies, AVR Studio cooperate Winavr can support AVR C/C + + program edit, compile, link, and generate the target code, at the same time using the Atmel company design the real-time simulators JTAGICE on mk Ⅱ can achieve the function of system on-line debugging of hardware simulation and the target code download function.In order to facilitate program debugging and improve reliability, software design adopts a top-down, step-by-step refinement of structural, modular design method.The flow chart of the terminal main program is shown in figure 5. After power on, the system is firstly set up for initialization, and then the keyboard status is inquired. If there is a key, press the key to deal with it immediately; otherwise, the data will be automatically received, displayed and regularly updated according to the set working mode.In the process of specific programming, the following aspects should also be noted:
1) in the initialization of the system, it is required to complete the initialization of the I/O port, SPI port, asynchronous serial port, CAN port, etc., of the single-chip microcomputer. Meanwhile, the function modules of the single-chip microcomputer that are not used, such as JTAG port, trans port, etc., are also prohibited to reduce the power consumption of the whole machine.
2) after initialization, the slide position of MAX5437 should be set.
Because there is no EEPROM in it, the software USES the EEPROM of MCU to record the position information of the slide.Considering that the user may adjust the LCD contrast to fly, the program is designed to restore the factory Settings through keyboard operation.
3) use interrupt and query to respond to the keyboard.Because the keyboard line is connected to the MCU interrupt at the same time, the program does not have to query the keyboard state all the time, only after the interrupt is generated to scan the keyboard, thus improving the work efficiency of the MCU.
This paper takes AT90CAN128 as the core, makes use of its abundant on-chip resources, overlaps necessary peripheral circuits, closely combines software design with hardware circuit, and provides a low cost and high reliability design scheme for small and medium-sized shipboard information monitoring terminals.The terminal display clear, stable work, strong controllability, has a high cost performance and a wide range of practicality, as well as excellent promotion and application value.