Page History: LPT Port Element
Compare Page Revisions
Page Revision: 2013/08/08 18:01
|
LPT Port Element
|
Info |
Category: |
Communications |
|
AddIn: |
Elements |
Creator: |
OkazoLab Team |
|
Scope: |
Parent Event |
Owns Snippets: |
no |
|
Usage: |
Runtime Screen,Snippets |
Parallel port element allows using of the parallel port (LTP) of a PC computer.
Description
LPT port element allows the use of the
parallel port (LTP) on PC computers. The LPT port can be described (at the software level) as a simple communication device that has 8 input and 8 output lines. Each line is binary with an ON/OFF status that can be set (for the output lines) or read (for the input lines) at any moment of time. Simplicity and fast access speed of the LPT port make it very useful in experimental scenarios that require a precise synchronization between experimental events and a work of the external devices.
Snapshots
Practical Use
The parallel port element provides a direct access to the lines of the parallel port at runtime: it can be done by reading or assigning value to a single variable in a code snippet. The element can also be used to set up an automatic (latency is <1ms) signal exchange, which is synchronized with particular events in your experiment. In general, you can select one of three working modes for the parallel port element:
Manual working mode
In this mode the element can be used to send and receiving digital codes manually through the LTP port, at the desired moment. The element has two properties: [Input] and [Output]. These are linked to the current input and output of the parallel port correspondingly. The current port input can be always accessed by reading a value of the [Input] property in your code snippets. Note that any changes of the port input between two subsequent property readings cannot be tracked in this working mode. Assigning a value to the [Output] property in code snippets causes an instant update of the port output lines with the new value.
AutoOutput working mode
In this mode the element sets the port output lines to a specific status synchronously with activation of the parent event. The status of output port lines is set according to the current value of the [Output] property. Note that assigning a new value to the [Output] property does not causes an instant update of the output lines as in the Manual Mode. This working mode is handy when you need to send an instant signal to an external device every time when some event occurs in an experiment. For example a visual stimulus is presented on the screen. You also can select a shape of such output signal in time relatively to the duration of the parent event:
- Level signal shape. If this signal shape is selected, the element simply sets the output lines of the parallel port to the value defined bythe Output property synchronously with activation of the parent event.
- Pulse signal shape. If this signal shape is selected, the element performs a signal synchronization program consisting of 3 steps. Shortly before activation of the parent event the port output is set to the ground (each line is Off) level. When the parent event is actually activated the element sets the port output lines to the value defined by the [Output] property. Later, after a time interval defined by [Pulse Duration] property, the element sets the port output back to the ground. If the pulse duration is greater than the actual duration of the parent event, the element grounds the signal pulse at deactivation of the parent event.
- Trigger signal mode. If this signal shape is selected, the element performs a signal synchronization program consisting just of 2 steps. Shortly before the parent event is activated the element sets the current port output to the ground (zero) level. When the parent event is actually activated the element changes the port output to the value defined by Output property. Subsequent port output changes can be done only with other parallel ports elements.
Notice that the element in this working mode has an action scope. This means that the output can be set only when the parent event is activated.
Note, for output information, please see
Output.
InputTrigger working mode
In this working mode the parallel port element monitors one or several input lines of the parallel port in order to detect their changes into a specific binary state. The monitored lines and their sought states are defined by the [Trigger Value] property of the element. The element alerts a successful detection by switching to the triggered state. The element triggering is always accompanied with recording of the exact trigger time and executing of the dedicated code snippet (if present). Thus, you can use a specific port input for controlling the flow of your experiment, performing custom actions and collecting accurate input timing. Notice that the element in this working mode has an action scope. This is the input monitoring and triggering are possible only while the parent event is active. However, you can always share the same parallel port among multiple parallel port elements, and each element would seek for its own triggering input. The elements also can be set to have multiple triggering in case in the port input may contains multiple occurrences of the trigger string (by default, in this working mode the element is triggered only once on the first triggering input arrival).
Notes
- You can use multiple parallel port elements in your experiment but, if they share the same hardware port, you should take in account and resolve possible interferences, like tracking the actual status of output lines that cannot been read directly.
- For better synchronization of the port output (in AutoOutput and InputTrigger modes) move the Parallel Port element at the top of the elements list in the parent event. Elements there get to work one by one, as soon as the parent event is activated, so the top position in the list will minimize possible delays.
Generic Properties
Name | Description | AutoOutput working mode | Value Type | Upon Runtime Change |
---|
Port Settings |
Output address | The address of the output gate of the computer LTP port. The default value is 888 (0x0378) | | Int32 |
Input address | The address of the input gate in the computer LTP port. The default value is 889 (0x0379) | | Int32 |
+=== Properties inherited from clParallelPortElement ===
Inherited properties of clParallelPort
Name | Description | Constraints | Value Type | Upon Runtime Change |
---|
Port Settings |
Working Mode | Defines a working mode for the element.Select the 'Output on event onset' mode for sending signals synchronously with an onset of the parent event,or 'Triggering on input' mode for catching the particular pattern in port input. For custom reading/writing scenarios use the 'Manual IO' mode, in which port communications can be controlled by your code. | | Int32 |
Output |
Test Output | Sends a test output signal through the port using the selected signal profile and the current Output Value. | |
Signal Profile | Defines the time-amplitude profile of the output signal. The 'Level Change', 'Pulse' and 'TTL' profiles are available. Last two can be used to send the EEG triggers. | | Int32 | |
Preface Duration | Defines the duration (ms) of the guarantied zero preface interval for the TTL or Pulse signals. Increase the preface duration marginally, if your recording hardware does not detect port signals. Note that a non-zero preface delays the onset of the actual signal. | | Double | |
Pulse Duration | Duration of an output pulse in ms. The value is applied only, if the Pulse signal profile is selected. | | UInt64 |
Output Value | Value to be sent through the port. Can be defined in integer or binary format, e.g. Output='01010000'; or Output=255; | | clBinaryInteger |
Send Now | Runtime command that that initiates an instant transfer of the current output value through the port. Manual command calls at runtime are only required, if the element works in the Manual I/O mode. | | Boolean | Execute the command by assigning true in code: SendNow=true; |
Input |
Test Input | Open a input monitor window showing real-time port input with the current settings. Use it for testing at designtime. | |
Input Value | Returns the current state of the port input lines. The property is not updated automatically. Manual reading of the property value in snippets is required to obtain the current input. The value can be read either to the integer or binary formats, e.g. 'string S=Input;' may return '01010101'. | | clBinaryInteger |
Triggering Input | eturns the current state of the port input lines. The property is not updated automatically. Manual reading of the property value in snippets is required to obtain the current input. The value can be read either to the integer or binary formats, e.g. 'string S=Input;' may return '01010101'. | | String |
Trigger Once | Returns the current state of the port input lines. The property is not updated automatically. Manual reading of the property value in snippets is required to obtain the current input. The value can be read either to the integer or binary formats, e.g. 'string S=Input;' may return '01010101' | | Boolean |
Runtime Status |
Is Triggered | Indicates whether the element has been triggered at least once, since activation of the parent event. Triggering occurs only in the 'Input Detection' working mode. | | Boolean |
Trigger Time | Indicates the local event time of the last element triggering. Triggering occurs only in the 'Input Detection' working mode. | | UInt64 |
+=== Properties inherited from clElement ===
Inherited properties of clElement
Name | Description | Constraints | Value Type | Upon Change |
---|
Control |
Is Enabled | If set to false the element is completely omitted when the experiment is run. | | Boolean |
|
Title | Title of the element. | | String |
|