Parallel Programming #6

Blitz3D Forums/Blitz3D Beginners Area/Parallel Programming #6

None(Posted 2004) [#1]
Things change...

soja... thanks for all the help! Of course the situation is no better (Murphy's Law -- an excuse to blame something!); the program runs but I still get is a 0 result. I REALLY appreciate the detail that you go into to explain things -- you definately get credit for all of your help.

Here is where I am now...


.DECLS FILE

.lib "winio.dll"

;Initializes the WinIo library (boolean). Does not have to be used with Windows XP.
InitializeWinIo%():"InitializeWinIo"

;Performs shutdown of the WinIo library. Must be called before terminiating an application or when no longer using the WinIo library.
ShutdownWinIo():"ShutdownWinIo"

;Calls the WinIo driver (boolean). Parameters: (Points to a null-terminated string to specify the winio.sys driver path, Set to false).
InstallWinIoDriver%(WinIoDriverPath$, IsDemandLoaded):"InstallWinIoDriver"

;Removes the WinIo driver (boolean).
RemoveWinIoDriver%():"RemoveWinIoDriver"

;Reads a 1, 2, or 4 byte value from specifies I/O port (pointer). Parameters: (Input port $379, DWORD variable, BYTE = 1).
GetPortVal%(PortAddr, PortVal*, Size):"GetPortVal"

;Writes a 1, 2, or 4 byte value to an I/O port (boolean). Parameters: (Output port $378, Hex value written to port, BYTE = 1).
SetPortVal%(PortAddr, PortVal, Size):"SetPortVal"


.BB PROGRAM

;The BlitzBASIC code for:
;Direct Port access from BlitzBASIC using WinIo.

;Set graphics mode.
Graphics 800, 600, 16, 2
SetBuffer BackBuffer()

;Initializes the WinIo library.
;InitializeWinIo()

;Call the WinIo driver
If Not InstallWinIoDriver(".\", False) Then
Print "Initialization failed."
End
EndIf

;Create Custom Type.
Type PortVal
Field val
End Type
p.PortVal = New PortVal
DebugLog p\val

Repeat

;Read a 1 byte value from the specified port and place in variable p.
GetPortVal($379, p, 1)

;Print variable p
Print p\val

Until KeyDown(1)

;Removes the WinIo driver.
RemoveWinIoDriver()

;Shutsdown the WinIo library.
;ShutdownWinIo()

End


By the way... I noticed that you mentioned that you do not have a hardware device available to plug into your parallel port!? I thought ALL programmers had parallel PIO cards (homemade, of course) for experimentation!! Ha, Ha!

All kidding aside... as you know by now I am not the type of individual that wants tasks completely done for me. Just point me in the right direction and I Plug & Chug -- challenges are fun! But there comes a time when more help may be necessary... I can easily lend you a PIO card and cable to use for testing.

If you would like for me to mail the unit to you I would be glad to do so, just let me know.

Thanks, again

DES