Welcome Guest, you are in: Login

EventIDE Wiki

RSSRSS

Navigation




Search the wiki


PoweredBy

Page History: LPT Port Element

Compare Page Revisions



« Older Revision - Back to Page History - Newer Revision »


Page Revision: 2011/07/18 10:21


Element Icon New Element
Info
Category: AddIn: Base Elements
Creator: OkazoLab Team Scope: Communications
Owns Snippets: no Usage: Runtime Screen,Snippets
The element allows/is capable of doing something in experiments


Description

Parallel port element allows using of the parallel port (LTP) of a PC computer in EventIDE experiments. The LTP 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 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 LTP 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 code snippets. The element also can be used to set up an automatic (latency is <1ms) signal exchange 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 for manual sending and receiving digital codes through the LTP port, at will moment. The element has two properties, [Input] and [Output], which 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. Notice 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. Notice that assigning a new value to the [Output] property does not causes an instant updates 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 experiment, for instance, a visual stimulus is presented on the screen. You also can choose a shape of such output signal in time relatively to the duration of the parent event:

  1. Level signal shape. If this signal shape is selected, the element simply sets the output lines of the parallel port to the value defined by [Output] property synchronously with activation of the parent event.
  2. 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.
  3. 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 - the output can be set only when the parent event is activated.

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 a flow of your experiment, performing custom actions and collecting accurate input timing. Notice that the element in this working mode has an action scope - 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

  1. 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.

  1. 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

NameDescriptionAttributesValue Type
Port settings
Working modeDefines the working mode for the element. One of three modes can be selected: Manual – the port input and output are controlled manually, in code snippets, at will moment. AutoOutput - the predefined port output is synchronized with activation of the parent event. The output is shaped in time according to the value of the [Signal shape] property. InputTrigger - the element detects a specific port input, records its time and initiates custom triggering actions.DInt32
Output addressThe address of the output gate of the computer LTP port. The default value is 888 (0x0378)DInt32
Input addressThe address of the input gate in the computer LTP port. The default value is 889 (0x0379)DInt32
Output
Test outputSets the output port lines into the current value of the [Output] property. Use this action at the design time to check availability of the selected port settings.Design-time action
OutputDefines the requesting status of the port output lines. The status is coded by the clBinaryInteger struct, which represents a port output both in Int32 and binary strings formats. Each char in the binary string, like "01011111", corresponds to a single line of the parallel port, where the first line is denoted by the rightmost char. ("1" and "0" code ON and OFF states, correspondingly). The left part of assigned strings with length greater than 8 chars is ignored. The valid value range for the Number field is between 0 and 255.D,RStruct clBinaryInteger with two linked fields: Int32 Number, String Binary Code examples: a.Number=1; a.Binary="00000001";
Signal shapeDefines the output signal shape when the element works in the AutoOutput mode. One of three signal shapes can be selected: Level - the requesting output status is set synchronously with activation of the parent event without a reset of the current output lines. Pulse - the requesting output status is set synchronously with activation of the parent event, plus, the element also performs "pre" and "post" reset of the port output to the ground level. The requesting output status is hold for the time defined by the [Pulse duration] property. Trigger - the requesting output status is set synchronously with activation of the parent event, plus, it accompanied with a pre reset of the output lines to the ground. The requesting output is held after it is set until a new port output operation.DInt32
Pulse durationDefines the duration (in ms) of the signal pulse- the time that the LTP port is holding the requesting output status when it is set with the Pulse Signal shape. In other cases this property is ignored.D,RUInt64
Input
Test inputRequests the current status of the port input lines and store it in the [Input] property. Use this action at the design time to check availability of the selected port settings and the current port input.Design-time action
Input portThe address of the input gate in the computer parallel port. The default value is 889 (0x0379)DInt32
InputRepresents the current status of the input lines of the LTP port. The status is coded by the clBinaryInteger struct, which represents a port input both in Int32 and binary strings formats. Each char in the binary string, like "01011111", corresponds to a single line of the parallel port, where the first line is denoted by the rightmost char. ("1" and "0" code ON and OFF states, correspondingly). The binary string always has a length 8 (as input lines number).D,R, Read-OnlyStruct clBinaryInteger with two linked fields: Int32 Number, String Binary Code examples: Int c=a.Number; string s=a.Binary;
Trigger valueDefines a binary status of the port input lines that has to be detected when the element works in the InputTrigger mode. The sought status is coded by string that cannot have more than 8 chars. Each char in the assigned binary string, like "0*01**11", corresponds to a single line of the parallel port, where the first port line is denoted by the rightmost char. ("1" and "0" code ON and OFF states, correspondingly). If char is set to "*", it means that the status of the corresponding line is irrelevant for detection.D,RString
Trigger OnceDefines the triggering behavior when the element works in the InputTrigger mode. If the value is true, the element may be triggered only once, while the parent event is active. If the value is false, multiple triggering is allowed.DBoolean
Runtime info
Was TriggeredIndicates if the element has been triggered at least once starting from the current activation of the parent eventR, Read-OnlyBoolean
Trigger timeIndicates the latest event time when the element was triggered (in ms elapsed since activation of the parent event). The property is usable only when the element works in the InputTrigger mode.R, Read-onlyUInt64



+=== Properties inherited from clElement === Inherited properties of clElement
NameDescriptionConstraintsValue TypeUpon Change
Control
Is EnabledIf set to false the element is completely omitted when the experiment is run.Boolean
TitleTitle of the element.String

ScrewTurn Wiki version 5.2.0.8. Some of the icons created by FamFamFam.