Welcome Guest, you are in: Login

EventIDE Wiki

RSSRSS

Navigation




Search the wiki


PoweredBy

Summary

Element Icon LPT Port
Info
Category: Communication AddIn: Base Elements
Creator: OkazoLab Scope: Parent event
Owns Snippets: None Usage: Snippets

Properties

NameDescription                              ConstraintsTypeOn
runtime
change
Port Settings
Base Address        Defines the base address the LPT port, for example 0x0378 (888)                Int32         
Working Mode        Defines a working mode for the element.Select the 'AutoOutput 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 communication can be controlled by your code.                stPara..         
Input
Test Input        Open a input monitor window showing real-time port input with the current settings. Use for testing at designtime.                Boolean         
Input Value        Returns the current state of the port input lines. The property is updated automatically only in the Triggering Input mode. The value can be read either to the integer or binary formats, e.g. 'string S=Input;' may return '01010101'                clBina..         
Triggering Value        When the element is in the 'Triggering input' working mode, a value of this property defines the 'catching' input pattern in the binary format. If the pattern is detected in port input at any time, the element registers the detection time and becomes triggered. The Triggering Input has to be defined for each of the port line, e.g. '1111****' can be used for detection of the ON state in the first 4 lines of a 8-bit port. Use either '0' or '1' chars for the relevant lines and and the '*' char for irrelevant. Set all lines to *, if you want to detect any change in the port input.                String         
Trigger Once        Defines whether the element can be triggered multiple times, while the parent event is active. If the property value is 'true' only the first triggering is registered                Boolean         
Output
Signal Profile        Defines the time-amplitude profile of the output signal.'Level Change', 'Pulse' and 'TTL' profiles are available                stPara..         
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 a single output pulse in ms. The value is applied only if the Pulse signal profile is selected                UInt64         
Interpulse Duration        Defines a duration of the inter-pulse interval in ms. The value is applied only if the Pulse  signal profile is selected                clTime         
Pulse Number        Defines a number of pulses in the pulse train. The value is applied only if the Pulse signal profile is selected                Int32         
Output Value        Value to be sent through the port. Can be defined in integer or binary format, e.g. Output='01010000'; or Output=255;                clBina..         
Send Output Now        Runtime action initiating an instant output communication through the port. Call this action in snippets by 'SendNow=true;', but only if the element works in the 'Manual I/O' mode.                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         
Triggering Time        Indicates the local event time of the last element triggering. Triggering occurs only in the 'Input Detection' working mode.                clTime         
Control
Is Enabled        If set to false the element is completely omitted when the experiment is run                Boolean         
Title        Title of the element                String         

LPT Port Element allows sending and receiving data via the parallel port (LTP) of a PC computer. The element can be used in standard experimental tasks, for example, for sending synchronization triggers to an EEG recording station.


Description

The LPT port element allows using the parallel port (LTP) on PC computers for bidirectional data exchange in EventIDE experiments. The LPT port can be described (at the abstract level) as a digital communication device that has 4 input and 8 output lines. Each line is binary, with ON/OFF or 1/0 status, that can be set (for the output lines) or read (for the input lines). Simplicity and instant access make the LPT port be very useful in experimental scenarios that require a accurate synchronization between experimental events and external hardware. For example, the LTP port is often used to send triggers to an EEG recording station.

Snapshots

Image
Image

Practical Use

The parallel port element supports 3 different working modes. In the Manual I/O mode you have direct access to digital lines of the parallel port via the Input and Output element's properties and can program communications manually. In other working modes the element performs communications automatically, such that no or little coding is required.
Using the LPT port element is very straightforward. Consider for example that you want to send a stimulus number to an EEG recording station synchronously with the stimulus onset:
  • Add LPT Port element to your stimulus event.
  • Select the 'Auto-output on event onset' working mode for the created element.
  • Select the proper signal profile. For example, most of EEG recording stations recognize the Pulse signals with a short duration, e.g. 5 ms. You can test what signal profile works best on your hardware, by probing the probe output with Test Output Now action (in element properties). If you use the pulse signal, don't forget to define its duration via the Pulse Duration property.
  • Create a proxy variable linked to the Output property of the element.
  • Choose any snippet that is invoked earlier than the event onset, e.g. Before Onset snippet on the same event
  • Write a code line that assigns a stimulus number to the 'Output' proxy variable:
    
    
    Output=Stimulus_Number;
  • That is it! The stimulus number now will be sent precisely on the stimulus onset

Working Modes



'Manual I/O' mode

In this mode the element can be used for sending and receiving digital codes at arbitrary moments, as defined by your code. The LPT Port element exposes two dedicated properties: Input and Output that give an access to the digital lines of the parallel port. The current port input can be always accessed by reading a value of the Input property in code snippets (Note that if you want to detect changes in the port input, the 'triggering on specific input' mode is more preferable, in which the element monitors all port input automatically). To produce the port output in the manual mode, you need to do two steps:
1) assign a digital code to the Output property
b) invoke a sending action by assign 'true' to the Send Now property (see the example below).


/// Code example on using the LPT Port Element in the 'Manual I/O' mode

//****** Reading the current port input *******
int NewInput=PortInput; // PortInput is a proxy variable linked to the Input property of the LPT Port element

//****** Sending data to port *******
if (N>5)
PortOutput=255; // PortOutput is a proxy variable linked to the Output property of the LPT Port element
else
PortOutput="10101010"; // the output can be also set by a string encoding a binary state for each of 8 port lines
SendNow=true; // initiate actual sending the a new port output, defined by the PortOutput variable


'Output on event onset' mode

In this mode the element sets the port output lines synchronously with onset of the parent event. The status of each output line is chosen according to the current value of the Output property, for example "00101101". A new value can be assigned to the Output property at runtime (use proxy variables for it), but the assignment does not causes an instant update of the output lines. The element will wait for the next onset of its parent event to send the assigned value to a port. This working mode is handy when you need to send an instant trigger to an external device every time, when some event occurs in an experiment. For example, if an event contains a visual stimulus and the Parallel port element, a digital marker will be sent as the stimulus is presented on the screen. In this mode you can also select a shape of the output signal, for example to produce a digital pulse. The following signal shapes are available:


  1. Level Change | ... → Value If this signal shape is selected, the element just instantly sets the output of a parallel port to a value defined by the Output Value property. The port state persists until the next change.
  2. Pulse | ... -> Zero (Preface) → Value → Zero If this signal shape is selected, the element forms the output signal made of 3 parts. Shortly before onset of the parent event, the port is set to the zero. (a preface zero state when all port lines are Off). At the event onset the element instantly changes the port lines to the value defined by the Output property (Value state). Later, after a time interval defined by the Pulse Duration property, the element sets the port output back to the zero. If the pulse duration is greater than the actual duration of the parent event, the element grounds the port on the offset of the the parent event.
  3. TTL | ... → Zero (Preface) → Value If this signal shape is selected, the element forms the output signal made of 2 parts. Shortly before onset of the parent event, the element sets the current port output to the ground (zero preface state when all lines are Off). At the event onset the element instantly changes the port output to the value defined by the Output property (HIGH state). The port state persists until the next change.

'Triggering on specific input' mode

In this working mode the parallel port element monitors selected (or all) input lines of the parallel port in order to detect instantaneous changes in the port's input lines . The monitored lines and their sought states are specified by the Triggering Value property of the element. The element alerts about input changes by switching to the triggered state. The element also records the exact triggering time and invokes the Triggered snippet, if it contains user code. This working mode allows you to use a specific port input for controlling the flow of your experiment, performing custom actions on input and collecting input timing. Notice that in this working mode the element monitors the port input only while the parent event is active. You can use multiple LPT port elements in different events or in the same event with different Triggering Input values. The elements also can be tuned to produce multiple triggering alerts, when the port input delivers repeated occurrences of the triggering value (by default, the element is triggered only once, as the triggering value is detected for the first time).

Notes

  1. When the element is in the 'Auto-output on event onset' mode, you have to assign the output value before the event onset. You can assign a value to the Output property in the designer or, if you want to change the value at runtime, in the Before Onset snippet or in any of earlier events.
  2. If you need to detect any change in the port input, then use the 'Triggering on specific input' mode with the Triggering Input property set to '********', such that a change in any line would cause the element triggering.
  3. For better synchronization of the port output in the 'Auto-output on event onset' mode, move the LPT Port element at the top of the elements list in the parent event. Elements get to work one by one on the onset of the parent event, so the top position in the list guaranties a minimal start-up delay.
  4. In the 'Triggering on specific input' mode the element does not get triggered, if the triggering value is already present in the port input on the onset of the parent event. A change of the port line is required to trigger the element.
  Name Size
- LPT-Port-Element-Icon.png 3.39 KB
- Parallel-Port-Element.png.jpg 103.86 KB
- Parallel-Port.jpg 103.86 KB
- Parallel-Port_sm.jpg 56.31 KB
- Pins.png 53.55 KB
- Pins_sm.jpg 45.48 KB

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