#include "FiveWin.ch"
#include "dll.ch"
#define AddrPort 0x2e
#define DataPort 0x2f
#define SIO_UnLock_Value 0x87
#define SIO_Lock_Value 0xaa
#define SIO_LDN_GPIO 0x07
#define GPIO_Port 0xF1
static hDll
function Main()
local Data
hDLL = LoadLibrary( "winio.dll" )
InitializeWinIO()
// Enter_Config
WriteByte (AddrPort , SIO_UnLock_Value)
WriteByte (AddrPort , SIO_UnLock_Value)
WriteByte (AddrPort , 0x07)
WriteByte (DataPort , SIO_LDN_GPIO)
//Set OUT1~OUT8Value
WriteByte( AddrPort , GPIO_Port)
WriteByte (DataPort , 0x00) //set OUT1~OUT8 value, OUT1=Bit0, OUT2=Bit1
// Read In1~In8 value
WriteByte( AddrPort, 0xED)
Data=ReadByte( DataPort ) //Read In1~In8 value
// close config mode
WriteByte( AddrPort , SIO_Lock_Value)
ShutDownWinIo()
FreeLibrary( hDLL )
MsgInfo( "ok" )
return nil
DLL FUNCTION InitializeWinIO() AS BOOL FROM "InitializeWinIo" LIB hDLL
DLL FUNCTION WriteByte( nPort AS _INT, nValue AS _INT ) AS BOOL FROM "SetPortVal" LIB hDLL
DLL FUNCTION ReadByte( nPort AS _INT ) AS _INT FROM "GetPortVal" LIB hDLL
DLL FUNCTION ShutdownWinIo() AS VOID FROM "ShutdownWinIo" LIB hDLL
#include "FiveWin.ch"
#include "dll.ch"
#define AddrPort 0x2e
#define DataPort 0x2f
#define SIO_UnLock_Value 0x87
#define SIO_Lock_Value 0xaa
#define SIO_LDN_GPIO 0x07
#define GPIO_Port 0xF1
static hDll
function Main()
local Data
hDLL = LoadLibrary( "winio32.dll" )
MsgInfo( hDLL )
MsgInfo( InstallWinIoDriver( "WinIo32.sys", .T. ) )
MsgInfo( InitializeWinIO() )
// Enter_Config
WriteByte (AddrPort , SIO_UnLock_Value)
WriteByte (AddrPort , SIO_UnLock_Value)
WriteByte (AddrPort , 0x07)
WriteByte (DataPort , SIO_LDN_GPIO)
//Set OUT1~OUT8Value
WriteByte( AddrPort , GPIO_Port)
WriteByte (DataPort , 0x00) //set OUT1~OUT8 value, OUT1=Bit0, OUT2=Bit1
// Read In1~In8 value
WriteByte( AddrPort, 0xED)
Data=ReadByte( DataPort ) //Read In1~In8 value
// close config mode
WriteByte( AddrPort , SIO_Lock_Value)
ShutDownWinIo()
FreeLibrary( hDLL )
MsgInfo( "ok" )
return nil
DLL FUNCTION InstallWinIoDriver( cPath AS LPSTR, lIsDemandLoaded AS BOOL ) AS BOOL FROM "InitializeWinIo" LIB hDLL
DLL FUNCTION InitializeWinIO() AS BOOL FROM "InitializeWinIo" LIB hDLL
DLL FUNCTION WriteByte( nPort AS _INT, nValue AS _INT ) AS BOOL FROM "SetPortVal" LIB hDLL
DLL FUNCTION ReadByte( nPort AS _INT ) AS _INT FROM "GetPortVal" LIB hDLL
DLL FUNCTION ShutdownWinIo() AS VOID FROM "ShutdownWinIo" LIB hDLL
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 59 guests