<?xml version="1.0"?>
<Experiment xmlns:dt="urn:schemas-microsoft-com:datatypes"><General><Version><Major>2</Major><Minor>0</Minor><Internal>10</Internal><Build>252</Build><_VersionPersist dt:dt="int">200</_VersionPersist></Version></General><ExperimentObject><Guid dt:dt="string">{07443894-B003-4596-8CA4-B473F4286C00}</Guid><Root dt:dt="string">SessionProc</Root><Name dt:dt="string"></Name><Author dt:dt="string">Psychology Software Tools, Inc.</Author><Abstract dt:dt="string">NOTE: This sample uses deprecated methods to configure a Parallel Port in E-Prime. This sample is provided for legacy purposes only. These methods should not be used when creating new experiments. Instead, PST recommends adding a ParallelPort device to an experiment via the Devices tab of the Experiment Object's property pages and setting its properties appropriately. See &lt;kb&gt;17150&lt;/kb&gt; for more information.
 
NOTE: Most Parallel Ports or PCI cards today support bi-directional communications and can detect which is needed automatically. E-Prime is capable of both sending and receiving markers through the Parallel Port, though not simultaneously. If you are using an older Parallel Port or PCI card, it may need to be configured specifically for input or output.
 
Abstract
This sample investigates the ability for your computer to use ECP/EPP Parallel Ports to emulate legacy SPP or Bi-Directional modes. With the script routines included in this experiment, you can configure your Parallel Port so that the DATA port (pins 2-9) act as either input or output. Using these commands allows for ease of configuration among the widest range of computers and reduces the need to edit the system BIOS to configure parallel ports.
 
By default, E-Prime has traditionally worked the best with Parallel Ports that are in 'Output Only' or 'SPP' mode. In this legacy mode, the Parallel Port allows for eight bits of output on the DATA port (pins 2-9). 5 bits of data could be read from the Status port.
 
Most Parallel Ports or PCI cards today are newer ECP/EPP Parallel Ports, which provide the ability to emulate the older SPP or Bi-Directional Parallel Ports. This allows for the ability to set the DATA port on the Parallel Ports for reading or writing (but not simultaneously).
  
To use the routines in your experiment, first copy and paste the User script area from this experiment into your experiment. Then, copy the 'Const PORT_ADDRESS' line from the top of the 'GetPortInfo' InLine object and paste it into your experiment, changing the port address value if needed. Finally, call the appropriate routines to configure your parallel port.
</Abstract><Notes dt:dt="string"></Notes><ClockGuid dt:dt="string">{10343DBD-55BE-45C7-AA62-A5239F6918AB}</ClockGuid><ClockIndex dt:dt="int">0</ClockIndex><ClockScale dt:dt="r8">1</ClockScale><VersionMajor dt:dt="int">1</VersionMajor><VersionMinor dt:dt="int">0</VersionMinor><VersionInternal dt:dt="int">0</VersionInternal><VersionBuild dt:dt="int">2</VersionBuild><VersionAutoIncrement dt:dt="boolean">0</VersionAutoIncrement><CreationDateUtc dt:dt="dateTime">2019-06-03T15:53:06.000</CreationDateUtc><Features dt:dt="int">536870912</Features><Devices><Device><Name dt:dt="string">Display</Name><Class dt:dt="string">Display</Class><DeviceObject><_VersionPersist dt:dt="int">1</_VersionPersist><OpenDevice dt:dt="int">-1</OpenDevice><RTAdjustment dt:dt="int">0</RTAdjustment><Width dt:dt="int">640</Width><Height dt:dt="int">480</Height><BitsPerPixel dt:dt="int">16</BitsPerPixel><DefaultColor dt:dt="string">white</DefaultColor><DisplayIndex dt:dt="int">1</DisplayIndex><RefreshRateRequested dt:dt="int">0</RefreshRateRequested><MinAcceptableRefreshRate dt:dt="int">39</MinAcceptableRefreshRate><MaxAcceptableRefreshRate dt:dt="int">201</MaxAcceptableRefreshRate><DefaultSettingsUsed dt:dt="string">No</DefaultSettingsUsed><BadRefreshErrorUsed dt:dt="string">Yes</BadRefreshErrorUsed><FlippingEnabled dt:dt="boolean">0</FlippingEnabled><RefreshAlignment dt:dt="string">0%</RefreshAlignment></DeviceObject></Device><Device><Name dt:dt="string">Sound</Name><Class dt:dt="string">Sound</Class><DeviceObject><_VersionPersist dt:dt="int">1</_VersionPersist><OpenDevice dt:dt="int">0</OpenDevice><RTAdjustment dt:dt="int">0</RTAdjustment><API dt:dt="string">DirectSound</API></DeviceObject></Device><Device><Name dt:dt="string">Keyboard</Name><Class dt:dt="string">Keyboard</Class><DeviceObject><_VersionPersist dt:dt="int">1</_VersionPersist><OpenDevice dt:dt="int">-1</OpenDevice><CollectionMode dt:dt="int">1</CollectionMode><EmulateDeviceName dt:dt="string"></EmulateDeviceName><SystemAbortWatchSequence dt:dt="string"></SystemAbortWatchSequence><UserBreakStateSequence dt:dt="string"></UserBreakStateSequence><ConditionalExitSequence dt:dt="string"></ConditionalExitSequence><RTAdjustment dt:dt="int">0</RTAdjustment><CapsLock dt:dt="boolean">0</CapsLock><NumLock dt:dt="boolean">1</NumLock></DeviceObject></Device><Device><Name dt:dt="string">Mouse</Name><Class dt:dt="string">Mouse</Class><DeviceObject><_VersionPersist dt:dt="int">1</_VersionPersist><OpenDevice dt:dt="int">-1</OpenDevice><CollectionMode dt:dt="int">1</CollectionMode><EmulateDeviceName dt:dt="string"></EmulateDeviceName><SystemAbortWatchSequence dt:dt="string"></SystemAbortWatchSequence><UserBreakStateSequence dt:dt="string"></UserBreakStateSequence><ConditionalExitSequence dt:dt="string"></ConditionalExitSequence><RTAdjustment dt:dt="int">0</RTAdjustment><OpenMode dt:dt="int">0</OpenMode><ShowCursor dt:dt="boolean">0</ShowCursor></DeviceObject></Device><Device><Name dt:dt="string">Port</Name><Class dt:dt="string">Port</Class><DeviceObject><_VersionPersist dt:dt="int">1</_VersionPersist><OpenDevice dt:dt="int">-1</OpenDevice><CollectionMode dt:dt="int">1</CollectionMode><EmulateDeviceName dt:dt="string"></EmulateDeviceName><SystemAbortWatchSequence dt:dt="string"></SystemAbortWatchSequence><UserBreakStateSequence dt:dt="string"></UserBreakStateSequence><ConditionalExitSequence dt:dt="string"></ConditionalExitSequence><RTAdjustment dt:dt="int">0</RTAdjustment><Address dt:dt="string">&amp;H378</Address><Size dt:dt="int">8</Size><Invert dt:dt="int">0</Invert><Mask dt:dt="string">-1</Mask><Debounce dt:dt="int">0</Debounce></DeviceObject></Device></Devices><Packages/><DataFile><WarnBeforeOverwrite dt:dt="int">-1</WarnBeforeOverwrite><WarnIfConvertFailed dt:dt="int">-1</WarnIfConvertFailed><RemoveERecoveryFile dt:dt="int">0</RemoveERecoveryFile><ReceiveFeedbackDuringDataFileConversion dt:dt="int">-1</ReceiveFeedbackDuringDataFileConversion><DataFileName dt:dt="string"></DataFileName><LogLevels><LogLevel dt:dt="string">Block</LogLevel><LogLevel dt:dt="string">Trial</LogLevel><LogLevel dt:dt="string">SubTrial</LogLevel><LogLevel dt:dt="string">LogLevel5</LogLevel><LogLevel dt:dt="string">LogLevel6</LogLevel><LogLevel dt:dt="string">LogLevel7</LogLevel><LogLevel dt:dt="string">LogLevel8</LogLevel><LogLevel dt:dt="string">LogLevel9</LogLevel><LogLevel dt:dt="string">LogLevel10</LogLevel></LogLevels></DataFile><StartupInfo><DisplaySummary dt:dt="boolean">1</DisplaySummary><UseDefaults dt:dt="boolean">0</UseDefaults><LoadStartupInfo dt:dt="boolean">1</LoadStartupInfo><StartupInfoItems><StartupInfoItem><Name dt:dt="string">Subject</Name><Prompt dt:dt="string">Please enter the Subject Number (1-32767, 0=No Data Logging):</Prompt><DataType dt:dt="int">0</DataType><Enabled dt:dt="int">-1</Enabled><PromptEnabled dt:dt="int">-1</PromptEnabled><Default dt:dt="string">1</Default><Min dt:dt="int">0</Min><Max dt:dt="int">32767</Max></StartupInfoItem><StartupInfoItem><Name dt:dt="string">Session</Name><Prompt dt:dt="string">Please enter the Session Number (1-32767):</Prompt><DataType dt:dt="int">0</DataType><Enabled dt:dt="int">-1</Enabled><PromptEnabled dt:dt="int">-1</PromptEnabled><Default dt:dt="string">1</Default><Min dt:dt="int">1</Min><Max dt:dt="int">32767</Max></StartupInfoItem><StartupInfoItem><Name dt:dt="string">Group</Name><Prompt dt:dt="string">Please enter Subject's Group (0-32767):</Prompt><DataType dt:dt="int">0</DataType><Enabled dt:dt="int">0</Enabled><PromptEnabled dt:dt="int">0</PromptEnabled><Default dt:dt="string">1</Default><Min dt:dt="int">0</Min><Max dt:dt="int">32767</Max></StartupInfoItem><StartupInfoItem><Name dt:dt="string">Name</Name><Prompt dt:dt="string">Please enter Subject's Name:</Prompt><DataType dt:dt="int">1</DataType><Enabled dt:dt="int">0</Enabled><PromptEnabled dt:dt="int">0</PromptEnabled><Default dt:dt="string"></Default><MaxLength dt:dt="int">255</MaxLength></StartupInfoItem><StartupInfoItem><Name dt:dt="string">Age</Name><Prompt dt:dt="string">Please enter Subject's Age (0-150):</Prompt><DataType dt:dt="int">0</DataType><Enabled dt:dt="int">0</Enabled><PromptEnabled dt:dt="int">0</PromptEnabled><Default dt:dt="string">0</Default><Min dt:dt="int">0</Min><Max dt:dt="int">150</Max></StartupInfoItem><StartupInfoItem><Name dt:dt="string">Sex</Name><Prompt dt:dt="string">Please enter Subject's Sex:</Prompt><DataType dt:dt="int">2</DataType><Enabled dt:dt="int">0</Enabled><PromptEnabled dt:dt="int">0</PromptEnabled><Default dt:dt="string">male</Default><Choices><Choice dt:dt="string">male</Choice><Choice dt:dt="string">female</Choice></Choices></StartupInfoItem><StartupInfoItem><Name dt:dt="string">Handedness</Name><Prompt dt:dt="string">Enter Subject's Handedness:</Prompt><DataType dt:dt="int">2</DataType><Enabled dt:dt="int">0</Enabled><PromptEnabled dt:dt="int">0</PromptEnabled><Default dt:dt="string">left</Default><Choices><Choice dt:dt="string">left</Choice><Choice dt:dt="string">right</Choice></Choices></StartupInfoItem><StartupInfoItem><Name dt:dt="string">ResearcherID</Name><Prompt dt:dt="string">Please enter Researcher's ID:</Prompt><DataType dt:dt="int">0</DataType><Enabled dt:dt="int">0</Enabled><PromptEnabled dt:dt="int">0</PromptEnabled><Default dt:dt="string">1</Default><Min dt:dt="int">0</Min><Max dt:dt="int">32767</Max></StartupInfoItem></StartupInfoItems></StartupInfo></ExperimentObject><StudioItems><StudioItem><Name dt:dt="string">SessionProc</Name><TypeName dt:dt="string">Procedure</TypeName><Tag dt:dt="string"></Tag><Notes dt:dt="string"></Notes><ObjectData><Guid dt:dt="string">{447492DF-BBFA-4199-AA59-793EC5288CB8}</Guid><Version><Major>2</Major><Minor>0</Minor><Internal>10</Internal><Build>254</Build><_VersionPersist dt:dt="int">201</_VersionPersist></Version><LoggingItems/><ItemList><Item dt:dt="string">LookAtUserScript</Item><Item dt:dt="string">GetPortInfo</Item><Item dt:dt="string">PortInfo</Item><Item dt:dt="string">CheckContinue</Item><Item dt:dt="string">InputDisplay</Item><Item dt:dt="string">OutputDisplay</Item><Item dt:dt="string">ConfigureAndGo</Item><Item dt:dt="string">ExampleCalls</Item><Item dt:dt="string">GoodbyeLabel</Item><Item dt:dt="string">Goodbye</Item></ItemList><DeviceList/><LogData dt:dt="boolean">1</LogData><FlushDataLog dt:dt="boolean">0</FlushDataLog><GenerateLabels dt:dt="boolean">1</GenerateLabels><ProcessPendingInputMasks dt:dt="int">2</ProcessPendingInputMasks><GeneratePreRun dt:dt="int">2</GeneratePreRun><GeneratePostRun dt:dt="int">2</GeneratePostRun><FlowItems><FlowItem><Name dt:dt="string">LookAtUserScript</Name><TypeName dt:dt="string">TextDisplay</TypeName></FlowItem><FlowItem><Name dt:dt="string">GetPortInfo</Name><TypeName dt:dt="string">InLine</TypeName></FlowItem><FlowItem><Name dt:dt="string">PortInfo</Name><TypeName dt:dt="string">TextDisplay</TypeName></FlowItem><FlowItem><Name dt:dt="string">CheckContinue</Name><TypeName dt:dt="string">InLine</TypeName></FlowItem><FlowItem><Name dt:dt="string">InputDisplay</Name><TypeName dt:dt="string">TextDisplay</TypeName></FlowItem><FlowItem><Name dt:dt="string">OutputDisplay</Name><TypeName dt:dt="string">TextDisplay</TypeName></FlowItem><FlowItem><Name dt:dt="string">ConfigureAndGo</Name><TypeName dt:dt="string">TextDisplay</TypeName></FlowItem><FlowItem><Name dt:dt="string">ExampleCalls</Name><TypeName dt:dt="string">InLine</TypeName></FlowItem><FlowItem><Name dt:dt="string">GoodbyeLabel</Name><TypeName dt:dt="string">Label</TypeName></FlowItem><FlowItem><Name dt:dt="string">Goodbye</Name><TypeName dt:dt="string">TextDisplay</TypeName></FlowItem></FlowItems></ObjectData></StudioItem><StudioItem><Name dt:dt="string">GetPortInfo</Name><TypeName dt:dt="string">InLine</TypeName><Tag dt:dt="string"></Tag><Notes dt:dt="string"></Notes><ObjectData><Guid dt:dt="string">{D1D6A09C-7060-4049-9B2A-5CE1F1ECF261}</Guid><Version><Major>2</Major><Minor>0</Minor><Internal>10</Internal><Build>262</Build><_VersionPersist dt:dt="int">1</_VersionPersist></Version><LoggingItems/><DeviceList/><Code dt:dt="string">
	'This is the port address used in this experiment
	' The default value for LPT1 is typically &amp;H378
	' Adjust this value if your parallel port is located
	' at another address or if you have multiple parallel
	' ports in the machine.
	Const PORT_ADDRESS = &amp;H378


	'Find out what type of parallel port is
	' configured on the system
	Dim nPortType As Long
	nPortType = GetPortType(PORT_ADDRESS)

	'Get the human readable description
	Dim strDescription As String
	strDescription = GetPortDescription(PORT_ADDRESS)

	'Find out what the capabilities are
	Dim strCapabilities As String
	Select Case nPortType
		Case PORT_TYPE_SPP
			strCapabilities = "The parallel port is configured for legacy SPP (Output Only) mode." &amp; _
								"  You will not be able to use the ConfigurePortForInput or " &amp; _
								"ConfigurePortForOutput routines in this function at this time.  " &amp; _
								"Please configure the parallel port in the system BIOS " &amp; _
								"and change the parallel port mode to ECP/EPP and run " &amp; _
								"this experiment again."

			'Set the user break state so that we jump out of the experiment
			SetUserBreakState -1

		Case PORT_TYPE_PS2
			strCapabilities = "The parallel port is configured for legacy PS2 mode." &amp; _
								"  You will not be able to use the ConfigurePortForInput or " &amp; _
								"ConfigurePortForOutput routines in this function at this time.  " &amp; _
								"Please configure the parallel port in the system BIOS " &amp; _
								"and change the parallel port mode to ECP/EPP and run " &amp; _
								"this experiment again."

			'Set the user break state so that we jump out of the experiment
			SetUserBreakState -1

		Case PORT_TYPE_EPP, PORT_TYPE_ECP
			strCapabilities = "The parallel port is configured for the newer ECP/EPP modes.  " &amp; _
								"Your computer is configured to use the script routines in " &amp; _
								"this experiment.  Although all of the routines in the User " &amp; _
								"script area can be called from an InLine in your experiment, " &amp; _ 
								"the major routines to note are ConfigurePortForInput and " &amp; _
								"ConfigurePortForOutput as described on the following screens."
		Case Else
			strCapabilities = "The parallel port is configured for an unknown mode or an invalid port address was used." &amp; _
								"  You will not be able to use the ConfigurePortForInput or " &amp; _
								"ConfigurePortForOutput routines in this function at this time.  " &amp; _
								"Please configure the parallel port in the system BIOS " &amp; _
								"and change the parallel port mode to ECP/EPP and run " &amp; _
								"this experiment again."

			'Set the user break state so that we jump out of the experiment
			SetUserBreakState -1

	End Select


	'Set the values
	c.SetAttrib "Description", strDescription
	c.SetAttrib "Capabilities", strCapabilities



</Code></ObjectData></StudioItem><StudioItem><Name dt:dt="string">CheckContinue</Name><TypeName dt:dt="string">InLine</TypeName><Tag dt:dt="string"></Tag><Notes dt:dt="string"></Notes><ObjectData><Guid dt:dt="string">{DE207A8A-08DC-4847-B33B-ADD956642336}</Guid><Version><Major>2</Major><Minor>0</Minor><Internal>10</Internal><Build>262</Build><_VersionPersist dt:dt="int">1</_VersionPersist></Version><LoggingItems/><DeviceList/><Code dt:dt="string">

	'If the InLine above set the user break state, then
	' we jump to the goodbye
	If GetUserBreakState &lt;&gt; 0 Then GoTo GoodbyeLabel</Code></ObjectData></StudioItem><StudioItem><Name dt:dt="string">ExampleCalls</Name><TypeName dt:dt="string">InLine</TypeName><Tag dt:dt="string"></Tag><Notes dt:dt="string"></Notes><ObjectData><Guid dt:dt="string">{350C0B1C-0943-459B-9DC8-6E8F24FAB995}</Guid><Version><Major>2</Major><Minor>0</Minor><Internal>10</Internal><Build>262</Build><_VersionPersist dt:dt="int">1</_VersionPersist></Version><LoggingItems/><DeviceList/><Code dt:dt="string">

	'Configure the port for output
	' After this call, use WritePort PORT_ADDRESS, 1
	' to set the LSB (pin 2) high or set the OnsetSignalXXX
	' properties of an object.
	ConfigurePortForOutput PORT_ADDRESS


	'Configure the port for input
	' After this call, use x = ReadPort(PORT_ADDRESS)
	' or use the PortDevice in the Duration/Input
	' property page of an object.  Note that
	' you do not need to use &amp;379 (base + 1) to 
	' read the data since you are reading from
	' the DATA port (pins 2-9)
	ConfigurePortForInput PORT_ADDRESS


	</Code></ObjectData></StudioItem><StudioItem><Name dt:dt="string">LookAtUserScript</Name><TypeName dt:dt="string">TextDisplay</TypeName><Tag dt:dt="string"></Tag><Notes dt:dt="string"></Notes><ObjectData><Guid dt:dt="string">{BF7AAC94-7FCF-4572-A72B-0A88B3471075}</Guid><Version><Major>2</Major><Minor>0</Minor><Internal>10</Internal><Build>263</Build><_VersionPersist dt:dt="int">100</_VersionPersist></Version><LoggingItems><LoggingItem><Name dt:dt="string">OnsetDelay</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">OnsetTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">DurationError</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">PreRelease</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">Duration</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">StartTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">OffsetTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">FinishTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">TimingMode</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">CustomOnsetTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">CustomOffsetTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">ActionDelay</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">ActionTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">TargetOffsetTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">TargetOnsetTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">PendingInputMasks</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">OffsetDelay</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">RTTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">ACC</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">RT</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">RESP</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">CRESP</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">Tag</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">OnsetToOnsetTime</Name><Log dt:dt="boolean">0</Log></LoggingItem></LoggingItems><DeviceList><Device dt:dt="string">Keyboard</Device></DeviceList><InputMasks><InputMask><DeviceName dt:dt="string">Keyboard</DeviceName><DeviceClass dt:dt="string">Keyboard</DeviceClass><AllowableInput dt:dt="string">{ANY}</AllowableInput><CorrectInput dt:dt="string"></CorrectInput><TimeLimit dt:dt="string"></TimeLimit><MaxCount dt:dt="string">1</MaxCount><InputAction dt:dt="int">1</InputAction><SyncOwnerDuration dt:dt="boolean">1</SyncOwnerDuration><Enabled dt:dt="boolean">1</Enabled><FlushInputBuffer dt:dt="string">Yes</FlushInputBuffer><TerminationInput dt:dt="string"></TerminationInput><UserTag dt:dt="string"></UserTag><EchoClients/><ResponseMode dt:dt="string">All</ResponseMode><ProcessBackspace dt:dt="string">Yes</ProcessBackspace></InputMask></InputMasks><Tasks/><Duration dt:dt="string">-1</Duration><JumpLabel dt:dt="string"></JumpLabel><TimingMode dt:dt="int">0</TimingMode><PreRelease dt:dt="string">0</PreRelease><OnsetSync dt:dt="int">1</OnsetSync><OffsetSync dt:dt="int">0</OffsetSync><ForeColor dt:dt="string">black</ForeColor><BackColor dt:dt="string">white</BackColor><BackStyle dt:dt="string">opaque</BackStyle><BorderColor dt:dt="string">black</BorderColor><BorderWidth dt:dt="string">0</BorderWidth><X dt:dt="string">center</X><Y dt:dt="string">center</Y><Width dt:dt="string">100%</Width><Height dt:dt="string">100%</Height><XAlign dt:dt="string">center</XAlign><YAlign dt:dt="string">center</YAlign><AlignHorizontal dt:dt="string">center</AlignHorizontal><AlignVertical dt:dt="string">center</AlignVertical><ClearAfter dt:dt="string">No</ClearAfter><FontName dt:dt="string">Courier New</FontName><FontSize dt:dt="string">16</FontSize><FontBold dt:dt="string">Yes</FontBold><FontItalic dt:dt="string">No</FontItalic><FontUnderline dt:dt="string">No</FontUnderline><FontStrikeout dt:dt="string">No</FontStrikeout><Text dt:dt="string">Welcome!

This experiment contains some script routines that will help configure your parallel port to read or write to the DATA port (pins 2-9).

To add these routines to your experiment, copy and paste all of the User script from this experiment to the User script area in your experiment and call the appropriate routines to configure your parallel port.

If you receive any errors while running this experiment, view the comments above the lines where the error occurs and contact E-Prime Web Support.


Press any key to continue...</Text><WordWrap dt:dt="int">-1</WordWrap><GeneratePreRun dt:dt="int">0</GeneratePreRun><GeneratePostRun dt:dt="int">0</GeneratePostRun><ResetLoggingProperties dt:dt="boolean">0</ResetLoggingProperties></ObjectData></StudioItem><StudioItem><Name dt:dt="string">InputDisplay</Name><TypeName dt:dt="string">TextDisplay</TypeName><Tag dt:dt="string"></Tag><Notes dt:dt="string"></Notes><ObjectData><Guid dt:dt="string">{1D148814-6860-4B0E-9C62-B58BF8EBC717}</Guid><Version><Major>2</Major><Minor>0</Minor><Internal>10</Internal><Build>263</Build><_VersionPersist dt:dt="int">100</_VersionPersist></Version><LoggingItems><LoggingItem><Name dt:dt="string">OnsetDelay</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">OnsetTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">DurationError</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">PreRelease</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">Duration</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">StartTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">OffsetTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">FinishTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">TimingMode</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">CustomOnsetTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">CustomOffsetTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">ActionDelay</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">ActionTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">TargetOffsetTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">TargetOnsetTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">PendingInputMasks</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">OffsetDelay</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">RTTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">ACC</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">RT</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">RESP</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">CRESP</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">Tag</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">OnsetToOnsetTime</Name><Log dt:dt="boolean">0</Log></LoggingItem></LoggingItems><DeviceList><Device dt:dt="string">Keyboard</Device></DeviceList><InputMasks><InputMask><DeviceName dt:dt="string">Keyboard</DeviceName><DeviceClass dt:dt="string">Keyboard</DeviceClass><AllowableInput dt:dt="string">{ANY}</AllowableInput><CorrectInput dt:dt="string"></CorrectInput><TimeLimit dt:dt="string"></TimeLimit><MaxCount dt:dt="string">1</MaxCount><InputAction dt:dt="int">1</InputAction><SyncOwnerDuration dt:dt="boolean">1</SyncOwnerDuration><Enabled dt:dt="boolean">1</Enabled><FlushInputBuffer dt:dt="string">Yes</FlushInputBuffer><TerminationInput dt:dt="string"></TerminationInput><UserTag dt:dt="string"></UserTag><EchoClients/><ResponseMode dt:dt="string">All</ResponseMode><ProcessBackspace dt:dt="string">Yes</ProcessBackspace></InputMask></InputMasks><Tasks/><Duration dt:dt="string">-1</Duration><JumpLabel dt:dt="string"></JumpLabel><TimingMode dt:dt="int">0</TimingMode><PreRelease dt:dt="string">0</PreRelease><OnsetSync dt:dt="int">1</OnsetSync><OffsetSync dt:dt="int">0</OffsetSync><ForeColor dt:dt="string">black</ForeColor><BackColor dt:dt="string">white</BackColor><BackStyle dt:dt="string">opaque</BackStyle><BorderColor dt:dt="string">black</BorderColor><BorderWidth dt:dt="string">0</BorderWidth><X dt:dt="string">center</X><Y dt:dt="string">center</Y><Width dt:dt="string">100%</Width><Height dt:dt="string">100%</Height><XAlign dt:dt="string">center</XAlign><YAlign dt:dt="string">center</YAlign><AlignHorizontal dt:dt="string">center</AlignHorizontal><AlignVertical dt:dt="string">center</AlignVertical><ClearAfter dt:dt="string">No</ClearAfter><FontName dt:dt="string">Courier New</FontName><FontSize dt:dt="string">16</FontSize><FontBold dt:dt="string">Yes</FontBold><FontItalic dt:dt="string">No</FontItalic><FontUnderline dt:dt="string">No</FontUnderline><FontStrikeout dt:dt="string">No</FontStrikeout><Text dt:dt="string">READING INPUT
=============

To read input from the parallel port call ConfigurePortForInput(&amp;&amp;H378).  When you call ReadPort(&amp;&amp;H378) or use the PortDevice, the value returned will be the eight bits of data on the Data port of the parallel port (Pins 2-9).  Please note that the address does not need to be (base + 1) since you have configured the port for input.

(Don't forget to connect your ground to one of the pins 18-25).


Press any key to continue...


* - &amp;&amp;H378 is typically the default address for LPT1.</Text><WordWrap dt:dt="int">-1</WordWrap><GeneratePreRun dt:dt="int">0</GeneratePreRun><GeneratePostRun dt:dt="int">0</GeneratePostRun><ResetLoggingProperties dt:dt="boolean">0</ResetLoggingProperties></ObjectData></StudioItem><StudioItem><Name dt:dt="string">OutputDisplay</Name><TypeName dt:dt="string">TextDisplay</TypeName><Tag dt:dt="string"></Tag><Notes dt:dt="string"></Notes><ObjectData><Guid dt:dt="string">{A923E65B-7993-49B3-8AEE-BD60C619A498}</Guid><Version><Major>2</Major><Minor>0</Minor><Internal>10</Internal><Build>263</Build><_VersionPersist dt:dt="int">100</_VersionPersist></Version><LoggingItems><LoggingItem><Name dt:dt="string">OnsetDelay</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">OnsetTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">DurationError</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">PreRelease</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">Duration</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">StartTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">OffsetTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">FinishTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">TimingMode</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">CustomOnsetTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">CustomOffsetTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">ActionDelay</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">ActionTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">TargetOffsetTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">TargetOnsetTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">PendingInputMasks</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">OffsetDelay</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">RTTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">ACC</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">RT</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">RESP</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">CRESP</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">Tag</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">OnsetToOnsetTime</Name><Log dt:dt="boolean">0</Log></LoggingItem></LoggingItems><DeviceList><Device dt:dt="string">Keyboard</Device></DeviceList><InputMasks><InputMask><DeviceName dt:dt="string">Keyboard</DeviceName><DeviceClass dt:dt="string">Keyboard</DeviceClass><AllowableInput dt:dt="string">{ANY}</AllowableInput><CorrectInput dt:dt="string"></CorrectInput><TimeLimit dt:dt="string"></TimeLimit><MaxCount dt:dt="string">1</MaxCount><InputAction dt:dt="int">1</InputAction><SyncOwnerDuration dt:dt="boolean">1</SyncOwnerDuration><Enabled dt:dt="boolean">1</Enabled><FlushInputBuffer dt:dt="string">Yes</FlushInputBuffer><TerminationInput dt:dt="string"></TerminationInput><UserTag dt:dt="string"></UserTag><EchoClients/><ResponseMode dt:dt="string">All</ResponseMode><ProcessBackspace dt:dt="string">Yes</ProcessBackspace></InputMask></InputMasks><Tasks/><Duration dt:dt="string">-1</Duration><JumpLabel dt:dt="string"></JumpLabel><TimingMode dt:dt="int">0</TimingMode><PreRelease dt:dt="string">0</PreRelease><OnsetSync dt:dt="int">1</OnsetSync><OffsetSync dt:dt="int">0</OffsetSync><ForeColor dt:dt="string">black</ForeColor><BackColor dt:dt="string">white</BackColor><BackStyle dt:dt="string">opaque</BackStyle><BorderColor dt:dt="string">black</BorderColor><BorderWidth dt:dt="string">0</BorderWidth><X dt:dt="string">center</X><Y dt:dt="string">center</Y><Width dt:dt="string">100%</Width><Height dt:dt="string">100%</Height><XAlign dt:dt="string">center</XAlign><YAlign dt:dt="string">center</YAlign><AlignHorizontal dt:dt="string">center</AlignHorizontal><AlignVertical dt:dt="string">center</AlignVertical><ClearAfter dt:dt="string">No</ClearAfter><FontName dt:dt="string">Courier New</FontName><FontSize dt:dt="string">16</FontSize><FontBold dt:dt="string">Yes</FontBold><FontItalic dt:dt="string">No</FontItalic><FontUnderline dt:dt="string">No</FontUnderline><FontStrikeout dt:dt="string">No</FontStrikeout><Text dt:dt="string">SENDING OUTPUT
=============

To output date to the parallel port call ConfigurePortForOutput(&amp;&amp;H378).  When you call WritePort(&amp;&amp;H378, x) or use OnsetSignalXXX, the value sent will be the eight bits of data to the Data port of the parallel port (Pins 2-9).  

(Don't forget to connect your ground to one of the pins 18-25).


Press any key to continue...


* - &amp;&amp;H378 is typically the default address for LPT1.</Text><WordWrap dt:dt="int">-1</WordWrap><GeneratePreRun dt:dt="int">0</GeneratePreRun><GeneratePostRun dt:dt="int">0</GeneratePostRun><ResetLoggingProperties dt:dt="boolean">0</ResetLoggingProperties></ObjectData></StudioItem><StudioItem><Name dt:dt="string">Goodbye</Name><TypeName dt:dt="string">TextDisplay</TypeName><Tag dt:dt="string"></Tag><Notes dt:dt="string"></Notes><ObjectData><Guid dt:dt="string">{F56704A1-AD9B-4319-92B1-31BC01D4EB57}</Guid><Version><Major>2</Major><Minor>0</Minor><Internal>10</Internal><Build>263</Build><_VersionPersist dt:dt="int">100</_VersionPersist></Version><LoggingItems><LoggingItem><Name dt:dt="string">OnsetDelay</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">OnsetTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">DurationError</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">PreRelease</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">Duration</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">StartTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">OffsetTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">FinishTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">TimingMode</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">CustomOnsetTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">CustomOffsetTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">ActionDelay</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">ActionTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">TargetOffsetTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">TargetOnsetTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">PendingInputMasks</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">OffsetDelay</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">RTTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">ACC</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">RT</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">RESP</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">CRESP</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">Tag</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">OnsetToOnsetTime</Name><Log dt:dt="boolean">0</Log></LoggingItem></LoggingItems><DeviceList/><InputMasks/><Tasks/><Duration dt:dt="string">1000</Duration><JumpLabel dt:dt="string"></JumpLabel><TimingMode dt:dt="int">0</TimingMode><PreRelease dt:dt="string">0</PreRelease><OnsetSync dt:dt="int">1</OnsetSync><OffsetSync dt:dt="int">0</OffsetSync><ForeColor dt:dt="string">black</ForeColor><BackColor dt:dt="string">white</BackColor><BackStyle dt:dt="string">opaque</BackStyle><BorderColor dt:dt="string">black</BorderColor><BorderWidth dt:dt="string">0</BorderWidth><X dt:dt="string">center</X><Y dt:dt="string">center</Y><Width dt:dt="string">100%</Width><Height dt:dt="string">100%</Height><XAlign dt:dt="string">center</XAlign><YAlign dt:dt="string">center</YAlign><AlignHorizontal dt:dt="string">center</AlignHorizontal><AlignVertical dt:dt="string">center</AlignVertical><ClearAfter dt:dt="string">No</ClearAfter><FontName dt:dt="string">Courier New</FontName><FontSize dt:dt="string">18</FontSize><FontBold dt:dt="string">Yes</FontBold><FontItalic dt:dt="string">No</FontItalic><FontUnderline dt:dt="string">No</FontUnderline><FontStrikeout dt:dt="string">No</FontStrikeout><Text dt:dt="string">Goodbye!



Thank you for supporting E-Prime!</Text><WordWrap dt:dt="int">-1</WordWrap><GeneratePreRun dt:dt="int">0</GeneratePreRun><GeneratePostRun dt:dt="int">0</GeneratePostRun><ResetLoggingProperties dt:dt="boolean">0</ResetLoggingProperties></ObjectData></StudioItem><StudioItem><Name dt:dt="string">PortInfo</Name><TypeName dt:dt="string">TextDisplay</TypeName><Tag dt:dt="string"></Tag><Notes dt:dt="string"></Notes><ObjectData><Guid dt:dt="string">{B89A12EE-2CF2-4995-8725-8609B6599951}</Guid><Version><Major>2</Major><Minor>0</Minor><Internal>10</Internal><Build>263</Build><_VersionPersist dt:dt="int">100</_VersionPersist></Version><LoggingItems><LoggingItem><Name dt:dt="string">OnsetDelay</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">OnsetTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">DurationError</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">PreRelease</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">Duration</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">StartTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">OffsetTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">FinishTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">TimingMode</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">CustomOnsetTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">CustomOffsetTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">ActionDelay</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">ActionTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">TargetOffsetTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">TargetOnsetTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">PendingInputMasks</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">OffsetDelay</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">RTTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">ACC</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">RT</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">RESP</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">CRESP</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">Tag</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">OnsetToOnsetTime</Name><Log dt:dt="boolean">0</Log></LoggingItem></LoggingItems><DeviceList><Device dt:dt="string">Keyboard</Device></DeviceList><InputMasks><InputMask><DeviceName dt:dt="string">Keyboard</DeviceName><DeviceClass dt:dt="string">Keyboard</DeviceClass><AllowableInput dt:dt="string">{ANY}</AllowableInput><CorrectInput dt:dt="string"></CorrectInput><TimeLimit dt:dt="string"></TimeLimit><MaxCount dt:dt="string">1</MaxCount><InputAction dt:dt="int">1</InputAction><SyncOwnerDuration dt:dt="boolean">1</SyncOwnerDuration><Enabled dt:dt="boolean">1</Enabled><FlushInputBuffer dt:dt="string">Yes</FlushInputBuffer><TerminationInput dt:dt="string"></TerminationInput><UserTag dt:dt="string"></UserTag><EchoClients/><ResponseMode dt:dt="string">All</ResponseMode><ProcessBackspace dt:dt="string">Yes</ProcessBackspace></InputMask></InputMasks><Tasks/><Duration dt:dt="string">-1</Duration><JumpLabel dt:dt="string"></JumpLabel><TimingMode dt:dt="int">0</TimingMode><PreRelease dt:dt="string">0</PreRelease><OnsetSync dt:dt="int">1</OnsetSync><OffsetSync dt:dt="int">0</OffsetSync><ForeColor dt:dt="string">black</ForeColor><BackColor dt:dt="string">white</BackColor><BackStyle dt:dt="string">opaque</BackStyle><BorderColor dt:dt="string">black</BorderColor><BorderWidth dt:dt="string">0</BorderWidth><X dt:dt="string">center</X><Y dt:dt="string">center</Y><Width dt:dt="string">100%</Width><Height dt:dt="string">100%</Height><XAlign dt:dt="string">center</XAlign><YAlign dt:dt="string">center</YAlign><AlignHorizontal dt:dt="string">center</AlignHorizontal><AlignVertical dt:dt="string">center</AlignVertical><ClearAfter dt:dt="string">No</ClearAfter><FontName dt:dt="string">Courier New</FontName><FontSize dt:dt="string">16</FontSize><FontBold dt:dt="string">Yes</FontBold><FontItalic dt:dt="string">No</FontItalic><FontUnderline dt:dt="string">No</FontUnderline><FontStrikeout dt:dt="string">No</FontStrikeout><Text dt:dt="string">Your Current Port
=================
[Description]

[Capabilities]


Press any key to continue...</Text><WordWrap dt:dt="int">-1</WordWrap><GeneratePreRun dt:dt="int">0</GeneratePreRun><GeneratePostRun dt:dt="int">0</GeneratePostRun><ResetLoggingProperties dt:dt="boolean">0</ResetLoggingProperties></ObjectData></StudioItem><StudioItem><Name dt:dt="string">ConfigureAndGo</Name><TypeName dt:dt="string">TextDisplay</TypeName><Tag dt:dt="string"></Tag><Notes dt:dt="string"></Notes><ObjectData><Guid dt:dt="string">{B0ECEB16-789B-4FEA-9BC2-304F997D6ABC}</Guid><Version><Major>2</Major><Minor>0</Minor><Internal>10</Internal><Build>263</Build><_VersionPersist dt:dt="int">100</_VersionPersist></Version><LoggingItems><LoggingItem><Name dt:dt="string">OnsetDelay</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">OnsetTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">DurationError</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">PreRelease</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">Duration</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">StartTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">OffsetTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">FinishTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">TimingMode</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">CustomOnsetTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">CustomOffsetTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">ActionDelay</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">ActionTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">TargetOffsetTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">TargetOnsetTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">PendingInputMasks</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">OffsetDelay</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">RTTime</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">ACC</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">RT</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">RESP</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">CRESP</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">Tag</Name><Log dt:dt="boolean">0</Log></LoggingItem><LoggingItem><Name dt:dt="string">OnsetToOnsetTime</Name><Log dt:dt="boolean">0</Log></LoggingItem></LoggingItems><DeviceList><Device dt:dt="string">Keyboard</Device></DeviceList><InputMasks><InputMask><DeviceName dt:dt="string">Keyboard</DeviceName><DeviceClass dt:dt="string">Keyboard</DeviceClass><AllowableInput dt:dt="string">{ANY}</AllowableInput><CorrectInput dt:dt="string"></CorrectInput><TimeLimit dt:dt="string"></TimeLimit><MaxCount dt:dt="string">1</MaxCount><InputAction dt:dt="int">1</InputAction><SyncOwnerDuration dt:dt="boolean">1</SyncOwnerDuration><Enabled dt:dt="boolean">1</Enabled><FlushInputBuffer dt:dt="string">Yes</FlushInputBuffer><TerminationInput dt:dt="string"></TerminationInput><UserTag dt:dt="string"></UserTag><EchoClients/><ResponseMode dt:dt="string">All</ResponseMode><ProcessBackspace dt:dt="string">Yes</ProcessBackspace></InputMask></InputMasks><Tasks/><Duration dt:dt="string">-1</Duration><JumpLabel dt:dt="string"></JumpLabel><TimingMode dt:dt="int">0</TimingMode><PreRelease dt:dt="string">0</PreRelease><OnsetSync dt:dt="int">1</OnsetSync><OffsetSync dt:dt="int">0</OffsetSync><ForeColor dt:dt="string">black</ForeColor><BackColor dt:dt="string">white</BackColor><BackStyle dt:dt="string">opaque</BackStyle><BorderColor dt:dt="string">black</BorderColor><BorderWidth dt:dt="string">0</BorderWidth><X dt:dt="string">center</X><Y dt:dt="string">center</Y><Width dt:dt="string">100%</Width><Height dt:dt="string">100%</Height><XAlign dt:dt="string">center</XAlign><YAlign dt:dt="string">center</YAlign><AlignHorizontal dt:dt="string">center</AlignHorizontal><AlignVertical dt:dt="string">center</AlignVertical><ClearAfter dt:dt="string">No</ClearAfter><FontName dt:dt="string">Courier New</FontName><FontSize dt:dt="string">18</FontSize><FontBold dt:dt="string">Yes</FontBold><FontItalic dt:dt="string">No</FontItalic><FontUnderline dt:dt="string">No</FontUnderline><FontStrikeout dt:dt="string">No</FontStrikeout><Text dt:dt="string">Although all of the routines in the User script provided can be called from an InLine, typically all you will need to do is place a call to ConfigurePortForInput or ConfigurePortForOutput.

Once you configure the port for the direct you want the data to go on the DATA port (pins 2-9), then you would use the same approach as you would have w/o the configuring commands.

For example, continue to use PortDevice, ReadPort, WritePort, Onset/OffsetSignalXXX.

Press any key...</Text><WordWrap dt:dt="int">-1</WordWrap><GeneratePreRun dt:dt="int">0</GeneratePreRun><GeneratePostRun dt:dt="int">0</GeneratePostRun><ResetLoggingProperties dt:dt="boolean">0</ResetLoggingProperties></ObjectData></StudioItem><StudioItem><Name dt:dt="string">GoodbyeLabel</Name><TypeName dt:dt="string">Label</TypeName><Tag dt:dt="string"></Tag><Notes dt:dt="string"></Notes><ObjectData><Guid dt:dt="string">{A88F3D8C-8F5C-4E83-90D9-517FF89CDDA6}</Guid><Version><Major>2</Major><Minor>0</Minor><Internal>10</Internal><Build>263</Build><_VersionPersist dt:dt="int">1</_VersionPersist></Version><LoggingItems/><DeviceList/></ObjectData></StudioItem></StudioItems><UserScript dt:dt="string">'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'
'	PARALLEL PORT ROUTINES - BEGIN
'
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''


'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'	Version:	1.0.0.1
'	Date:		9/23/03
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''


Const PORT_TYPE_UNKNOWN = 0
Const PORT_TYPE_SPP = 1
Const PORT_TYPE_PS2 = 2
Const PORT_TYPE_EPP = 3
Const PORT_TYPE_ECP = 4

Const ECP_MODE_SPP = 0
Const ECP_MODE_PS2 = 1
Const ECP_MODE_FAST_CENTRONICS = 2
Const ECP_MODE_ECP = 3
Const ECP_MODE_EPP = 4
Const ECP_MODE_TEST = 6
Const ECP_MODE_CONFIGURATION = 7

Function DataPortRead(ByVal nBaseAddress As Long) As Integer
	DataPortRead = ReadPort(nBaseAddress)
End Function

Sub DataPortWrite(ByVal nBaseAddress As Long, ByVal nValue As Integer)
	WritePort nBaseAddress, nValue
End Sub

Function StatusPortRead(ByVal nBaseAddress As Long) As Integer
	'Reads a parallel port's status port.
	'Calculates the status-port address from the port's
	'base address, and inverts bit 7 of the byte read.
	'The status-port hardware reinverts these bits,
	'so the value read matches the value at the connector.
	StatusPortRead = (ReadPort(nBaseAddress + 1) Xor &amp;H80)
End Function

Function BitRead(ByVal nSource As Long, ByVal nBitNumber As Integer) As Long
	
	'Returns the value (0 or 1) of the requested bit in a Variable.
	Dim nBitValue As Long

	'the value of the requested bit
	nBitValue = 2 ^ nBitNumber 

	BitRead = (nSource And nBitValue) \ nBitValue

End Function

Function BitReset(ByVal nSource As Long, ByVal nBitNumber As Integer) As Long
	
	'Resets (clears) the requested bit in a Variable.
	Dim nBitValue As Long
	Dim nCurrentValue As Long

	'The value of the requested bit.
	nBitValue = 2 ^ nBitNumber
	BitReset = nSource And (&amp;HFFFFFFFF - nBitValue)

End Function

Function BitSet(ByVal nSource As Long, ByVal nBitNumber As Integer) As Long
	
	'Sets the requested bit in a Variable.
	Dim nBitValue As Long
	
	'The value of the requested bit.
	nBitValue = 2 ^ nBitNumber
	BitSet = nSource Or nBitValue

End Function

Function BitToggle(ByVal nSource As Long, ByVal nBitNumber As Integer) As Long
	
	'Toggles the requested bit in a Variable.
	Dim nBitValue As Long
	Dim nCurrentValue As Long

	'The value of the requested bit.
	nBitValue = 2 ^ nBitNumber
	
	'Is the current value 0 or 1?
	nCurrentValue = nSource And nBitValue
	Select Case nCurrentValue
	    Case 0
	        'If current value = 0, set it
	        BitToggle = nSource Or nBitValue
	    Case Else
	        'If current value = 1, reset it
	        BitToggle = nSource And (&amp;HFFFFFFFF - nBitValue)
	End Select
End Function

Function ControlPortRead(ByVal nBaseAddress As Long) As Integer

	'Reads a parallel port's control port.
	'Calculates the control-port address from the port's
	'base address, and inverts bits 0, 1, &amp; 3 of the byte read.
	'The control-port hardware reinverts these bits,
	'so the value read matches the value at the connector.
	ControlPortRead = (ReadPort(nBaseAddress + 2) Xor &amp;HB)

End Function

Sub ControlPortWrite(ByVal nBaseAddress As Long, ByVal nValue As Integer)

	'Writes a Value to a parallel port's control port.
	'Calculates the control-port address from the port's
	'base address, and inverts bits 0, 1, &amp; 3.
	'The control-port hardware reinverts these bits,
	'so Value is written to the port connector.
	WritePort nBaseAddress + 2, nValue Xor &amp;HB

End Sub

Function GetEcpMode(ByVal nBaseAddress As Long) As Integer

	Dim nEcrAddress As Long
	Dim nEcrData As Long

	'The Ecr mode is in bits 5, 6, and 7 of the ECR.
	nEcrAddress = nBaseAddress + &amp;H402
	nEcrData = ReadPort(nEcrAddress)
	GetEcpMode = (nEcrData And &amp;HE0) \ &amp;H20

End Function

Function GetEppTimeoutBit(ByVal nBaseAddress As Long) As Integer

	'Reads and clears the EPP timeout bit (status port bit 0).
	'Should be done after each EPP operation.
	'The method for clearing the bit varies, so try 3 ways:
	'1. Write 1 to it.
	'2. Write 0 to it.
	'3. Read it again.
	Dim nStatusPortAddress As Long
	Dim nReadAgain As Long
	nStatusPortAddress = nBaseAddress + 1
	GetEppTimeoutBit = BitRead(StatusPortRead(nBaseAddress), 0)
	WritePort nStatusPortAddress, 1
	WritePort nStatusPortAddress, 0
	nReadAgain = BitRead(StatusPortRead(nBaseAddress), 0)

End Function

Function IsPortEcp(ByVal nBaseAddress As Long) As Boolean

	'Test for the presence of an ECP.
	'If the ECP is idle and the FIFO empty,
	'in the ECP's Ecr (at Base Address+402h),
	'bit 1(Fifo full)=0, and bit 0(Fifo empty)=1.
	'The first test is to see if these bits differ from the
	'corresponding bits in the control port (at Base Address+2).
	'If so, a further test is to write 34h to the Ecr,
	'then read it back. Bit 1 is read/write, and bit 0 is read-only.
	'If the value read is 35h, the port is an ECP.
	Dim nEcrBit0 As Long
	Dim nEcrBit1 As Long
	Dim nControlBit0 As Long
	Dim nControlBit1 As Long
	Dim nControlPortData As Long
	Dim nOriginalControlPortData As Long
	Dim nTestEcrAddress As Long
	Dim nOriginalEcrData As Long
	Dim nEcrAddress As Long
	Dim nEcrData As Long

	'Guilty until proven innocent	
	IsPortEcp = False

	nEcrAddress = nBaseAddress + &amp;H402

	'Read ECR bits 0 &amp; 1 and Control Port bit 1.
	nEcrData = ReadPort(nEcrAddress)
	nEcrBit0 = BitRead(nEcrData, 0)
	nEcrBit1 = BitRead(nEcrData, 1)
	nOriginalControlPortData = ControlPortRead(nBaseAddress)
	nControlPortData = nOriginalControlPortData
	nControlBit1 = BitRead(nControlPortData, 1)
	If nEcrBit0 = 1 And nEcrBit1 = 0 Then
	    'Compare control bit 1 to ECR bit 1.
	    'Toggle the control bit if necessary,
	    'to be sure the two registers are different.
	    If nControlBit1 = 0 Then
	        ControlPortWrite nBaseAddress, &amp;HF
	        nControlPortData = ControlPortRead(nBaseAddress)
	        nControlBit1 = BitRead(nControlPortData, 1)
	    End If

	    If nEcrBit1 &lt;&gt; nControlBit1 Then
	        nOriginalEcrData = nEcrData
	        WritePort nEcrAddress, &amp;H34
	        nEcrData = ReadPort(nEcrAddress)
	        If nEcrData = &amp;H35 Then
	            IsPortEcp = True
	        End If

	        'Restore the ECR to its original value.
	        WritePort nEcrAddress, nOriginalEcrData

	    End If
	End If

	'Restore the control to its original value.
	ControlPortWrite nBaseAddress, nOriginalControlPortData

End Function


Function IsPortEpp(ByVal nBaseAddress As Long) As Boolean

	'Write to an Epp register, then read it back.
	'If the reads match the writes, it's probably an Epp.
	Dim nByteRead As Long
	Dim nStatusPortData As Long
	Dim nEppAddressPort As Long
	Dim nTimeoutBit As Long
	Dim nStatusPortAddress As Long
	nStatusPortAddress = nBaseAddress + 1

	'Guilty until proven innocent
	IsPortEpp = False

	'Use EppAddressPort for testing.
	'SPPs, ECPs, and PS/2 ports don't have this register.
	nEppAddressPort = nBaseAddress + 3
	WritePort nEppAddressPort, &amp;H55

	'Clear the timeout bit after each EPP operation.
	nTimeoutBit = GetEppTimeoutBit(nBaseAddress)
	nByteRead = ReadPort(nEppAddressPort)
	nTimeoutBit = GetEppTimeoutBit(nBaseAddress)
	If nByteRead = &amp;H55 Then
	    WritePort nEppAddressPort, &amp;HAA
	    nTimeoutBit = GetEppTimeoutBit(nBaseAddress)
	    nByteRead = ReadPort(nEppAddressPort)
	    nTimeoutBit = GetEppTimeoutBit(nBaseAddress)
	    If nByteRead = &amp;HAA Then
	        IsPortEpp = True
	    End If
	End If

End Function

Function IsPortSpp(ByVal nBaseAddress As Long) As Boolean

	'Write two bytes and read them back.
	'If the reads match the writes, the port exists.
	Dim nByteRead As Long

	'Attempt to cache the control port data
	Dim nOriginalControlPortData As Long
	nOriginalControlPortData = ControlPortRead(nBaseAddress)

	'Be sure that control port bit 5 = 0 (data outputs enabled).
	ControlPortWrite nBaseAddress, &amp;HF

	'Guilty until proven innocent
	IsPortSpp = False

	'Write to the data port
	DataPortWrite nBaseAddress, &amp;H55

	'Read the byte back
	nByteRead = DataPortRead(nBaseAddress)

	'Is it the same?
	If nByteRead = &amp;H55 Then

		'Write another byte to confirm
	    DataPortWrite nBaseAddress, &amp;HAA
	    
		'Read the byte back
		nByteRead = DataPortRead(nBaseAddress)

		'Is it the same?
	    If nByteRead = &amp;HAA Then
	        IsPortSpp = True
	    End If

	End If

	'Attempt to restore the control port data
	ControlPortWrite nBaseAddress, nOriginalControlPortData

End Function

Function IsPortPS2(ByVal nBaseAddress As Long) As Boolean
	
	'A PS/2 port must pass the SPP test
	If Not IsPortSpp(nBaseAddress) Then Exit Function

	'Tests a parallel port's data port for bidirectional ability.
	'First, try to tri-state (disable) the data outputs by
	'setting bit 5 of the Control port.
	'Then write 2 values to the data port and read each back
	'If the values match, the data outputs are not disabled,
	'and the port is not bidirectional.
	'If the values don't match,
	'the data outputs are disabled and the port is bidirectional.
	Dim nDataInput As Long
	Dim nControlPortData As Long
	Dim nOriginalDataPortData As Long

	'Attempt to cache the control port data
	Dim nOriginalControlPortData As Long
	nOriginalControlPortData = ControlPortRead(nBaseAddress)


	'Set Control port bit 5.
	ControlPortWrite nBaseAddress, &amp;H2F

	'Guilty until proven innocent
	IsPortPS2 = False

	'Write the first byte and read it back:
	DataPortWrite nBaseAddress, &amp;H55
	nDataInput = DataPortRead(nBaseAddress)

	'If it doesn't match, the port is bidirectional.
	If Not nDataInput = &amp;H55 Then IsPortPS2 = True

	'If it matches, write another and read it back.
	If nDataInput = &amp;H55 Then
	    DataPortWrite nBaseAddress, &amp;HAA
	    nDataInput = DataPortRead(nBaseAddress)

	    'If it doesn't match, the port is bidirectional
	    If Not nDataInput = &amp;HAA Then
	        IsPortPS2 = True
	    End If
	End If

	'Attempt to restore the control port data
	ControlPortWrite nBaseAddress, nOriginalControlPortData

End Function

Function IsPortOutput(ByVal nAddress As Long) As Boolean

	'Guilty until proven innocent
	IsPortOutput = False

	'Get the value of the control port if bit five is
	' high, then set for input.  If the bit is low,
	' then set for output.  NOTE that on some odd ports,
	' you must set bit seven and this function would be incorrect
	Dim nControlPortValue As Long
	nControlPortValue = ControlPortRead(nAddress)

	'0 = Output
	If BitRead(nControlPortValue, 5) = 0 Then
		IsPortOutput = True
	End If

End Function

Function IsPortInput(ByVal nAddress As Long) As Boolean

	'Guilty until proven innocent
	IsPortInput = False

	'Get the value of the control port if bit five is
	' high, then set for input.  If the bit is low,
	' then set for output.  NOTE that on some odd ports,
	' you must set bit seven and this function would be incorrect
	Dim nControlPortValue As Long
	nControlPortValue = ControlPortRead(nAddress)

	'1 = input
	If BitRead(nControlPortValue, 5) = 1 Then
		IsPortInput = True
	End If

End Function

Function GetPortType(ByVal nBaseAddress As Long) As Long

	'Test for a port's presence, and if it exists, the type of port.
	'In order, check for the presence of an ECP, EPP, SPP, and PS/2 port.
	'Update the information in the Port array  and the display.
	
	'Check for ECP
	If IsPortEcp(nBaseAddress) Then
	
		GetPortType = PORT_TYPE_ECP
		Exit Function
	    
	End If

    'If it's not an ECP, look for an EPP.
    'If BaseAddress = 3BCh, skip the EPP test.
    'EPPs aren't allowed at 3BCh due to possible conflict
    'with video memory.
    If nBaseAddress &lt;&gt; &amp;H3BC Then
        If IsPortEpp(nBaseAddress) Then
			GetPortType = PORT_TYPE_EPP
			Exit Function
		End If
    End If

    'If it's not an EPP, look for a PS/2.
	If IsPortPS2(nBaseAddress) Then
		
		GetPortType = PORT_TYPE_PS2
		Exit Function

	End If

	'Well, must be an SPP
	If IsPortSPP(nBaseAddress) Then

		GetPortType = PORT_TYPE_SPP
		Exit Function

	End If

	'Why did we get here - nothing passed!
	'Is the port address not a parallel port?
	Debug.Assert False
	GetPortType = PORT_TYPE_UNKNOWN

End Function

Sub SetEcpMode(ByVal nBaseAddress As Long, ByVal nEcpModeValue As Integer)

	'Why are you calling this on a port that is not ECP?
	Debug.Assert IsPortEcp(nBaseAddress)

	'Why are you setting an invalid mode?
	Debug.Assert nEcpModeValue = ECP_MODE_SPP Or _
				nEcpModeValue = ECP_MODE_PS2 Or _
				nEcpModeValue = ECP_MODE_FAST_CENTRONICS Or _
				nEcpModeValue = ECP_MODE_ECP Or _
				nEcpModeValue = ECP_MODE_EPP Or _
				nEcpModeValue = ECP_MODE_TEST Or _
				nEcpModeValue = ECP_MODE_CONFIGURATION

	Dim nEcrAddress As Integer
	Dim nEcrData As Integer
	nEcrAddress = nBaseAddress + &amp;H402

	'Read the ECR &amp; clear bits 5, 6, 7.
	nEcrData = ReadPort(nEcrAddress) And &amp;H1F

	'Write the selected value to bits 5, 6, 7.
	nEcrData = nEcrData + nEcpModeValue * &amp;H20
	WritePort nEcrAddress, nEcrData

End Sub

Sub ConfigurePortForInput(ByVal nBaseAddress As Long)

	'If the port is SPP, then input is not permitted through the DATA port
	If GetPortType(nBaseAddress) = PORT_TYPE_SPP Then
		
		'If the port is SPP, then input is not permitted through the DATA port
		'Configure the port through the BIOS, etc. for ECP, EPP, PS2, Bi-Direction.
		'Input from an SPP must be done through the Status or Control ports as
		' access to the DATA port is for output only.
		'Please see KB:1320 for more information on the E-Prime Web Support site.
		Debug.Assert False

	End If

	'If the port is and ECP port, configure its compatability mode for PS/2 for Bi-Directional
	If IsPortEcp(nBaseAddress) Then SetEcpMode nBaseAddress, ECP_MODE_PS2

	Dim nControlValue As Long
	nControlValue = ControlPortRead(nBaseAddress)

	'Set bits five and seven to indicate the port is for input
	nControlValue = BitSet(nControlValue, 5)
	nControlValue = BitSet(nControlValue, 7)

	'Update the register
	ControlPortWrite nBaseAddress, nControlValue

End Sub

Sub ConfigurePortForOutput(ByVal nBaseAddress As Long)

	'If the port is and ECP port, configure its compatability mode for standard output only
	If IsPortEcp(nBaseAddress) Then SetEcpMode nBaseAddress, ECP_MODE_SPP

	Dim nControlValue As Long
	nControlValue = ControlPortRead(nBaseAddress)

	'RESET bits five and seven to zero indicating output
	nControlValue = BitReset(nControlValue, 5)
	nControlValue = BitReset(nControlValue, 7)

	'Update the register
	ControlPortWrite nBaseAddress, nControlValue

End Sub

Function GetPortDescription(ByVal nBaseAddress As Long) As String

	Dim strDescription As String
	strDescription = strDescription &amp; "Type: "

	'Get the Type
	Dim nPortType As Long
	nPortType = GetPortType(nBaseAddress)

	Select Case nPortType
		Case PORT_TYPE_SPP
			strDescription = strDescription &amp; "SPP (Output Only)"
		Case PORT_TYPE_PS2
			strDescription = strDescription &amp; "PS/2 (Bi-Directional)"
		Case PORT_TYPE_EPP
			strDescription = strDescription &amp; "EPP"
		Case PORT_TYPE_ECP
			strDescription = strDescription &amp; "ECP"
		Case Else
			strDescription = strDescription &amp; "UNKNOWN(" &amp; nPortType &amp; ")"
	End Select

	'If ECP, then get compatability mode
	If nPortType = PORT_TYPE_ECP Then
	
		'Compatabilty mode
		strDescription = strDescription &amp; " Compatability: "
		
		Dim nEcpMode As Long
		nEcpMode = GetEcpMode(nBaseAddress)

		Select Case nEcpMode
			Case ECP_MODE_SPP
				strDescription = strDescription &amp; "SPP"
			Case ECP_MODE_PS2
				strDescription = strDescription &amp; "PS/2"
			Case ECP_MODE_FAST_CENTRONICS
				strDescription = strDescription &amp; "Fast Centronics"			
			Case ECP_MODE_EPP
				strDescription = strDescription &amp; "EPP"
			Case ECP_MODE_ECP
				strDescription = strDescription &amp; "ECP"
			Case ECP_MODE_TEST
				strDescription = strDescription &amp; "Test"
			Case ECP_MODE_CONFIGURATION
				strDescription = strDescription &amp; "Configuration"			
			Case Else
				strDescription = strDescription &amp; "UNKNOWN(" &amp; nEcpMode &amp; ")"
		End Select
	End If

	'Can we currently write to the port?
	If IsPortOutput(nBaseAddress) Then
		strDescription = strDescription &amp; " DATA PORT: output"
	End If

	'Can we currently read from the port?
	If IsPortInput(nBaseAddress) Then
		strDescription = strDescription &amp; " DATA PORT: input"
	End If

	'Assign return
	GetPortDescription = strDescription

End Function

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'
'	PARALLEL PORT ROUTINES - END
'
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''</UserScript></Experiment>
