Code archives/Miscellaneous/PortIO Blitz+

This code has been declared by its author to be Public Domain code.

Download source code

PortIO Blitz+ by Nigel Brown2003
can be used to read and write directly to the parallel and serial ports or any other port for that matter.
;the declaration...

.lib "dlportio.dll"

DLPortReadPortUchar%( port% )
DLPortReadPortUshort%( port% )
DLPortReadPortUlong%( port% )

DlPortReadPortBufferUchar( port%, buffer*, count% )
DlPortReadPortBufferUshort( port%, buffer*, count% )
DlPortReadPortBufferUlong( port%, buffer*, count% )

DlPortWritePortUchar( port%, value% )
DlPortWritePortUshort( port%, value% )
DlPortWritePortUlong( port%, value% )

DlPortWritePortBufferUchar( port%, buffer*, count% )
DlPortWritePortBufferUshort( port%, buffer*, count% )
DlPortWritePortBufferUlong( port%, buffer*, count% )

; the blitz code.

; Direct Port access from Blitz Basic
; Check this for more info
; http://www.fapo.com/files/ecp_reg.pdf

Global	LPT1		= $378

Global	DAT			= $0
Global	DSR			= $1
Global	DCR			= $2

Graphics 800,600,16,2
SetBuffer BackBuffer()

; Set the direction bit of the device control register,
; make port direction (read).
DlPortWritePortUchar( LPT1 + DCR, $20 )

;--------------------------------------------------
Repeat
;--------------------------------------------------
	; Read from data register
	Print DlPortReadPortUchar( LPT1 + DAT )
	
Until KeyDown(1)

End

for more info, and the required dll. Check the code download @
[a http://www.nigelibrown.pwp.blueyonder.co.uk/blitz/userlibs/index.htm]Click Here![/a]

Comments

Mustang2005


Try this: http://www.nigelibrown.pwp.blueyonder.co.uk/blitz/userlibs/index.htm


Code Archives Forum