Movatterモバイル変換


[0]ホーム

URL:


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

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

Info

Publication number
CN116231402B
CN116231402BCN202310036119.3ACN202310036119ACN116231402BCN 116231402 BCN116231402 BCN 116231402BCN 202310036119 ACN202310036119 ACN 202310036119ACN 116231402 BCN116231402 BCN 116231402B
Authority
CN
China
Prior art keywords
parallel port
pin parallel
integer
bit
pin
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202310036119.3A
Other languages
Chinese (zh)
Other versions
CN116231402A (en
Inventor
周云晖
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fudan University
Original Assignee
Fudan University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fudan UniversityfiledCriticalFudan University
Priority to CN202310036119.3ApriorityCriticalpatent/CN116231402B/en
Publication of CN116231402ApublicationCriticalpatent/CN116231402A/en
Application grantedgrantedCritical
Publication of CN116231402BpublicationCriticalpatent/CN116231402B/en
Activelegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Classifications

Landscapes

Abstract

The invention belongs to the technical field of measuring instruments, and particularly relates to a converter for converting USB into 25-pin parallel ports. The invention discloses a converter for converting USB into 25-pin parallel port, which comprises a Teensy 3.6 single chip microcomputer, a parallel port adapter and a 25-pin parallel port adapter, wherein the single chip microcomputer is used as USB serial port equipment to receive 16-bit Trigger values sent by a computer and split the 16-bit Trigger values into two 8-bit integers, and then preset 8-pin levels are sequentially set into 8 bits representing each integer and are transmitted to the 25-pin parallel port adapter through the parallel port adapter so as to realize 16-bit integer transmission through the 8 pins. The invention is compatible with an experimental instrument which can only receive 8-bit integer Trigger signals, can normally operate in desktop or notebook, windows or Ubuntu environments, solves the problems that modern computers no longer have 25-pin parallel ports and 8-bit integer Trigger information capacity is small, and improves the possibility of portable implementation of brain science experiments.

Description

Control flow of converter for converting USB (universal serial bus) into 25-pin parallel port
Technical Field
The invention belongs to the technical field of measuring instruments, and particularly relates to a control flow of a USB-to-25-needle parallel port converter.
Background
Neuroscience research often requires marking stimulus presentation time with millisecond-scale precision, which is currently achieved by sending TTL signals to a data recording instrument through a 25-needle parallel port, but most desktop computers and almost all notebooks are not provided with parallel ports, which limits the convenience of experiment implementation. Almost all notebooks cannot be installed in an extended mode, and a desktop can be installed in an extended mode through a PCI-E extension card, but a drive version is old and sometimes cannot be installed on a new Linux system, and international mainstream stimulus presentation software PsychToolbox recommends running in a Linux environment. In addition, many instruments accept only 8-bit TTL signals representing integers within 0-255, which may not be sufficient in a small number of cases (e.g., the number of trials exceeds 255 or different experimental parameters need to be encoded with Trigger signals), but may represent integers of 0-65535 if extended to 16 bits, which may carry more information. At present, almost all computers are provided with USB interfaces, and although the time accuracy of the USB interfaces for receiving and transmitting signals is not high in some points of view, stimulus software such as PsychToolbox at present has provided serial port signal receiving and transmitting functions with good stability and high time accuracy. Therefore, if the 16-bit Trigger signal can be sent through the USB interface and is compatible with the existing mainstream experimental instrument, the flexibility of design experiments is improved to a great extent.
Disclosure of Invention
The invention aims to provide a control flow of a converter which can send 16-bit Trigger signals through a USB interface and is compatible with the existing mainstream experimental instrument and is converted into a 25-pin parallel port through a USB.
The invention provides a converter for converting USB into 25-pin parallel ports, which is characterized in that the core of the converter is a Teensy 3.6 singlechip, the singlechip is used as USB serial port equipment to receive a 16-bit Trigger value (uint 16) sent by a computer, the 16-bit Trigger value is split into two 8-bit integers, and then the preset 8-pin levels are sequentially set into 8 bits representing each integer and output to a 25-pin parallel port connector, so that the aim of transmitting the 16-bit integers through the 8 pins is fulfilled. The whole structure of the device is shown in fig. 1, and note that the connection mode from the singlechip to the parallel port is not fixed, and the pin of the parallel port needs to be adjusted according to the specific reading of the experimental device. Specifically, the USB-to-25 pin parallel port converter comprises a Teensy 3.6 single chip microcomputer and a 25 pin parallel port adapter, wherein the 25 pin parallel port adapter is a double-layer circuit board, one end of the 25 pin parallel port adapter can be connected with a 25 pin parallel port connector, and the other end of the 25 pin parallel port adapter is a pin led out from the 25 pin parallel port connector and can be inserted on a bread board.
The invention provides a converter for converting USB into a 25-pin parallel port, which comprises the following specific control flow:
(1) If the integer to be transmitted is between 0 and 255, the singlechip only transmits a signal once, and the duration of each pin set to be high level is 1.1 milliseconds, and then the pin is reset to be low level;
(2) If the integer to be transmitted is between 256-65535, then the single chip sends three signals, the first integer duration is 1.1 ms, then reset to low level 1.1 ms, then the second integer duration is 1.1 ms, then reset to low level 1.1 ms, and finally sends an integer "1" for 1.1 ms, then reset to low level.
Thus, the experimental instrument receiving the SCM signal receives 1 or 3 integers, if 3 integers are received, the last integer '1' indicates that the first two 8-bit integers are needed to be combined into a 16-bit integer in the subsequent data processing, and the situation that when the second integer is 0, most experimental instruments cannot record, and the reduction is problematic can be solved (for example '256' indicates '00000001 00000000', the second 8-bit indicates 0, the experimental instrument cannot record, if a mark is not added at the back, the result is a 16-bit integer, and when the data reduction Trigger value is acquired, the result becomes '00000001', namely the integer '1').
The program is realized through a C language and compiled to a singlechip by Arduino and Teensyduino for running. After compiling, the device can be normally used without manually additionally installing a driver or an Arduino environment on the computers of Windows 7, windows 10 and Ubuntu. The device is not bound with specific stimulus presentation software, and can be used by sending a single integer through a USB serial port.
The invention also supports changing the USB description name of the equipment, and writes a program to automatically search the serial number of the equipment, so that the manual searching of a user is not required.
Because the Teensy singlechip can be directly inserted on the bread board, the invention designs a parallel port adapter (figure 2) which can be inserted on the bread board, and the connection from the singlechip to the parallel port can be flexibly adjusted by plugging wires on the bread board so as to cope with the situation that different instruments read different pins of the parallel port.
Drawings
Fig. 1 is a diagram showing a structure of a converter for converting USB to 25 pin parallel port according to the present invention.
Fig. 2 shows a wiring diagram of a parallel port adapter circuit board which can be inserted on a bread board, wherein (a) is the front surface, and (b) is the back surface. The unit "mil" represents one thousandth of an inch.
Fig. 3 shows the time differences of the changes of the single chip microcomputer (channel 1), the PCI-E parallel port card (channel 2) and the screen brightness (channel 4). The trigger value of the oscilloscope is set at the rising phase of channel 1 and the waveform display duration is 20 seconds. To distinguish between the waveforms of channel 1 and channel 2, the channel 1 vertical position is shifted slightly downward. To more completely reveal the waveform of channel 4, the time zero (i.e., the trigger time) is shifted left by 10 milliseconds.
Fig. 4 shows the time difference between sending Trigger by the singlechip (channel 1) and the PCI-E parallel interface card (channel 2), the Trigger value of the oscilloscope is set in the rising phase of the channel 1, and the duration of waveform display is 20 seconds.
Fig. 5 shows the correlation between 16-bit Trigger signals sent and received by a single chip microcomputer on different computers. Wherein, (a) the processor is AMD Ryzen 7 5800X, the memory is 32GB DDR4 2666MHz, the operating system is a desktop of Windows10 20H2, (b) the processor is a notebook of Intel Core i7-8750H, the memory is 16GB DDR4 2666MHz, the operating system is Windows 10H 2, and (c) the processor is a desktop of Intel Core i7-10700F, the memory is 32GB DDR4 2666MHz, and the operating system is Ubuntu 20.04. Each picture is titled as the sum of absolute values of the difference between the sending and receiving Trigger values.
Fig. 6 is a distribution of time differences between front and rear triggerers counted from recorded data after 65535 16-bit Trigger signals are continuously transmitted at 10 ms intervals on different computers using a single chip microcomputer. Wherein, (a) the processor is AMD Ryzen 7 5800X, the memory is 32GB DDR4 2666MHz, the operating system is a desktop of Windows 10 20H2, (b) the processor is a notebook of Intel Core i7-8750H, the memory is 16GB DDR4 2666MHz, the operating system is Windows 10 20H2, and (c) the processor is a desktop of Intel Core i7-10700F, the memory is 32GB DDR4 2666MHz, and the operating system is Ubuntu 20.04.
In the figure, the reference numeral 1 is Teensy 3.6 singlechip, 2 is the connecting wire, 3 is the parallel port adapter circuit board that can insert on the bread board, and 4 is 25 needle parallel port connectors.
Detailed Description
The performance of the device is verified in two aspects by a specific example, namely (1) accuracy of sending Trigger time and (2) accuracy of transmitting 16-bit Trigger signals, and the accuracy is compared with that of a traditional PCI-E parallel port card.
In the test experiment, the computer processor for displaying stimulation is AMD Ryzen 7 5800X, the memory is 32GB DDR4 2666MHz, the display card is NVIDIA GeForce RTX 2080Super (the driving version is 516.94), the operating system is Windows 1022H2, the stimulation software adopts PsychToolbox.0.18, the MATLAB version is R2021b Update 4, and the display is BenQ XL2540 (resolution 1920x1080, refresh rate 240 Hz). The PCI-E parallel port card has a chip MosChip MCS to 9900, and the function interfaces for driving and calling are realized by inpout and parPulse.mexw64 (downloaded from https:// display-burner.epfl.ch/index.phptile= TachistoscopeSoftware).
In brain science research, it is often necessary to send a Trigger signal when the screen presentation content changes, and it is required that the time difference between Trigger signal transmission and screen content change is stable. Therefore, the time relation between sending Trigger through the singlechip, sending Trigger through the PCI-E parallel port and changing screen brightness is tested by the Utility UPO2104CS oscilloscope. The change in screen brightness was measured by a Thorlabs PDA36A2 silicon photodetector.
1 Of 8 output pins of the singlechip is connected to the first oscilloscope channel, 1 of 2-9 PCI-E parallel port pins is connected to the second oscilloscope channel, the silicon photodetector is tightly attached to the screen, and the output of the silicon photodetector is connected to the fourth oscilloscope channel. A USB to 25 pin parallel port converter test program 1 (see accessory 1) was run on MATLAB, screen brightness was reversed every 20 ms, and Trigger signals with a value of 255 were sent through the single chip and PCI-E parallel port card each time from black to white.
Setting the trigger value of the oscilloscope at the rising phase of the channel one, the duration of the waveform display is 20 seconds (i.e. the waveforms before and after the trigger value is displayed in a superimposed manner within 20 seconds), as shown in fig. 3, it can be seen that the channel one and the channel two rise at almost the same time, the time of maintaining the channel one at the high level is 1.1 ms in accordance with the preset value, and the time of maintaining the channel two at the high level is about 2 ms, which is longer than 0.5 ms (5 e-4 seconds) preset in the program. In addition, channel four was substantially coincident on a line within 20 seconds, indicating that the time difference from sending Trigger to the screen brightness change was substantially constant. Fig. 4 further shows the time difference between sending Trigger by the singlechip and sending Trigger by the PCI-E parallel port, and the time difference can be seen to be stabilized at about 40 microseconds. From the above results, it can be seen that, in terms of time precision of sending Trigger, the singlechip connected to the USB interface is equivalent to the conventional PCI-E parallel interface card, so as to meet the demands of neuroscience research.
In order to further verify the accuracy of the 16-bit Trigger signal transmitted by the singlechip, the 1-65535Trigger values are sequentially transmitted by the singlechip, signals are collected at 2000Hz by Datapixx3 of Vpixx company, and the tested MATLAB code is shown in an accessory 2.
Fig. 5 (a) shows the correlation between the recorded Trigger value and the Trigger value sent by the program (i.e., the last 7 lines of the above code are drawn), and it can be seen that all points fall on the diagonal line. The sum of the absolute values of the difference values of the recorded and transmitted Trigger values is further calculated to obtain an output of 0 (the heading of each graph in fig. 5), that is, the recorded and transmitted Trigger values are identical. We also performed the same test on a notebook (fig. 5 (b)) and a desktop (fig. 5 (c)) with Ubuntu 20.04 operating system installed, and the results were exactly the same as fig. 5 (a).
The above test can also verify the accuracy of the sending Trigger time from another aspect. Fig. 6 shows the distribution of time differences between the front and rear triggers in 65535 triggers, and can be seen that under different hardware and software platforms, most of time differences are just preset 10 milliseconds, and the maximum deviation is not more than 1 millisecond, so that the requirement of neuroscience research on the time precision of the triggers can be met.
In conclusion, the Teensy 3.6 singlechip is written into the converter with the USB to 25-pin parallel port, so that 16-bit Trigger signals can be sent with high time precision, and the computer can normally operate in desktop or notebook, windows or Ubuntu environments, the problem that modern computers do not have 25-pin parallel ports any more is solved, and the possibility of carrying out brain science experiments in a portable mode is improved.
The above-described embodiments are intended to illustrate the present invention, not to limit it, and any modifications and variations made thereto are within the spirit of the invention and the scope of the appended claims.
Accessory 1 USB-to-25 pin parallel port converter MATLAB test code 1
Accessory 2, USB-to-25 pin parallel port converter MATLAB test code 2

Claims (2)

Translated fromChinese
1.一种USB转25针并口的转换器的控制流程,其特征在于,该转换器包括一个Teensy3.6单片机和一个25针并口转接器;Teensy 3.6单片机插在面包板上;25针并口转接器为一个双层电路板,一端与25针并口接头连接,另一端上设有从25针并口接头引出的针脚,插在面包板上,通过面包板和Teensy 3.6单片机连接;其中,Teensy 3.6单片机作为一个USB串口设备接收来自电脑发送的16位Trigger数值,并将其拆分成两个8位的整数,然后将预先设定的8个针脚的电平依次设置成表示每个整数的8个比特,通过25针并口转接器,传输到25针并口接头上,以实现通过8个针脚传送16位整数;1. A control flow of a USB to 25-pin parallel port converter, characterized in that the converter includes a Teensy 3.6 single-chip microcomputer and a 25-pin parallel port adapter; the Teensy 3.6 single-chip microcomputer is inserted 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, which is inserted into the breadboard and connected to the Teensy 3.6 single-chip microcomputer through the breadboard; wherein the Teensy 3.6 single-chip microcomputer 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 set the levels of the preset 8 pins to represent 8 bits of each integer, and transmit the values to the 25-pin parallel port connector through the 25-pin parallel port adapter to achieve the transmission of the 16-bit integer through the 8 pins;控制流程如下:The control flow is as follows:(1)对于发送的整数在0-255之间,单片机只传送一次信号,每个针脚设置为高电平的持续时间为1.1毫秒,之后重置为低电平;在这种情况下单片机发送的信号与传统并口发送的信号完全相同;(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)对于发送的整数在256-65535之间,单片机发送三次信号:第一个整数持续时间为1.1毫秒,之后重置为低电平1.1毫秒;然后第二个整数持续时间为1.1毫秒,之后重置为低电平1.1毫秒;最后再发送一个整数“1”,持续1.1毫秒,之后重置为低电平;(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.于是,实验仪器接收到连续的3个整数;最后一个整数“1”表示在后续数据处理中需要把前两个8位整数合并成一个16位整数。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.根据权利要求1所述的USB转25针并口的转换器的控制流程,其特征在于,所述控制流程由C语言实现,并用Arduino和Teensyduino编译到单片机上运行;编译好后,在Windows7、Windows 10和Ubuntu的电脑上不需手动额外安装驱动或者Arduino环境就能正常使用该转换器。2. The control flow of the USB to 25-pin parallel port converter according to claim 1 is characterized in that the control flow is implemented in C language and compiled into a single-chip microcomputer using Arduino and Teensyduino; after compilation, the converter can be used normally on computers running Windows 7, Windows 10, and Ubuntu without manually installing additional drivers or the Arduino environment.
CN202310036119.3A2023-01-072023-01-07 A control flow of a USB to 25-pin parallel port converterActiveCN116231402B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN202310036119.3ACN116231402B (en)2023-01-072023-01-07 A control flow of a USB to 25-pin parallel port converter

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN202310036119.3ACN116231402B (en)2023-01-072023-01-07 A control flow of a USB to 25-pin parallel port converter

Publications (2)

Publication NumberPublication Date
CN116231402A CN116231402A (en)2023-06-06
CN116231402Btrue CN116231402B (en)2025-08-29

Family

ID=86586558

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN202310036119.3AActiveCN116231402B (en)2023-01-072023-01-07 A control flow of a USB to 25-pin parallel port converter

Country Status (1)

CountryLink
CN (1)CN116231402B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN101206820A (en)*2007-11-152008-06-25复旦大学 Distributed Wireless LED Display System
CN201984422U (en)*2011-01-052011-09-21北京理想固网科技股份有限公司Print server capable of getting electricity through parallel ports of printer

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US8324885B2 (en)*2009-09-172012-12-04Tektronix, Inc.Mixed signal acquisition system for a measurement instrument
CN209417727U (en)*2019-04-172019-09-20华东师范大学 interface conversion device

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN101206820A (en)*2007-11-152008-06-25复旦大学 Distributed Wireless LED Display System
CN201984422U (en)*2011-01-052011-09-21北京理想固网科技股份有限公司Print server capable of getting electricity through parallel ports of printer

Also Published As

Publication numberPublication date
CN116231402A (en)2023-06-06

Similar Documents

PublicationPublication DateTitle
KR0179706B1 (en)Method and apparatus for providing a remotely located outrigger card electrically coupled to a control card
US8066515B2 (en)Multiple graphics adapter connection systems
AU631416B2 (en)Dual personal computer architecture peripheral adapter board and circuit
US5357519A (en)Diagnostic system
US11624788B2 (en)Display module test platform
EP1134669A1 (en)Incremental bus structure for modular electronic equipment
US8161203B1 (en)Detecting the presence and activity of a mass storage device
CN109946590A (en) A board card switching device and test system
JPH08501893A (en) Removable computer display interface
CN111402771A (en)Detection equipment for display driving chip and display module
CN116231402B (en) A control flow of a USB to 25-pin parallel port converter
US7484156B2 (en)Apparatus and method for testing PS/2 interface
US20130017717A1 (en)Computer power on self test card
CN114443404B (en)Board card for OCP interface test, test system and test method
CN207319223U (en)Computing switching device based on PCIE X16-MXM
CN206348780U (en)A kind of measurement jig of server hard disk back plane
CN112905516A (en)Optical module all-in-one machine
CN214375135U (en) RoCE chip test device
CN109116214A (en)The LVDS/V-by-one signal testing jig of chip main board
DE50003992D1 (en) DEVICE FOR TESTING CONNECTED CABLES
CN111812552B (en)Photoelectric hybrid data line test platform based on Type-C interface and test method thereof
ManualUser's Guide
CN112069109A (en) An extension transfer board, transfer device and transfer method
TWI780910B (en)Testing tool
CN215833548U (en)FCT universal meter measuring device

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
GR01Patent grant

[8]ページ先頭

©2009-2025 Movatter.jp