A control flow of a USB to 25-pin parallel port converter

The USB to 25-pin parallel port converter is realized through the Teensy 3.6 microcontroller, which solves the problem of modern computers lacking 25-pin parallel port. It sends 16-bit Trigger signals through the USB interface, improving the convenience and time accuracy of neuroscience experiments.

CN116231402BActive Publication Date: 2025-08-29FUDAN UNIVERSITY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310036119.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-01-07
Publication Date
2025-08-29
Estimated Expiration
2043-01-07

AI Technical Summary

Technical Problem

Most modern computers do not have a 25-pin parallel interface, which limits the convenience and flexibility of neuroscience experiments. The existing expansion solutions have driver compatibility problems. In some cases, the 8-bit TTL signal is insufficient information and cannot meet the needs of complex experiments.

Method used

The Teensy 3.6 microcontroller is used as a USB serial device, and a 16-bit Trigger signal is sent through the USB interface. The microcontroller is split into two 8-bit integers, and outputs it to a 25-pin parallel connector through 8 pins. It supports pin adjustments of multiple experimental equipment, writes C language programs and compiles them to the microcontroller for running.

Benefits of technology

It realizes high-precision transmission of 16-bit Trigger signals through the USB interface, is compatible with existing experimental instruments, improves the flexibility and portability of experiments, and meets the time accuracy requirements of neuroscience research.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116231402B_ABST
    Figure CN116231402B_ABST
Patent Text Reader

Abstract

The present invention belongs to the technical field of measuring instruments, and is specifically a USB to 25-pin parallel port converter. The USB to 25-pin parallel port converter of the present invention includes a Teensy 3.6 single-chip microcomputer, a parallel port adapter, and a 25-pin parallel port connector; the single-chip microcomputer receives a 16-bit trigger value sent from a computer as a USB serial port device, splits it into two 8-bit integers, and then sets the levels of the pre-set 8 pins in sequence to represent the 8 bits of each integer, and transmits them to the 25-pin parallel port connector through the parallel port adapter to achieve the transmission of 16-bit integers through 8 pins. The present invention is compatible with experimental instruments that can only receive 8-bit integer trigger signals, and can operate normally in desktop or laptop computers, Windows or Ubuntu environments. It solves the problem that modern computers no longer have 25-pin parallel ports and have a small capacity for 8-bit integer trigger information, and improves the possibility of portability in implementing brain science experiments.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of measuring instruments, and in particular relates to a control flow of a USB to 25-pin parallel port converter. Background Art

[0002] Neuroscience research often requires millisecond-level precision in timing stimulus presentation. Currently, this is typically achieved by sending TTL signals to data logging instruments via a 25-pin parallel port. However, most desktop computers and nearly all laptops no longer have built-in parallel ports, limiting experimental convenience. Almost all laptops lack parallel port expansion. While desktop computers can accommodate parallel ports via PCI-E expansion cards, the drivers are outdated and sometimes no longer installable on modern Linux systems. PsychToolbox, a leading international stimulus presentation software, recommends running it in a Linux environment. Furthermore, many instruments only accept 8-bit TTL signals to represent integers between 0 and 255. This is insufficient in limited situations (e.g., when the number of trials exceeds 255 or when trigger signals are required to encode different experimental parameters). Expanding to 16 bits allows for integers between 0 and 65535, allowing for more information. Almost all computers now include a USB port. Although some argue that USB interfaces offer limited timing accuracy, current stimulation software such as PsychToolbox now offer serial port functionality with high stability and timing accuracy. Therefore, if a 16-bit trigger signal can be sent through a USB interface and is compatible with existing mainstream experimental instruments, the flexibility of experimental design will be greatly improved. Summary of the Invention

[0003] The purpose of the present invention is to provide a control flow of a USB to 25-pin parallel port converter that can send a 16-bit trigger signal through a USB interface and is compatible with existing mainstream experimental instruments.

[0004] The core of the USB to 25-pin parallel port converter provided by the present invention is a Teensy 3.6 single-chip microcomputer. The single-chip microcomputer receives the 16-bit trigger value (uint16) sent from the computer as a USB serial port device, splits it into two 8-bit integers, and then sets the voltage levels of the 8 pre-set pins to represent the 8 bits of each integer in turn, and outputs them to the 25-pin parallel port connector to achieve the purpose of transmitting the 16-bit integer through the 8 pins. The overall structure of the device is as follows Figure 1As shown, note that the connection method from the microcontroller to the parallel port is not fixed and needs to be adjusted according to the parallel port pinout of the experimental equipment. Specifically, the USB to 25-pin parallel port converter includes a Teensy 3.6 microcontroller and a 25-pin parallel port adapter. The 25-pin parallel port adapter is a two-layer circuit board with one end that connects to the 25-pin parallel port connector and the other end that leads to the pins from the 25-pin parallel port connector, which can be plugged into a breadboard.

[0005] The specific control process of the USB to 25-pin parallel port converter provided by the present invention is as follows:

[0006] (1) If the integer to be sent is between 0 and 255, the microcontroller transmits the signal only once, and each pin is set high for 1.1 milliseconds and then reset to low. In this case, the signal sent by the microcontroller is exactly the same as the signal sent by the traditional parallel port.

[0007] (2) If the integer to be sent is between 256 and 65535, the microcontroller sends the signal three times: the first integer lasts for 1.1 milliseconds and is then reset to a low level for 1.1 milliseconds; the second integer lasts for 1.1 milliseconds and is then reset to a low level for 1.1 milliseconds; and finally, an integer "1" is sent, which lasts for 1.1 milliseconds and is then reset to a low level.

[0008] Therefore, the experimental instrument that receives the microcontroller signal will receive 1 or 3 integers; if 3 integers are received, the last integer "1" means that the first two 8-bit integers need to be combined into a 16-bit integer in subsequent data processing. At the same time, it can also solve the problem that when the second integer is 0, most experimental instruments will not record it, resulting in restoration problems (for example, "256" is expressed as "00000001 00000000", the second 8-bit is 0, and the experimental instrument will not record it. If a mark is not added at the end to indicate that this is a 16-bit integer, when the data is collected and the Trigger value is restored, it will become "00000001", which is the integer "1").

[0009] The program above is implemented in C and compiled for use with Arduino and Teensyduino microcontrollers. Once compiled, the device can be used on Windows 7, Windows 10, and Ubuntu computers without the need for installing additional drivers or the Arduino environment. The device is not tied to any specific stimulus presentation software and can be used simply by sending single integers via the USB serial port.

[0010] The present invention also supports changing the USB description name of the device, and writes a program to automatically search for the serial port number of the device, eliminating the need for users to search manually.

[0011] Since the Teensy microcontroller can be directly plugged into a breadboard, the present invention designs a parallel port adapter ( Figure 2 ), the connection between the microcontroller and the parallel port can be flexibly adjusted by plugging wires on the breadboard to cope with the situation where different instruments can read different pins of the parallel port. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] Figure 1 This is a structural diagram of the USB to 25-pin parallel port converter provided by the present invention.

[0013] Figure 2 This is the wiring diagram of a parallel port adapter circuit board that can be plugged into a breadboard. (a) shows the front side, and (b) shows the back side. The unit "mil" represents one thousandth of an inch.

[0014] Figure 3 The time difference between changes in the microcontroller (Channel 1), PCI-Express parallel port card (Channel 2), and screen brightness (Channel 4) is shown. The oscilloscope trigger value is set to the rising phase of Channel 1, and the waveform display duration is 20 seconds. To distinguish the waveforms of Channel 1 from those of Channel 2, the vertical position of Channel 1 is slightly shifted downward. To more fully display the waveform of Channel 4, the time zero point (i.e., the trigger time) is shifted left by 10 milliseconds.

[0015] Figure 4 The time difference between the microcontroller (channel 1) and the PCI-E parallel port card (channel 2) sending triggers. The trigger value of the oscilloscope is set to the rising phase of channel 1, and the waveform display duration is 20 seconds.

[0016] Figure 5 The following graphs show the correlation between 16-bit trigger signals sent and received using a microcontroller on different computers. (a) A desktop computer with an AMD Ryzen 7 5800X processor, 32GB of DDR4 2666MHz memory, and Windows 10 20H2 operating system; (b) An Intel Core i7-8750H processor, 16GB of DDR4 2666MHz memory, and Windows 10 20H2 operating system; (c) An Intel Core i7-10700F processor, 32GB of DDR4 2666MHz memory, and Ubuntu 20.04 operating system. The title of each image is the sum of the absolute differences between the sent and received trigger values.

[0017] Figure 6After sending 65,535 16-bit trigger signals continuously at 10-millisecond intervals using a single-chip microcontroller on different computers, the distribution of the time difference between the two triggers is statistically analyzed from the recorded data. Among them, (a): a desktop computer with an AMD Ryzen 7 5800X processor, 32GB DDR4 2666MHz memory, and an operating system of Windows 10 20H2; (b): a laptop with an Intel Core i7-8750H processor, 16GB DDR4 2666MHz memory, and an operating system of Windows 10 20H2; (c): a desktop computer with an Intel Core i7-10700F processor, 32GB DDR4 2666MHz memory, and an operating system of Ubuntu 20.04.

[0018] The numbers in the figure are: 1 is the Teensy 3.6 microcontroller, 2 is the connecting cable, 3 is the parallel port adapter circuit board that can be plugged into the breadboard, and 4 is the 25-pin parallel port connector. DETAILED DESCRIPTION

[0019] The following specific examples verify the performance of the device from two aspects: (1) the accuracy of sending the trigger time; (2) the accuracy of transmitting the 16-bit trigger signal, and compare it with the traditional PCI-E to parallel port card.

[0020] In the test experiment, the computer used to display the stimulation was an AMD Ryzen 7 5800X processor with 32GB of DDR4 2666MHz memory, an NVIDIA GeForce RTX 2080Super graphics card (driver version 516.94), and the operating system was Windows 10 22H2. The stimulation software used was PsychToolbox 3.0.18, MATLAB version R2021b Update 4, and the monitor was a BenQ XL2540 (resolution 1920x1080, refresh rate 240Hz). The PCI-E to parallel port card chip was a MosChip MCS9900 chip, and its driver and call function interface were implemented by inpout32 and parPulse.mexw64 (downloaded from https: / / display-corner.epfl.ch / index.php?title=TachistoscopeSoftware).

[0021] Brain science research often requires sending a trigger signal when screen content changes, and the time difference between trigger signal transmission and screen content change must be stable. Therefore, we used a Uni-T UPO2104CS oscilloscope to test the timing relationship between triggers sent by a microcontroller, triggered via a PCI-E parallel port, and changes in screen brightness. The changes in screen brightness were measured using a Thorlabs PDA36A2 silicon photodetector.

[0022] Connect any one of the microcontroller's eight output pins to oscilloscope channel 1. Connect any one of the PCI-E parallel port adapter pins 2-9 to oscilloscope channel 2. Place a silicon photodetector firmly against the screen and connect its output to oscilloscope channel 4. Run the USB to 25-pin parallel port converter test program 1 (see Appendix 1) in MATLAB. Invert the screen brightness every 20 milliseconds and send a trigger signal of 255 through the microcontroller and PCI-E parallel port adapter each time the screen changes from black to white.

[0023] Set the trigger value of the oscilloscope to the rising phase of channel 1, and the waveform display duration is 20 seconds (that is, the waveforms before and after the trigger value within 20 seconds are superimposed and displayed). The result is as follows: Figure 3 As shown in the figure, it can be seen that channel 1 and channel 2 rise at almost the same time. The time for channel 1 to maintain a high level is in line with the preset value of 1.1 milliseconds, while the time for channel 2 to maintain a high level is about 2 milliseconds, which is longer than the preset 0.5 milliseconds (5e -4 In addition, channel 4 basically overlaps on a line within 20 seconds, indicating that the time difference from sending the trigger to the change in screen brightness is basically constant. Figure 4 Further zooming in on the time difference between the microcontroller sending a trigger and the PCI-E parallel port, we can see that the time difference remains stable at around 40 microseconds. These results demonstrate that the timing accuracy of trigger transmission achieved by the microcontroller connected to the USB interface is comparable to that of a traditional PCI-E parallel port card, meeting the requirements of neuroscience research.

[0024] To further verify the accuracy of the 16-bit trigger signal transmitted by the microcontroller, it was used to send trigger values ​​1-65535 in sequence, and the signal was collected at 2000Hz using Vpixx's Datapixx3. The test MATLAB code is shown in Appendix 2.

[0025] Figure 5(a) shows the correlation between the recorded Trigger values ​​and the values ​​sent by the program (the last 7 lines of the code above). You can see that all the points fall on the diagonal line. Further calculation of the sum of the absolute values ​​of the difference between the recorded and sent Trigger values ​​yields an output of 0 ( Figure 5 The title of each figure in the figure) means that the recorded and sent Trigger values ​​are exactly the same. We also used a notebook ( Figure 5 (b)) and a desktop computer with Ubuntu 20.04 operating system installed ( Figure 5 The same test was done on (c) in Figure 5 (a) is exactly the same as in .

[0026] The above test can also verify the accuracy of the trigger sending time from another perspective. Figure 6 The distribution of the time difference between the two triggers among 65,535 triggers is shown. It can be seen that under different hardware and software platforms, the vast majority of time differences are exactly within the preset 10 milliseconds, with the maximum deviation not exceeding 1 millisecond, which can meet the requirements of neuroscience research for trigger time accuracy.

[0027] In summary, the present invention, by programming the Teensy 3.6 microcontroller into a USB to 25-pin parallel port converter, can send 16-bit trigger signals with high time precision. It can run normally on desktops or laptops, Windows or Ubuntu environments, solving the problem that modern computers no longer have 25-pin parallel ports, and improving the possibility of portability in implementing brain science experiments.

[0028] The above embodiments are used to illustrate the present invention rather than to limit the present invention. Any modifications and changes made to the present invention within the spirit of the present invention and the protection scope of the claims shall fall within the protection scope of the present invention.

[0029] Appendix 1: USB to 25-pin parallel port converter MATLAB test code 1

[0030]

[0031]

[0032]

[0033] Appendix 2, USB to 25-pin parallel port converter MATLAB test code 2

[0034]

[0035]

[0036]

[0037]

[0038]

Claims

1. A control process of a USB to 25-pin parallel port converter, characterized in that: The converter includes a Teensy 3.6 microcontroller and a 25-pin parallel port adapter. The Teensy 3.6 microcontroller is plugged into a breadboard. The 25-pin parallel port adapter is a double-layer circuit board, one end of which is connected to the 25-pin parallel port connector, and the other end is provided with pins extending from the 25-pin parallel port connector. The 25-pin parallel port adapter is plugged into the breadboard and connected to the Teensy 3.6 microcontroller through the breadboard. The Teensy 3.6 microcontroller acts as a USB serial port device to receive a 16-bit trigger value sent from a computer, split it into two 8-bit integers, and then sequentially sets the levels of the pre-set 8 pins to represent the 8 bits of each integer. The values ​​are then transmitted to the 25-pin parallel port connector through the 25-pin parallel port adapter, thereby transmitting the 16-bit integer through the 8 pins. The control flow is as follows: (1) For integers between 0 and 255, the MCU transmits the signal only once. Each pin is set high for 1.1 milliseconds and then reset to low. In this case, the signal sent by the MCU is exactly the same as that sent by the traditional parallel port. (2) For integers between 256 and 65535, the MCU sends three signals: the first integer lasts for 1.1 milliseconds and then resets to a low level for 1.1 milliseconds; the second integer lasts for 1.1 milliseconds and then resets to a low level for 1.1 milliseconds; and finally, an integer "1" is sent, which lasts for 1.1 milliseconds and then resets to a low level. Thus, the experimental instrument receives three consecutive integers; the last integer "1" indicates that the first two 8-bit integers need to be combined into a 16-bit integer in subsequent data processing.

2. The control process of the USB to 25-pin parallel port converter according to claim 1, characterized in that: The control flow is implemented in C language and compiled to run on the microcontroller using Arduino and Teensyduino. After compilation, the converter can be used normally on Windows 7, Windows 10 and Ubuntu computers without manually installing additional drivers or Arduino environment.

Citation Information

Patent Citations

  • Distributed wireless LED display system

    CN101206820A

  • Print server capable of getting electricity through parallel ports of printer

    CN201984422U