IO Device:F75113 SMbus under Linux(64bit)

From LEXWiKi

(Difference between revisions)
Jump to: navigation, search
Current revision (11:43, 19 August 2024) (edit) (undo)
 
(9 intermediate revisions not shown.)
Line 1: Line 1:
 +
[[Category:AllowPages]]
 +
== The Sample code source you can download from ==
== The Sample code source you can download from ==
Line 17: Line 19:
<Google Drive> DLL file: [https://drive.google.com/file/d/10a8QkyFd5iBqncqvgEW28uFECsaBZuko/view?usp=sharing libF75113]
<Google Drive> DLL file: [https://drive.google.com/file/d/10a8QkyFd5iBqncqvgEW28uFECsaBZuko/view?usp=sharing libF75113]
 +
 +
<FTP> DLL file: [ftp://ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/F75113/Linux/SMBUS/libF75113.zip libF75113]
Line 24: Line 28:
<Google Drive> Binay file: [https://drive.google.com/file/d/1drzalyNkG1EbeV0Pau5bSID2LWsaURUj/view?usp=sharing F75113_SAMPLE_BIN]
<Google Drive> Binay file: [https://drive.google.com/file/d/1drzalyNkG1EbeV0Pau5bSID2LWsaURUj/view?usp=sharing F75113_SAMPLE_BIN]
 +
 +
<FTP> Source file: [ftp://ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/F75113/Linux/SMBUS/F75113_SAMPLE_CODE.zip F75113_SAMPLE_CODE]
 +
 +
<FTP> Binay file: [ftp://ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/F75113/Linux/SMBUS/F75113_SAMPLE_BIN.zip F75113_SAMPLE_BIN]
== MB Support List ==
== MB Support List ==
Line 66: Line 74:
== How to use libF75113 ==
== How to use libF75113 ==
 +
Using (3I640CW + CIO116B) to example how to using "libF75113" to develop your program.
 +
 +
[[Image:3I640CW_CIO116.jpg]]
 +
[[Image:CIO116_B.jpg]]
 +
[[Image:CIO116_B-1.jpg]]
 +
[[Image:CIO116_B-3.jpg]]
== Introduction ==
== Introduction ==
-
"libF75113" could helps developer quickly operate F75113 by SMBUS.
+
"libF75113" could helps developer quickly operate F75113 by SMBUS.<br \>
It include "libF75113.h","libF75113.so","SMBus.h","SMBus.c" and "YjlDef.h".
It include "libF75113.h","libF75113.so","SMBus.h","SMBus.c" and "YjlDef.h".
-
== Steps to use ==
+
Attention: "SUDO" permissions must be used during execution. (Ex: sudo ./F75113_SAMPLE_CODE)
-
Step1. Unzip "libF75113.zip" and puts all of files to your project.<\ br>
+
-
Link "libF75113.so" and include "libF75113.h".<\ br>
+
-
Step2. Call 'SMBUS_Install()' to initial SMBUS resource. Remeber release it before close programe.<\ br>
+
== Steps to use libF75113 ==
 +
=== Step1. Unzip "libF75113.zip" and puts all of files to your project ===
 +
Link "libF75113.so" and include "libF75113.h".<br />
-
Step3: Call 'F75113_Init()' to initial F75113 port. It default to initial CIO1(4I4O) and CIO2(4I4O).<\ br>
+
=== Step2. Call 'SMBUS_Install()' to initial SMBUS resource ===
 +
/* Initial SMBUS resource */
 +
if(SMBus_Install() == FALSE)
 +
{
 +
printf("Initial SMBUS failed!!! Quit console, Bye bye! \n");
 +
return false;
 +
}
-
Step4: Call 'F75113_SetDigital_Low_Output() to use CIO1 and CIO2 DO pin send signal.<\ br>
+
=== Step3: Call 'F75113_Init()' to initial F75113 device. It default to initial CIO1(4I4O), CIO2(4I4O), CIO3(4I4O) and CIO4(4I4O). ===
-
(Send Value: CIO1-DO1:0x01, CIO1-DO2:0x02, CIO1-DO3:0x04, CIO1-DO4:0x08)<\ br>
+
/* Initial F75113 CIO1, CIO2, CIO3 and CIO4. Initial F75113 WDT */
-
(Send Value: CIO2-DO1:0x10, CIO2-DO2:0x20, CIO2-DO3:0x40, CIO2-DO4:0x80)<\ br>
+
bInitOk = F75113_Init();
-
+
 +
if(bInitOk == false)
 +
printf("F75113 initial failed!!!!\n");
 +
else
 +
printf("F75113 initial success.\n");
-
=== GPIO Status Register Write ===
+
F75113_SetWDT_init();
-
init_fintek_sio(eSIO_TYPE_F75113, 0 ,&sio_data)
+
=== Step4: Call 'F75113_SetDigital_Low_Output() to use CIO1 and CIO2 DO pin send signal. ===
-
ActiveSIO(sio_data.ic_port, sio_data.key);
+
(Send Value: CIO1-DO1:0x01, CIO1-DO2:0x02, CIO1-DO3:0x04, CIO1-DO4:0x08)<br />
-
CHECK_RET(_EnableGPIO(0x06 , eGPIO_Mode_Enable));
+
(Send Value: CIO2-DO1:0x10, CIO2-DO2:0x20, CIO2-DO3:0x40, CIO2-DO4:0x80)<br />
-
CHECK_RET(_SetGpioOutputEnableIdx( 0x06 , eGPIO_Direction_Out));
+
-
CHECK_RET(_SetGpioDriveEnable( 0x06 , eGPIO_Drive_Mode_OpenDrain));
+
-
CHECK_RET(_SetGpioOutputDataIdx( 0x06 , 1));
+
-
DeactiveSIO(sio_data.ic_port);
+
-
=== GPIO Status Register Read ===
+
/* Ex: Use ((CIO1-DO1(0x01) + CIO2-DO1(0x10) + CIO2-DO4(0x80)) send DO signal. */
 +
BYTE byteDoVal = 0x91;
 +
F75113_SetDigital_Low_Output(byteDoVal);
-
init_fintek_sio(eSIO_TYPE_F75113, 0 ,&sio_data)
+
=== Step5: 'F75113_GetDigital_Low_Input() to get CIO1 and CIO2 DI pin recieved signal. ===
-
ActiveSIO(sio_data.ic_port, sio_data.key);
+
(Get Value: CIO1-DI1:0x01, CIO1-DI2:0x02, CIO1-DI3:0x04, CIO1-DI4:0x08)<br />
-
CHECK_RET(_EnableGPIO(0x06 , eGPIO_Mode_Enable));
+
(Get Value: CIO2-DI1:0x10, CIO2-DI2:0x20, CIO2-DI3:0x40, CIO2-DI4:0x80)<br />
-
CHECK_RET(_SetGpioOutputEnableIdx( 0x06 , eGPIO_Direction_In));
+
-
CHECK_RET(_GetGpioInputDataIdx( 0x06 , &data));
+
-
DeactiveSIO(sio_data.ic_port);
+
-
=== GPIO Comparison ===
+
/* Get DI value from CIO1 and CIO2 */
-
+
BYTE byteDoVal = F75113_GetDigital_Low_Input();
-
CHECK_RET(_GetGpioInputDataIdx (0x10,&BDIO_data));
+
-
if((BDIO_data == 1) & (BDIO_startvalue_data == 0) )
+
-
{
+
-
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton2), TRUE);
+
-
}
+
-
CHECK_RET(_GetGpioInputDataIdx (0x11,&BDI1_data));
+
-
if((BDI1_data == 1) & (BDI1_startvalue_data == 0) )
+
-
{
+
-
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton4), TRUE);
+
-
}
+
-
CHECK_RET(_GetGpioInputDataIdx (0x12,&BDI2_data));
+
-
if((BDI2_data == 1) & (BDI2_startvalue_data == 0) )
+
-
{
+
-
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton6), TRUE);
+
-
}
+
-
CHECK_RET(_GetGpioInputDataIdx (0x13,&BDI3_data));
+
-
if((BDI3_data == 1) & (BDI3_startvalue_data == 0) )
+
-
{
+
-
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton8), TRUE);
+
-
}
+
-
=== F75113 driver delete ===
+
=== Step6: Call 'F75113_SetDigital_High_Output() to use CIO3 and CIO4 DO pin send signal. ===
 +
(Send Value: CIO3-DO1:0x01, CIO3-DO2:0x02, CIO3-DO3:0x04, CIO3-DO4:0x08)<br />
 +
(Send Value: CIO4-DO1:0x10, CIO4-DO2:0x20, CIO4-DO3:0x40, CIO4-DO4:0x80)<br />
-
on_window1_destory (GtKObject *object,
+
/* Ex: Use ((CIO3-DO1(0x01) + CIO4-DO1(0x10) + CIO4-DO4(0x80)) send DO signal. */
-
gpointer user_data)
+
BYTE byteDoVal = 0x91;
-
{
+
F75113_SetDigital_High_Output(byteDoVal);
-
int nRet = 0;
+
 
-
sFintek_sio_data sio_data;
+
=== Step7: 'F75113_GetDigital_High_Input() to get CIO3 and CIO4 DI pin recieved signal. ===
-
set_debug(1);
+
(Get Value: CIO3-DI1:0x01, CIO3-DI2:0x02, CIO3-DI3:0x04, CIO3-DI4:0x08)<br />
-
if( nRet = init_fintek_sio(eSIO_TYPE_F75113,0, &sio_data))
+
(Get Value: CIO4-DI1:0x10, CIO4-DI2:0x20, CIO4-DI3:0x40, CIO4-DI4:0x80)<br />
-
{
+
 
-
fprintf(stderr,"init_fintek_sio error\n");
+
/* Get DI value from CIO3 and CIO4 */
-
exit(3);
+
BYTE byteDoVal = F75113_GetDigital_High_Input();
-
}
+
 
-
ActiveSIO(sio_data.ic_port, sio_data.key);
+
=== Step8: Call 'F75113_SetWDT_Enable() to start WDT. ===
-
DeactiveSIO(sio_data.ic_port);
+
(Time seconds value: Seconds from 0 to 255)<br />
-
gtk_main_quit();
+
/* Ex: Set WDT enable after 10 seconds. */
-
}
+
byteWdVal = 10;
 +
F75113_SetWDT_Enable(byteWdVal);
 +
 
 +
=== Step9: Call 'F75113_SetWDT_Disable() to stop WDT. ===
 +
/* If WDT already start, stop it.*/
 +
F75113_SetWDT_Disable();
 +
 
 +
=== Final step: Call 'SMBUS_Uninstall()' to release SMBUS resource if program closed. ===
 +
/* Release SMBUS resource */
 +
SMBus_Uninstall();

Current revision


Contents

The Sample code source you can download from

<Google Drive>

Binary file(64 bit): F75113_SMBUSv1.0.2L_Bin

<FTP>

Binary file(64 bit): F75113_SMBUSv1.0.2L_Bin

We do the demo test with a test tool which DIx connect to DOx with Relay.


libF75113 DLL

<Google Drive> DLL file: libF75113

<FTP> DLL file: libF75113


libF75113 DLL Sample Code

<Google Drive> Source file: F75113_SAMPLE_CODE

<Google Drive> Binay file: F75113_SAMPLE_BIN

<FTP> Source file: F75113_SAMPLE_CODE

<FTP> Binay file: F75113_SAMPLE_BIN

MB Support List

Cacrd

M113A

edit table


How to use this Demo Application

Before you use this

please enter F75113set.sh and read the Readme.txt enter command

after all you can open the program

Image:SMBUSLinux.JPG

1. Press the "Test" button to test CIO1 function

2. Press the "C2test" button to test CIO2 function

3. Press the "C3test" button to test CIO3 function

4. Press the "C4test" button to test CIO4 function

F75113 GPIO Picture

Image:t5.jpg

How to use libF75113

Using (3I640CW + CIO116B) to example how to using "libF75113" to develop your program.

Image:3I640CW_CIO116.jpg Image:CIO116_B.jpg Image:CIO116_B-1.jpg Image:CIO116_B-3.jpg

Introduction

"libF75113" could helps developer quickly operate F75113 by SMBUS.
It include "libF75113.h","libF75113.so","SMBus.h","SMBus.c" and "YjlDef.h".

Attention: "SUDO" permissions must be used during execution. (Ex: sudo ./F75113_SAMPLE_CODE)

Steps to use libF75113

Step1. Unzip "libF75113.zip" and puts all of files to your project

Link "libF75113.so" and include "libF75113.h".

Step2. Call 'SMBUS_Install()' to initial SMBUS resource

   /* Initial SMBUS resource */
   if(SMBus_Install() == FALSE)
   {
       printf("Initial SMBUS failed!!! Quit console, Bye bye! \n");
       return false;
   }

Step3: Call 'F75113_Init()' to initial F75113 device. It default to initial CIO1(4I4O), CIO2(4I4O), CIO3(4I4O) and CIO4(4I4O).

   /* Initial F75113 CIO1, CIO2, CIO3 and CIO4. Initial F75113 WDT */
   bInitOk = F75113_Init();
   if(bInitOk == false)
       printf("F75113 initial failed!!!!\n");
   else
       printf("F75113 initial success.\n");
   F75113_SetWDT_init();

Step4: Call 'F75113_SetDigital_Low_Output() to use CIO1 and CIO2 DO pin send signal.

(Send Value: CIO1-DO1:0x01, CIO1-DO2:0x02, CIO1-DO3:0x04, CIO1-DO4:0x08)
(Send Value: CIO2-DO1:0x10, CIO2-DO2:0x20, CIO2-DO3:0x40, CIO2-DO4:0x80)

   /* Ex: Use ((CIO1-DO1(0x01) + CIO2-DO1(0x10) + CIO2-DO4(0x80)) send DO signal. */
   BYTE byteDoVal = 0x91;
   F75113_SetDigital_Low_Output(byteDoVal);

Step5: 'F75113_GetDigital_Low_Input() to get CIO1 and CIO2 DI pin recieved signal.

(Get Value: CIO1-DI1:0x01, CIO1-DI2:0x02, CIO1-DI3:0x04, CIO1-DI4:0x08)
(Get Value: CIO2-DI1:0x10, CIO2-DI2:0x20, CIO2-DI3:0x40, CIO2-DI4:0x80)

   /* Get DI value from CIO1 and CIO2 */
   BYTE byteDoVal = F75113_GetDigital_Low_Input();

Step6: Call 'F75113_SetDigital_High_Output() to use CIO3 and CIO4 DO pin send signal.

(Send Value: CIO3-DO1:0x01, CIO3-DO2:0x02, CIO3-DO3:0x04, CIO3-DO4:0x08)
(Send Value: CIO4-DO1:0x10, CIO4-DO2:0x20, CIO4-DO3:0x40, CIO4-DO4:0x80)

   /* Ex: Use ((CIO3-DO1(0x01) + CIO4-DO1(0x10) + CIO4-DO4(0x80)) send DO signal. */
   BYTE byteDoVal = 0x91;
   F75113_SetDigital_High_Output(byteDoVal);

Step7: 'F75113_GetDigital_High_Input() to get CIO3 and CIO4 DI pin recieved signal.

(Get Value: CIO3-DI1:0x01, CIO3-DI2:0x02, CIO3-DI3:0x04, CIO3-DI4:0x08)
(Get Value: CIO4-DI1:0x10, CIO4-DI2:0x20, CIO4-DI3:0x40, CIO4-DI4:0x80)

   /* Get DI value from CIO3 and CIO4 */
   BYTE byteDoVal = F75113_GetDigital_High_Input();

Step8: Call 'F75113_SetWDT_Enable() to start WDT.

(Time seconds value: Seconds from 0 to 255)

   /* Ex: Set WDT enable after 10 seconds. */
   byteWdVal = 10;
   F75113_SetWDT_Enable(byteWdVal);

Step9: Call 'F75113_SetWDT_Disable() to stop WDT.

   /* If WDT already start, stop it.*/
   F75113_SetWDT_Disable();

Final step: Call 'SMBUS_Uninstall()' to release SMBUS resource if program closed.

   /* Release SMBUS resource */
   SMBus_Uninstall();
Personal tools