A trackball signal conversion method
The trackball signal conversion device converts PS2 or quadrature signals into RS232 signals, which solves the anti-interference and transmission stability problems of the trackball interface, and realizes efficient signal processing of the ultrasonic system.
Patent Information
- Application Number
- CN202210696921.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-20
- Publication Date
- 2025-07-29
- Estimated Expiration
- 2042-06-20
AI Technical Summary
The trackball interface in the prior art has poor anti-interference capability and unstable transmission performance, making it difficult to meet the signal transmission needs of ultrasonic diagnostic systems.
The trackball signal conversion device realizes the conversion of PS2 signals or quadrature signals to the RS232 interface signals. The STC15W408AS microcontroller simulates host initialization and parameter settings, simplifies the signal processing flow, and outputs it as a serial port signal.
The signal processing process of ultrasonic systems is simplified, the stability of signal transmission and anti-interference ability are improved, the attention to interface form is reduced, and time is freed for other important tasks.
Smart Images

Figure CN115048328B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technology of medical device processing, and particularly to a method for converting trackball signals. Background Art
[0002] In an ultrasonic diagnostic system, a trackball can be used to implement man-machine dialogue. For example, when using the measurement function, moving the trackball can quickly locate an object on the screen, changing the original situation where moving the cursor using keyboard keys can only step single-point by single direction, realizing the arbitrary movement of the cursor in a two-dimensional space, greatly facilitating the user and improving the ultrasonic diagnostic efficiency.
[0003] The interface types of the trackball include PS / 2, USB, RS232, square wave, etc. When the trackball rolls, it will drive its roller to move, thereby driving the rotating shafts in the X and Y directions. The rolling distance and direction are converted into pulse signals, such as quadrature square wave signals, through mechanical or optical methods. The quadrature signals are directly output or transmitted to the trackball controller. The trackball controller converts the number of pulses into a displacement amount and outputs it in a serial manner such as RS232, PS2, USB, etc. The signal output by RS232 does not require a driver program and is fully compatible with the serial port application programs under mainstream operating systems such as Windows or Linux on the computer side, usually without modification. In addition, for an ultrasonic system designed based on a single-chip microcomputer, since the system already undertakes multiple tasks, it is relatively easy to receive trackball information through the RS232 interface.
[0004] However, the trackball using an integrated chip in the prior art has poor anti-interference and insufficient transmission performance stability, and it is difficult to meet the stable signal transmission of the ultrasonic diagnostic system. Summary of the Invention
[0005] To solve the above technical problems, a method for converting trackball signals of the present invention realizes the conversion of the PS2 signal or quadrature signal output by the trackball to the RS232 interface signal through a trackball signal conversion device, and includes the following steps:
[0006] Step S1: System initialization, detecting the flag port;
[0007] Step S2: If the flag port is at a high level, enter the PS2 to RS232 working mode. The signal conversion unit simulates the host to initialize the PS2 trackball and set parameters such as the sampling rate and resolution. After completion, enter the Stream mode;
[0008] Step S3: When there is displacement or key information of the trackball, it will be sent to the signal conversion unit through the PS2 interface. After the signal conversion unit receives a complete data packet, it converts the information into the serial port trackball data format and sends it out in a serial port form;
[0009] Step S4: If the flag port is at a low level, enter the working mode of converting orthogonal signals to RS232. The signal conversion unit reads the status of the orthogonal signal port in a loop.
[0010] Step S5: If there is a status change, further calculate and generate displacement information in the X or Y direction and set the movement information flag to 1. When the signal conversion unit detects movement information, it converts the information into the serial port trackball data format and sends it out in serial port form.
[0011] In an embodiment of the present invention, the trackball signal conversion device is built around STC15W408AS, and an external crystal oscillator circuit is connected at the same time. A power supply is connected to its Vcc and GND terminals, and pull-ups need to be externally connected to pins 17 and 18 of PORT1.
[0012] In an embodiment of the present invention, the input end of the trackball signal conversion device accesses the orthogonal signals X+, X-, Y+, Y- of the trackball. Among them, X+ and X- are used to determine the movement of the trackball in the X-axis direction, and Y+ and Y- are used to determine the movement of the trackball in the Y-axis direction.
[0013] In an embodiment of the present invention, the input end of the trackball signal conversion device is also provided with a port for accessing PS2 signals.
[0014] In an embodiment of the present invention, the sampling resolution of the trackball is set to 8 count / mm. The setting method is that the host in the trackball signal conversion device first sends 0xE8, then continues to send 0x03 after receiving 0xFA, and then completes after receiving 0xFA.
[0015] The above technical solution of the present invention has the following advantages compared with the prior art: The trackball signal conversion method of the present invention simplifies the trackball signal processing flow. The ultrasound system only needs to receive the serial port signal and does not need to pay attention to the interface form of the trackball, saving time for the ultrasound system to handle more important tasks. The orthogonal signals are X+, X-, Y+, Y-, and the PS2 signals are Data and Clk. Only the TXD signal is output after processing. Description of the Drawings
[0016] In order to make the content of the present invention easier to be clearly understood, the following further details the present invention according to the specific embodiments of the present invention in conjunction with the drawings.
[0017] Figure 1 is the flowchart of the orthogonal signal conversion method of the trackball of the present invention;
[0018] Figure 2 is the flowchart of the PS2 signal to RS232 interface signal processing of the present invention;
[0019] Figure 3 is the block diagram of the trackball signal conversion device according to the present invention;
[0020] Figure 4 is the block diagram of the interface conversion circuit according to the present invention. Detailed implementation manners
[0021] This embodiment provides a trackball signal conversion method. Through the trackball signal conversion device, the method realizes the conversion of the PS2 signal or orthogonal signal output by the trackball to the RS232 interface signal, as Figure 1 and Figure 2 shown, and includes the following steps:
[0022] Step S1: System initialization, detecting the flag port;
[0023] Step S2: If the flag port is at a high level, enter the PS2-to-RS232 working mode. The signal conversion unit simulates the host to initialize the PS2 trackball and set parameters such as the sampling rate and resolution. After completion, enter the Stream mode;
[0024] Step S3: When there is displacement or key information of the trackball, it will be sent to the signal conversion unit through the PS2 interface. After the signal conversion unit receives a complete data packet, it converts the information into the serial port trackball data format and sends it out in serial form;
[0025] Step S4: If the flag port is at a low level, enter the orthogonal signal-to-RS232 working mode, and the signal conversion unit cyclically reads the status of the orthogonal signal port;
[0026] Step S5: If there is a status change, further calculate and generate the displacement information in the X or Y direction and set the movement information flag bit to 1. When the signal conversion unit detects the movement information, it converts the information into the serial port trackball data format and sends it out in serial form.
[0027] As Figure 3 shown, the input end of the trackball signal conversion device accesses the orthogonal signals X+, X-, Y+, Y- of the trackball, where X+ and X- are used to determine the movement of the trackball in the X-axis direction, and Y+ and Y- are used to determine the movement of the trackball in the Y-axis direction; if X+ changes before X-, it means the trackball moves in the positive X-axis direction, otherwise it means it moves in the negative X-axis direction; if Y+ changes before Y-, it means the trackball moves in the positive Y-axis direction, otherwise it means it moves in the negative Y-axis direction. The input end of the trackball signal conversion device is also provided with a port for accessing the PS2 signal.
[0028] Furthermore, as Figure 4As shown in the figure, the trackball signal conversion device is built around STC15W408AS, with an external crystal oscillator circuit connected at the same time, and a power supply is connected to its Vcc and GND terminals. Moreover, pull-ups need to be externally connected to pins 17 and 18 of PORT1.
[0029] Among them, STC15W408AS used is an enhanced 51 single-chip microcomputer of the STC15 series, while in the existing project, CH9340 developed by Nanjing Qinheng Microelectronics Co., Ltd. is adopted, which is a USB bus transfer chip and can realize USB to serial port conversion. However, there is no ready-made circuit for PS2 to serial port or quadrature to serial port conversion. Most trackballs with USB interfaces can output signals compatible with PS2 interfaces.
[0030] The PS2 interface protocol is a two-way synchronous serial protocol. In other words, a PS2 device can send data to the host, and the host can also send data to the device. However, the host always has priority on the bus and can suppress communication from the device at any time - that is, pull the clock low.
[0031] Data sent from the device to the host is read on the falling edge of the clock signal, and data sent from the host to the device is read on the rising edge. Regardless of the communication direction, the device always generates the clock signal. If the host wants to send data, it must first tell the device to start generating the clock signal. The maximum clock frequency is 33kHz, and most devices operate at 10 - 20kHz.
[0032] Different from orthogonal or serial trackballs, a PS2 trackball needs to be initialized when powered on. Its parameters such as sampling rate and resolution can be modified, and there is a special command set for initialization and parameter setting. As shown in the following table, the commands are sent by the host, and the trackball is responsible for receiving and processing. In the solution of this application, a single-chip microcomputer is used to simulate the host to implement the sending and processing of commands, and its command set is shown in the following table;
[0033] Code Command Response 0xFF Reset 0xFA 0xFE Re-transmit 0xXX, 0xXX, 0xXX 0xF6 Set to Default 0xFA 0xF5 Data Report Disable 0xFA 0xF4 Data Report Enable 0xFA 0xF3, 0xXX Set Sampling Rate 0xFA, 0xFA 0xF2 Read ID 0xFA, 0x00 0xF0 Set to Remote Mode 0xFA 0xEE Set to Wrap Mode 0xFA 0xEC Reset Wrap Mode 0xFA 0xEB Read Data 0xFA, 0xXX, 0xXX, 0xXX 0xEA Set to Stream Mode 0xFA 0xE9 Read Status 0xFA, 0xXX, 0xXX, 0xXX 0xE8, 0xXX Resolution 0xFA, 0xFA 0xE7 Set Numerical Conversion 0xFA 0xE6 Cancel Numerical Conversion 0xFA
[0034] After power-on, if the flag port detected by the single-chip microcomputer is at a high level, it enters the PS2 to serial port working mode. First, the single-chip microcomputer is initialized, then it delays for several seconds, and then the trackball is reset three times. If necessary, the sampling rate and resolution can be set through commands 0XF3 and 0xE8 respectively, and then 0xF4 is sent to enable data reporting. The trackball will respond with 0xFA, thus completing the initialization work of the trackball. It only needs to wait for the trackball to send data packets, convert the received data packets into the serial trackball data packet format, and send them to the ultrasound system control.
[0035] Generally, the sampling rate does not need to be set. Setting the resolution to 8count / mm can meet the usage requirements of B-ultrasound, that is, the host first sends 0xE8, and after receiving 0xFA, it continues to send 0x03, and then after receiving 0xFA, the setting is completed.
[0036] Obviously, the above embodiments are merely examples given for clear illustration and are not limitations on the implementation manners. For those of ordinary skill in the art, other different forms of changes or alterations can be made based on the above description. It is not necessary and impossible to enumerate all the implementation manners here. And the obvious changes or alterations derived therefrom are still within the protection scope of the present invention.
Claims
1. A trackball signal conversion method, which realizes the conversion of the PS2 signal or orthogonal signal output by the trackball to the RS232 interface signal through a trackball signal conversion device, and is characterized in that, It includes the following steps: Step S1: System initialization, detecting the flag port; Step S2: If the flag port is at high level, enter the PS2 to RS232 working mode. The signal conversion unit simulates the host to initialize the PS2 trackball and set the sampling rate and resolution parameters. After completion, enter the Stream mode; Step S3: When there is displacement or key information of the trackball, it will be sent to the signal conversion unit through the PS2 interface. After the signal conversion unit receives a complete data packet, it converts the information into the serial port trackball data format and sends it out in serial port form; Step S4: If the flag port is at low level, enter the quadrature signal to RS232 working mode. The signal conversion unit cyclically reads the status of the quadrature signal port; Step S5: If there is a status change, further calculate and generate the displacement information in the X or Y direction and set the movement information flag bit to 1. When the signal conversion unit detects the movement information, it converts the information into the serial port trackball data format and sends it out in serial port form.
2. The trackball signal conversion method according to claim 1, wherein: The described trackball signal conversion device is built around STC15W408AS, and at the same time, an external crystal oscillator circuit is connected, and a power supply is connected to its Vcc and GND terminals. Moreover, pull-ups need to be externally connected to pins 17 and 18 of PORT1.
3. The trackball signal conversion method according to claim 1, wherein: The input end of the described trackball signal conversion device accesses the quadrature signals X+, X-, Y+, Y- of the trackball, where X+ and X- are used to determine the movement of the trackball in the X-axis direction, and Y+ and Y- are used to determine the movement of the trackball in the Y-axis direction.
4. The trackball signal conversion method according to claim 3, wherein: The input end of the described trackball signal conversion device is also provided with a port for accessing the PS2 signal.
5. The trackball signal conversion method according to claim 1, characterized in that: The sampling resolution of the described trackball is set to 8count / mm. The setting method is that the host in the trackball signal conversion device first sends 0xE8, and after receiving 0xFA, continues to send 0x03, and then finishes after receiving 0xFA.
Citation Information
Patent Citations
Medical diagnostic system and its controlling panel
CN101120892A
Protection circuit, serial bus system, circuit protection method and mobile terminal
CN113722260A