WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Parallel (obsolete)

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Read and Write to a Parallel Port


;Download IOOcx.ocx
;http://www.hardandsoftware.net/
;
;The IO OCX ActiveX control provides access to I/O ports under ALL 32-bit versions of Windows. Windows NT/2K/XP support
;has been added (December 24, 2001) by employing DriverLINX PortIO (www.sstnet.com).  DriverLINX PortIO may be freely used
;in accordance with the License agreement provided in the install (included in the Download above).  Install DriverLINX PortIO
;before attempting to use IOOcx.  The IOOcx properties, events, and methods are as follows:
;
;******************
;Properties
;******************
;
;Interval - The I/O port specified by the ReadAddress property is read at the interval specified by this property. Interval
;           is specified in milliseconds with a valid range of 55-65535. Depending on the WaitFor property selected, an
;           IODataAvailable event can be generated. See the WaitFor and WaitMatchData properties.
;
;ReadAddress (Long) - Set this property to the address of the I/O port to be read.
;
;ReadMask (Byte)- Set this property to mask data that is read from an I/O port. For example, ReadMask = &HFF (default)
;                 returns all data. However, ReadMask = &H10 returns only bit 5. That is, the I/O port read is bitwise
;                 ANDed with ReadMask -- the result of the AND operation is returned in ReadData.
;
;WaitFor (Integer) - Set this property to None, Change, or Match.
;If set to None, no IODataAvailable event will be generated. You still can use the ReadIO method to read an I/O port.
;If set to Change, an IODataAvailable event will be generated if the port specified by ReadAddress changes value.
;If set to Match, an IODataAvailable event will be generated if the port specified by ReadAddress changes value and if the new value matches that specified by the WaitMatchProperty.
;
;WaitMatchData (Byte)- Set this property to the value that you want to match. When the I/O port is read and it matches the
;                      WaitMatchData property, and the WaitFor property is set to Match, an IODataAvailable event will be generated.
;
;WriteAddress (Long)- Set this property to the address of the I/O port to be written.
;
;******************
;Methods
;******************;
;ReadIO - Call ReadIO to read the I/O port specified by the ReadAddress property. If the ReadMask property is < &HFF, ReadIO is
;         masked by the value in ReadMask.
;
;WriteIO - Call WriteIO to write to the I/O port specified by the WriteAddress property. Call WriteI/O with the argument (byte)
;          data to be written to the I/O port.
;

;******************
;Events
;******************
;IODataAvailable (ReadData As Byte)- This event is generated when I/O port data changes and the WaitFor property is set to
;either Change or Match. If WaitFor is set to Match, then the I/O port data must have changed and it must match the data
;pattern specified by the WaitMatchData property. ReadData masked by the ReadMask property is made available in the
;IODataAvailble event subroutine.



#DefineFunction udfWriteIO( address, data )
   objIOOcx = ObjectCreate('IOcx.IOOcx')
   objIOOcx.WriteAddress = address
   objIOOcx.WriteIO( data )
   objIOOcx = 0
   Return 1
#EndFunction

#DefineFunction udfReadIO( address )
   objIOOcx = ObjectCreate('IOcx.IOOcx')
   objIOOcx.ReadMask = 0
   objIOOcx.ReadAddress = address
   data = objIOOcx.ReadIO
   objIOOcx = 0
   Return data
#EndFunction

address = 768
data = 1
udfWriteIO( address, data )

readdata = udfReadIO( address )
Message('udfReadIO', readdata )


Article ID:   W17372
File Created: 2008:04:10:15:08:38
Last Updated: 2008:04:10:15:08:38