- Home >> Technical Service >> MCU
Application of Single Chip Microcomputer Interface Technology
The Characteristics and Application Design of SCM Interface Technology
The interface refers to the mutual interface of various characteristic components. For a single-chip microcomputer, the part where the CPU communicates with other peripheral circuits and components is the interface. The interface is divided into the software part and the hardware part. Interface software refers to the program designed to realize information exchange; hardware interface refers to the connection and logic circuit between two component entities. Under the current technical conditions, the hardware interface must be supported by the corresponding interface software.
1.The characteristics of single-chip interface technology
The single-chip microcomputer itself already has some commonly used functional components, and we know that the application of the single-chip microcomputer is mainly oriented to the measurement and control system. Therefore, compared with the interface technology of the general-purpose computer, the interface technology of the single-chip microcomputer has the following characteristics.
1) The interface of the single-chip microcomputer often focuses more on the man-machine interface and the control interface. The human-machine interface of a general-purpose microcomputer is a standard keyboard and display, which is more complicated than that of a single-chip microcomputer, and its functions are much stronger. The keyboard of the PC itself is a single-chip microcomputer system, which can scan more than 100 keys, and has functions such as eliminating shaking and heavy key processing. In addition, general-purpose computers are not oriented to measurement and control applications, so they usually do not have measurement and control interfaces. Expansion boards must also be used if required;
2) The interfaces of single-chip microcomputers are often designed by users themselves, and there will be no uniform standards and specifications. And the same function can also adopt different interface design schemes. And for the interface parts of general-purpose microcomputer, generally have been designed, the user also can only use the function that it provides, but can not change its original design. Therefore, the interface design of single-chip microcomputer often requires more skills and experience;
3) The scale of the single-chip application system is usually relatively small, and the capacity of the memory is not large. Therefore, large-capacity memory is rarely used, and usually only static memory is used, and dynamic memory is rarely used. In addition, external storage (floppy disk, hard disk, etc.) is rarely used. In general-purpose microcomputers, large-capacity dynamic memory is usually used, and floppy disks and hard disks are indispensable large-capacity external memory.
2. Application of MCU Interface Technology——PS/2 Interface Technology
As an earlier input interface, the development technology based on PS/2 is quite mature, but these mature technologies are mainly in the hands of some motherboard developers and mouse and keyboard developers. Moreover, the official reference materials of the PS/2 protocol are hard to find, so this topic will monitor and analyze the data flow of the PS/2 mouse in actual work and combine the previous development experience as the main development basis, through continuous debugging and improvement. Complete the development of PS/2 mouse interface.
PS/2 mice and keyboards implement a two-way synchronous serial protocol. In other words, one bit of data is sent every time the data line is sent and every time a pulse is sent on the clock line, it is read in. The keyboard/mouse can send data to the host and the host can send data to the device, but the host always has priority on the bus, and it can suppress communication from the keyboard/mouse at any time by pulling the clock low. The clock during data transmission is always provided by the device. If the host wants the device to send data, it must first tell the device to generate a clock signal.
2.1 Basic design of hardware structure
The PS/2 interface can be directly connected to the single-chip microcomputer. Connect the VCC and GND of the single-chip microcomputer to the No. 4 and No. 3 pins of the PS/2 interface respectively to realize power supply to the device. Connect P2.0 and P2.1 to the No. 1 and No. 5 pins of the PS/2 interface respectively, as the data line and the clock line to realize the signal transmission from the MCU to the PS/2 interface.
Connect six buttons to the P2.2-P2.7 pins of the microcontroller, which are used to simulate the up, down, left, and right movement of the mouse and the left and right buttons of the mouse. This module is used to test the basic functions of PS/2 interface devices. The P1 port is connected with 8 light-emitting diodes, which will display relevant content during debugging and testing. P3.0-P3.1 is connected to the serial port module to realize the communication between the single chip microcomputer and PC. This module is used for expansion and testing.
The following introduces the connection between the PS/2 interface device and the PC through the serial port: This module is an expansion and testing module, which is used to realize the serial port to PS/2 interface, and can test the function and performance of the PS/2 interface.
Connect the PC with the PS/2 interface device through the serial port, write test software on the PC, the test software sends certain mouse datagrams to the MCU through the serial port, and the device forwards these datagrams to the PS/2 interface, which makes debugging more convenient It is flexible and also realizes an extended application of the PS/2 interface device of this subject.
The 51 single-chip microcomputer has a full-duplex serial communication port, so the serial communication between the single-chip microcomputer and the computer can be carried out. However, the computer’s serial port is at RS232 level, while the microcontroller’s serial port is at TTL level. There must be a level conversion circuit between the two. Connect 3 wires: GND of pin 5, RXD of pin 2, TXD of pin 3. This is the easiest connection method.
2.2 Software Structure Design
The software of the PS/2 interface device mainly includes six parts: PS/2 interface driver module, Reset mode processing module, stream mode processing module, display processing module, key processing module, and main program module.
The functions of each module are as follows:
1) PS/2 interface driver module: realize the basic operation of the PS/2 interface, including sending a byte of data to the PS/2 port, receiving a byte of data from the PS/2 port and other operations; 2) Reset mode Processing module: complete Reset mode operation; 3) Stream mode processing module: complete Stream mode operation, provide a function to send a complete mouse datagram; 4) display processing module: provide display function for debugging and testing; 5) key processing Module: Use six buttons to simulate the up, down, left, and right movement of the mouse and the left and right buttons. When a button is pressed, the corresponding mouse datagram is generated, and the function of sending mouse datagram in the Stream mode processing module is called, and the data packet is sent to the host ;6) Main program module: Coordinate the stable operation of each module.
2.3 PS/2 mouse interface device state transition
By analyzing the signal of the PS/2 mouse in the actual use process, we know that after the mouse is powered on for a certain period of time, the host will send multiple reset signals to the mouse, and the motor on the mouse will enter the Reset mode. In Reset mode, the host will detect and configure the mouse, and this process is also called mouse initialization. When the host restarts and sleeps and wakes up, the mouse will also enter the Reset mode and initialize the mouse. In Stream mode, the device can send mouse datagrams to the host. Of course, the host may temporarily suppress the sending of mouse datagrams during this period.
The above are the characteristics and application design of the single-chip microcomputer interface technology introduced by Shenzhen Zuchuang Microelectronics Co., Ltd. for you. We have rich experience in customized development of smart electronic products, can evaluate the development cycle and IC price as soon as possible, and can also calculate the PCBA quotation. We are the agent of Sonix MCU and Yingguang MCU agent, selling and developing MCU and voice IC solutions of Sonix and Yingguang. We act as an agent and develop ICs and solutions of Jieli, Ankai, Quanzhi, realtek and other series, and also develop BLE Bluetooth IC, dual-mode Bluetooth module, wifi module, and Internet of Things module. We have hardware design and software development capabilities. Covering circuit design, PCB design, single-chip microcomputer development, software custom development, APP custom development, WeChat official account development, voice recognition technology, Bluetooth development, wifi technology, etc. It can also undertake the research and development of smart electronic products, the design of household appliances, the development of beauty equipment, the development of Internet of Things applications, the design of smart home solutions, the development of TWS earphones, the development of Bluetooth earphone speakers, the development of children's toys, and the development of electronic education products.
- TOP