IO Device:F81801 DIO under Windows

From LEXWiKi

(Difference between revisions)
Jump to: navigation, search
(The Sample code source you can download from)
Current revision (09:15, 2 March 2022) (edit) (undo)
 
(One intermediate revision not shown.)
Line 1: Line 1:
 +
[[Category:AllowPages]]
== The Sample code source you can download from ==
== The Sample code source you can download from ==
 +
 +
<Google Drive>
Source file: [https://drive.google.com/file/d/1Fciv3PDcxEip3CuulTCI-Qm40OIluT_a/view?usp=sharing F81801_DIO_v0.2W_Src]
Source file: [https://drive.google.com/file/d/1Fciv3PDcxEip3CuulTCI-Qm40OIluT_a/view?usp=sharing F81801_DIO_v0.2W_Src]
Line 5: Line 8:
Binary file: [https://drive.google.com/file/d/16De8328hxGKQYdu01cwSAUrlsU4tIchL/view?usp=sharing F81801_DIO_v0.2W_Bin_x86]
Binary file: [https://drive.google.com/file/d/16De8328hxGKQYdu01cwSAUrlsU4tIchL/view?usp=sharing F81801_DIO_v0.2W_Bin_x86]
[https://drive.google.com/file/d/12GDMH9O7fmINhEr3Vc42-k6c9mZEBq1v/view?usp=sharing F81801_DIO_v0.2W_Bin_x64]<br />
[https://drive.google.com/file/d/12GDMH9O7fmINhEr3Vc42-k6c9mZEBq1v/view?usp=sharing F81801_DIO_v0.2W_Bin_x64]<br />
 +
 +
<FTP>
 +
 +
Source file: [ftp://ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/F81801_DIO/windows_base/F81801_DIO_v0.2_Src_W.zip F81801_DIO_v0.2W_Src]
 +
 +
Binary file: [ftp://ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/F81801_DIO/windows_base/F81801_DIO_v0.2_x86_Bin_W.zip F81801_DIO_v0.2W_Bin_x86]
 +
[ftp://ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/F81801_DIO/windows_base/F81801_DIO_v0.2_x64_Bin_W.zip F81801_DIO_v0.2W_Bin_x64]<br />
== How to use this Demo Application ==
== How to use this Demo Application ==

Current revision

Contents

The Sample code source you can download from

<Google Drive>

Source file: F81801_DIO_v0.2W_Src

Binary file: F81801_DIO_v0.2W_Bin_x86 F81801_DIO_v0.2W_Bin_x64

<FTP>

Source file: F81801_DIO_v0.2W_Src

Binary file: F81801_DIO_v0.2W_Bin_x86 F81801_DIO_v0.2W_Bin_x64

How to use this Demo Application

Image:F81801_DIO.jpg

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);
}

F81801U GetDigitalInput

BYTE F81801U_GetDigitalInput()
{
	CString tmp;
	BYTE byteGPIO3X = 0;
	BYTE byteData = 0;
	byteGPIO3X = F81801U_Read(GPIO3_Pin_Status_Register);
	byteData = byteGPIO3X & 0x0F;

	return byteData;
}

F81801U SetDigitalOutput

void F81801U_SetDigitalOutput(BYTE byteValue)
{
	BYTE byteData = 0;

	byteData = (byteValue & 0x01) ? byteData + 0x10 : byteData;
	byteData = (byteValue & 0x02) ? byteData + 0x20 : byteData;
	byteData = (byteValue & 0x04) ? byteData + 0x40 : byteData;
	byteData = (byteValue & 0x08) ? byteData + 0x80 : byteData;

	F81801U_Write(GPIO3_Output_Data_Register, byteData);
}
Personal tools