Convert code to FWH
- cdmmaui
- Posts: 693
- Joined: Fri Oct 28, 2005 9:53 am
- Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong
- Contact:
Convert code to FWH
Happy Friday Everyone,
Could someone help me convert this code to FWH? I would happy to pay you for your time.
Thank you!
#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
// 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);
Could someone help me convert this code to FWH? I would happy to pay you for your time.
Thank you!
#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
// 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);
- Antonio Linares
- Site Admin
- Posts: 42273
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Convert code to FWH
Dear Darrell,
What C compiler are you using ?
Are you using 32 or 64 bits ?
What C compiler are you using ?
Are you using 32 or 64 bits ?
- cdmmaui
- Posts: 693
- Joined: Fri Oct 28, 2005 9:53 am
- Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong
- Contact:
Re: Convert code to FWH
Hi Antonio,
Borland
Borland
- Antonio Linares
- Site Admin
- Posts: 42273
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- cdmmaui
- Posts: 693
- Joined: Fri Oct 28, 2005 9:53 am
- Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong
- Contact:
Re: Convert code to FWH
Hi Antonio,
Yes
Yes
- Antonio Linares
- Site Admin
- Posts: 42273
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Convert code to FWH
Dear Darrell,
Please download this zip file:
https://github.com/starofrainnight/wini ... /WinIo.zip
And try this initial version:
Please download this zip file:
https://github.com/starofrainnight/wini ... /WinIo.zip
And try this initial version:
Code: Select all | Expand
#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
- Antonio Linares
- Site Admin
- Posts: 42273
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Convert code to FWH
Please replace this line:
InitializeWinIO()
with:
MsgInfo( InitializeWinIO() )
to check if the DLL properly initializes
InitializeWinIO()
with:
MsgInfo( InitializeWinIO() )
to check if the DLL properly initializes
- Antonio Linares
- Site Admin
- Posts: 42273
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Convert code to FWH
After running it please check if there is a hb_out.log file
- Antonio Linares
- Site Admin
- Posts: 42273
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Convert code to FWH
There is something else to implement, doing it...
- Antonio Linares
- Site Admin
- Posts: 42273
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Convert code to FWH
https://github.com/starofrainnight/winio
These are the right files to use:
https://github.com/starofrainnight/wini ... /WinIo.zip
These are the right files to use:
https://github.com/starofrainnight/wini ... /WinIo.zip
- Antonio Linares
- Site Admin
- Posts: 42273
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Convert code to FWH
This should be the right code:
winio32.dll and winio32.sys should be where your EXE is placed.
ports.prg
winio32.dll and winio32.sys should be where your EXE is placed.
ports.prg
Code: Select all | Expand
#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
- Antonio Linares
- Site Admin
- Posts: 42273
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Convert code to FWH
A brief explanation:
A Windows app can't directly manage the ports for security reasons, it must use a driver.
WinIO32.sys is the driver and WinIO32.DLL is the DLL to manage such driver
This WinIO was developed by http://www.sysinternals.com but lately was bought by Microsoft and they dropped it.
Thats why this free github repo has implemented it: https://github.com/starofrainnight/winio
A Windows app can't directly manage the ports for security reasons, it must use a driver.
WinIO32.sys is the driver and WinIO32.DLL is the DLL to manage such driver
This WinIO was developed by http://www.sysinternals.com but lately was bought by Microsoft and they dropped it.
Thats why this free github repo has implemented it: https://github.com/starofrainnight/winio
- cdmmaui
- Posts: 693
- Joined: Fri Oct 28, 2005 9:53 am
- Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong
- Contact:
Re: Convert code to FWH
Hello Antonio,
Thank you so much! Initially we are looking to read certain values to determine status of a device, simply 0 or 1 (on or off).
Thank you again!
Thank you so much! Initially we are looking to read certain values to determine status of a device, simply 0 or 1 (on or off).
Thank you again!
- cdmmaui
- Posts: 693
- Joined: Fri Oct 28, 2005 9:53 am
- Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong
- Contact:
Re: Convert code to FWH
Hi Jimmy,
Nuvoton NCT6106D. We are looking to get status from specific pin, either on (1) or off (0).
Nuvoton NCT6106D. We are looking to get status from specific pin, either on (1) or off (0).