IO Device:F81801 DIO under Windows

From LEXWiKi

(Difference between revisions)
Jump to: navigation, search
(Introduction)
(Introduction)
Line 5: Line 5:
== Introduction ==
== Introduction ==
 +
=== F81801 OPEN ===
 +
BOOL F81801U_Open()
 +
{
 +
SetPortVal(0x2e, 0x87, 1);
 +
SetPortVal(0x2e, 0x87, 1);
 +
 +
if (F81801U_Read(CHIP_ID_REGISTER1) == CHIP_ID_DEFAULT_VALUE1 && F81801U_Read(CHIP_ID_REGISTER2) == CHIP_ID_DEFAULT_VALUE2)
 +
return TRUE;
 +
return FALSE;
 +
}
 +
=== F81801 CLOSE ===
 +
void F81801U_Close()
 +
{
 +
SetPortVal(0x2e, 0xaa, 1);
 +
}
=== Initial internal F81801 ===
=== Initial internal F81801 ===
void F81801U_Init()
void F81801U_Init()
Line 17: Line 32:
F81801U_Write(WDT_REG1, 0x40);
F81801U_Write(WDT_REG1, 0x40);
F81801U_Write(WDOUT_EN, 0x80);
F81801U_Write(WDOUT_EN, 0x80);
 +
}
 +
=== F81801U READ ===
 +
DWORD F81801U_Read(DWORD dwAddrVal)
 +
{
 +
DWORD dwPortVal;
 +
::SetPortVal(0x2e, dwAddrVal, 1);
 +
::GetPortVal(0x2f, &dwPortVal, 1);
 +
 +
return (dwPortVal & 0x00FF);
 +
}
 +
=== F81801U WRITE ===
 +
void F81801U_Write(DWORD dwAddrVal, DWORD dwPortVal)
 +
{
 +
 +
::SetPortVal(0x2e, dwAddrVal, 1);
 +
::SetPortVal(0x2f, dwPortVal, 1);
}
}

Revision as of 17:18, 15 August 2019

Contents

The Sample code source you can download from

How to use this Demo Application

Introduction

F81801 OPEN

BOOL F81801U_Open()
{
	SetPortVal(0x2e, 0x87, 1);
	SetPortVal(0x2e, 0x87, 1);

	if (F81801U_Read(CHIP_ID_REGISTER1) == CHIP_ID_DEFAULT_VALUE1 && F81801U_Read(CHIP_ID_REGISTER2) == CHIP_ID_DEFAULT_VALUE2)
		return TRUE;
	return FALSE;
}

F81801 CLOSE

void F81801U_Close()
{
	SetPortVal(0x2e, 0xaa, 1);
}

Initial internal F81801

void F81801U_Init()
{
	 F81801U_Write(Logic_Device_Number_Register, GPIO_Device_Configuration_Registers);// GPIO Device Configuration Registers (LDN CR06) 
 
	 F81801U_Write(GPIO3_Output_Enable_Register, 0xf0);//GPIO34~GPIO37 OUTPUT SET / GPIO30~GPIO33 INPUT SET
	 F81801U_Write(GPIO3_Drive_Enable_Register, 0xf0);//GPIO34~GPIO37 DRIVE SET
  
	 F81801U_Write(Logic_Device_Number_Register, WDT_Registers);
	 F81801U_Write(WDTDE, 0x01);
	 F81801U_Write(WDT_REG1, 0x40);
	 F81801U_Write(WDOUT_EN, 0x80);
}

F81801U READ

DWORD F81801U_Read(DWORD dwAddrVal)
{
	DWORD dwPortVal;
	::SetPortVal(0x2e, dwAddrVal, 1);
	::GetPortVal(0x2f, &dwPortVal, 1);

	return (dwPortVal & 0x00FF);
}

F81801U WRITE

void F81801U_Write(DWORD dwAddrVal, DWORD dwPortVal)
{
	::SetPortVal(0x2e, dwAddrVal, 1);
	::SetPortVal(0x2f, dwPortVal, 1);
}
Personal tools