Kk:Sandbox2

From LEXWiKi

(Difference between revisions)
Jump to: navigation, search
(The Sample code source you can download from)
Line 1: Line 1:
 +
[[Category:AllowPages]]
== The Sample code source you can download from ==
== The Sample code source you can download from ==
-
1.Binary file:[ftp://sf@ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/Key_Pad_Utility/Windows/Key_Pad_utility_bin_v1.0W(32bit).rar Key_Pad_utility_bin_v1.0W(32bit).rar][ftp://sf@ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/Key_Pad_Utility/Windows/Key_Pad_utility_bin_v1.0W(64bit).rar Key_Pad_utility_bin_v1.0W(64bit).rar]<br>
 
-
2.Source file:[ftp://sf@ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/Key_Pad_Utility/Windows/Key_Pad_utility_src_v1.0W(32bit).rar Key_Pad_utility_src_v1.0W(32bit).rar][ftp://sf@ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/Key_Pad_Utility/Windows/Key_Pad_utility_src_v1.0W(64bit).rar Key_Pad_utility_src_v1.0W(64bit).rar]<br>
 
-
== How to Use The Utility ==
+
Source file: [ftp://ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/F75111/Windows/Src/F75111_DIO_Src_v2.7W(32bit).zip F75111_DIO_Src_v2.7W(32bit).zip][ftp://ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/F75111/Windows/Src/F75111_DIO_Src_v2.7W(64bit).zip F75111_DIO_Src_v2.7W(64bit).zip]
-
[[Image:key_pad_utility.jpg]]<br>
+
 
-
;1.config:start set button<br>
+
Binary file: [ftp://ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/F75111/Windows/Bin/F75111_DIO_Bin_v2.7W(32bit).zip F75111_DIO_Bin_v2.7W(32bit).zip][ftp://ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/F75111/Windows/Bin/F75111_DIO_Bin_v2.7W(64bit).zip F75111_DIO_Bin_v2.7W(64bit).zip]
-
;2.save:save button<br>
+
We do the demo test with a test tool which DIx connect to DOx with Relay.
-
;3.setbutton:Settings button analog keyboard<br>
+
[[Image:cn003.jpg]]
 +
 
 +
== How to use this Demo Application ==
 +
 
 +
one F75111 two F75111
 +
[[Image:F75111v2.6w.jpg]] [[Image:F75111v2.6w650.jpg]]
 +
 
 +
'''Attention Please:You must be install vcredist_x86.exe when first time you run the F75111_DIO.exe DEMO AP,The vcredist_x86.exe include all required DLL file.'''
 +
 
 +
1. Press the "Start" button to test DIO function
 +
 
 +
2. Press the "Enable" button to test WDT function
 +
 
 +
3. Press the "Disable" button to disable WDT
 +
 
 +
4. Check the "Enable Loop" box and press "Enable" to do WDT loop test
 +
 
 +
5. Press "Install WDT" to set the system to autorun this application when booting, press again to remove this application when booting.
 +
 
 +
6. If WDT enable, system icon will be [[Image:enable.jpg]]. if disable, system icon will be [[Image:disale.jpg]]
 +
 
 +
 
 +
[[Image:flowchart.jpg]]
 +
 
 +
p.s.
 +
 
 +
f75111 send "F75111_SetWDTEnable(BYTE byteTimer)" including a parameter "timer",
 +
 
 +
if there's no disable signal (F75111_SetWDTDisable()) to stop it before timer countdown to 0, System will reboot.
 +
 
 +
if there's disable signal received, resent Enable WDT signal, for a loop to prevent from reboot
 +
 
== Introduction ==
== Introduction ==
=== Initial Internal F75111 port address (0x9c)===
=== Initial Internal F75111 port address (0x9c)===
Line 14: Line 44:
=== Set F75111 DI/DO ( sample code as below Get Input value/Set output value )===
=== Set F75111 DI/DO ( sample code as below Get Input value/Set output value )===
 +
DO: InterDigitalOutput(BYTE byteValue))
DI: InterDigitalInput()
DI: InterDigitalInput()
 +
 +
=== Enable/Disable WDT ===
 +
Enable : F75111_SetWDTEnable (BYTE byteTimer)
 +
Disable: F75111_SetWDTDisable ()
=== PULSE mode ===
=== PULSE mode ===
Line 29: Line 64:
== Initial internal '''F75111''' ==
== Initial internal '''F75111''' ==
<pre>
<pre>
-
void CKey_Pad_utilityDlg::InitInternalF75111()
+
void F75111::InitInternalF75111()
{
{
-
::Write_Byte(F75111_INTERNAL_ADDR,GPIO1X_CONTROL_MODE ,0x00); //set GPIO1X to Input function
+
this->Write_Byte(F75111_INTERNAL_ADDR,GPIO1X_CONTROL_MODE ,0x00); //set GPIO1X to Input function
-
::Write_Byte(F75111_INTERNAL_ADDR,GPIO3X_CONTROL_MODE ,0x00); //set GPIO3X to Input function
+
this->Write_Byte(F75111_INTERNAL_ADDR,GPIO3X_CONTROL_MODE ,0x00); //set GPIO3X to Input function
-
::Write_Byte(F75111_INTERNAL_ADDR,GPIO2X_CONTROL_MODE ,0x00); //set GPIO2X to Input function
+
this->Write_Byte(F75111_INTERNAL_ADDR,GPIO2X_CONTROL_MODE ,0xFF); //set GPIO2X to Output function
 +
 
 +
this->Write_Byte(F75111_INTERNAL_ADDR,F75111_CONFIGURATION, 0x03); //Enable WDT OUT function
}
}
</pre>
</pre>
-
==Get Digital Input==
+
== Set output value ==
<pre>
<pre>
-
BYTE F75111_GetDigital0 ()
+
void F75111::InterDigitalOutput(BYTE byteValue)
{
{
-
BYTE byteGPIO1X = 0;
+
BYTE byteData = 0;
-
BYTE byteGPIO2X = 0;
+
byteData = (byteData & 0x01 )? byteValue + 0x01 : byteValue;
-
BYTE byteGPIO3X = 0;
+
byteData = (byteData & 0x02 )? byteValue + 0x02 : byteValue;
-
BYTE byteData = 0;
+
byteData = (byteData & 0x04 )? byteValue + 0x04 : byteValue;
 +
byteData = (byteData & 0x80 )? byteValue + 0x08 : byteValue;
 +
byteData = (byteData & 0x40 )? byteValue + 0x10 : byteValue;
 +
byteData = (byteData & 0x20 )? byteValue + 0x20 : byteValue;
 +
byteData = (byteData & 0x10 )? byteValue + 0x40 : byteValue;
 +
byteData = (byteData & 0x08 )? byteValue + 0x80 : byteValue; // get value bit by bit
 +
 +
this->Write_Byte(F75111_INTERNAL_ADDR,GPIO2X_OUTPUT_DATA,byteData); // write byteData value via GPIO2X output pin
 +
}
 +
</pre>
 +
== Get Input value ==
 +
<pre>
 +
BYTE F75111::InterDigitalInput()
 +
{
 +
BYTE byteGPIO1X = 0;
 +
BYTE byteGPIO3X = 0;
 +
BYTE byteData = 0;
-
::SMBus_ReadByte(m_F75111.bAddress,GPIO1X_INPUT_DATA,&byteGPIO1X) ;
+
this->Read_Byte(F75111_INTERNAL_ADDR,GPIO1X_INPUT_DATA,&byteGPIO1X) ; // Get value from GPIO1X
-
::SMBus_ReadByte(m_F75111.bAddress,GPIO2X_INPUT_DATA,&byteGPIO2X) ;
+
this->Read_Byte(F75111_INTERNAL_ADDR,GPIO3X_INPUT_DATA,&byteGPIO3X) ; // Get value from GPIO3X
-
::SMBus_ReadByte(m_F75111.bAddress,GPIO3X_INPUT_DATA,&byteGPIO3X) ;
+
-
byteGPIO1X = ~byteGPIO1X & 0xF0;
+
byteGPIO1X = byteGPIO1X & 0xF0; // Mask unuseful value
-
byteGPIO3X = ~byteGPIO3X & 0x0F;
+
byteGPIO3X = byteGPIO3X & 0x0F; // Mask unuseful value
-
byteGPIO2X = ~byteGPIO2X & 0xFF;
+
-
byteData = ( byteGPIO1X & 0x10 )? byteData + 0x01 : byteData ;
+
byteData = ( byteGPIO1X & 0x10 )? byteData + 0x01 : byteData;
-
byteData = ( byteGPIO2X & 0x80 )? byteData + 0x02 : byteData ;
+
byteData = ( byteGPIO1X & 0x80 )? byteData + 0x02 : byteData;
-
byteData = ( byteGPIO1X & 0x80 )? byteData + 0x04 : byteData ;
+
byteData = ( byteGPIO1X & 0x40 )? byteData + 0x04 : byteData;
-
byteData = ( byteGPIO2X & 0x04 )? byteData + 0x08 : byteData ;
+
byteData = ( byteGPIO3X & 0x01 )? byteData + 0x08 : byteData;
 +
 +
byteData = ( byteGPIO3X & 0x02 )? byteData + 0x10 : byteData;
 +
byteData = ( byteGPIO3X & 0x04 )? byteData + 0x20 : byteData;
 +
byteData = ( byteGPIO3X & 0x08 )? byteData + 0x40 : byteData;
 +
byteData = ( byteGPIO1X & 0x20 )? byteData + 0x80 : byteData; // Get correct DI value from GPIO1X & GPIO3X
 +
 +
return byteData;
 +
}
 +
</pre>
-
byteData = ( byteGPIO1X & 0x40 )? byteData + 0x10 : byteData ;
+
==Enable WatchDog==
-
byteData = ( byteGPIO2X & 0x02 )? byteData + 0x20 : byteData ;
+
<pre>
-
byteData = ( byteGPIO3X & 0x01 )? byteData + 0x40 : byteData ;
+
void F75111_SetWDTEnable (BYTE byteTimer)
-
byteData = ( byteGPIO2X & 0x01 )? byteData + 0x80 : byteData ;
+
{
 +
WriteByte(F75111_INTERNAL_ADDR,WDT_TIMER_RANGE ,byteTimer); // set WatchDog range and timer
 +
WriteByte(F75111_INTERNAL_ADDR,WDT_CONFIGURATION,WDT_TIMEOUT_FLAG | WDT_ENABLE | WDT_PULSE | WDT_PSWIDTH_100MS); // Enable WatchDog, Setting WatchDog configure
 +
}
 +
</pre>
-
return byteData;
+
==Disable WatchDog==
-
}</pre>
+
-
 
+
-
== Get Keyboard wParam & lParam ==
+
<pre>
<pre>
-
BOOL CKey_Pad_utilityDlg::PreTranslateMessage(MSG* pMsg)
+
void F75111_SetWDTDisable ()
{
{
-
char StrTemp[16];
+
WriteByte(F75111_INTERNAL_ADDR,WDT_CONFIGURATION,0x00); // Disable WatchDog
-
int StrSize=16;
+
}
-
if( setbutton1 == true || setbutton2 == true || setbutton3 == true || setbutton4 == true )
+
</pre>
-
{
+
 
-
if(pMsg -> message == WM_SYSKEYDOWN )
+
==define F75111 pin in F75111.h ==
-
{
+
<pre>
-
for(int i=1;i<256;i++)
+
//--------------------------------------------------------------------------------------------------------
-
{
+
#define F75111_INTERNAL_ADDR 0x9C // OnBoard F75111 Chipset
-
if(pMsg -> wParam == i)
+
#define F75111_EXTERNAL_ADDR 0x6E // External F75111 Chipset
-
{
+
//--------------------------------------------------------------------------------------------------------
-
if(setbutton1== true)
+
#define F75111_CONFIGURATION 0x03 // Configure GPIO13 to WDT2 Function
-
{
+
//--------------------------------------------------------------------------------------------------------
-
msg1.wParam=pMsg->wParam;
+
#define GPIO1X_CONTROL_MODE 0x10 // Select Output Mode or Input Mode
-
msg1.lParam=pMsg->lParam;
+
#define GPIO2X_CONTROL_MODE 0x20 // Select GPIO2X Output Mode or Input Mode
-
GetKeyNameText(pMsg->lParam,StrTemp,StrSize);
+
#define GPIO3X_CONTROL_MODE 0x40 // Select GPIO3X Output Mode or Input Mode
-
m_edit1.SetWindowText(StrTemp);
+
//--------------------------------------------------------------------------------------------------------
-
setbutton1=false;
+
#define GPIO1X_INPUT_DATA 0x12 // GPIO1X Input
-
}
+
#define GPIO3X_INPUT_DATA 0x42 // GPIO3X Input
-
if(setbutton2== true)
+
//--------------------------------------------------------------------------------------------------------
-
{
+
#define GPIO2X_OUTPUT_DATA 0x21 // GPIO2X Output
-
msg2.wParam=pMsg->wParam;
+
//--------------------------------------------------------------------------------------------------------
-
msg2.lParam=pMsg->lParam;
+
#define GPIO1X_PULSE_CONTROL 0x13 // GPIO1x Level/Pulse Control Register
-
GetKeyNameText(pMsg->lParam,StrTemp,StrSize);
+
// 0:Level Mode
-
m_edit2.SetWindowText(StrTemp);
+
// 1:Pulse Mode
-
setbutton2=false;
+
#define GPIO1X_PULSE_WIDTH_CONTROL 0x14 // GPIO1x Pulse Width Control Register
-
}
+
#define GP1_PSWIDTH_500US 0x00 // When select Pulse mode: 500 us.
-
if(setbutton3== true)
+
#define GP1_PSWIDTH_1MS 0x01 // When select Pulse mode: 1 ms.
-
{
+
#define GP1_PSWIDTH_20MS 0x02 // When select Pulse mode: 20 ms.
-
msg3.wParam=pMsg->wParam;
+
#define GP1_PSWIDTH_100MS 0x03 // When select Pulse mode: 100 ms.
-
msg3.lParam=pMsg->lParam;
+
//--------------------------------------------------------------------------------------------------------
-
GetKeyNameText(pMsg->lParam,StrTemp,StrSize);
+
#define GPIO2X_PULSE_CONTROL 0x23 // GPIO2x Level/Pulse Control Register
-
m_edit3.SetWindowText(StrTemp);
+
// 0:Level Mode
-
setbutton3=false;
+
// 1:Pulse Mode
-
}
+
#define GPIO2X_PULSE_WIDTH_CONTROL 0x24 // GPIO2x Pulse Width Control Register
-
if(setbutton4== true)
+
#define GP2_PSWIDTH_500US 0x00 // When select Pulse mode: 500 us.
-
{
+
#define GP2_PSWIDTH_1MS 0x01 // When select Pulse mode: 1 ms.
-
msg4.wParam=pMsg->wParam;
+
#define GP2_PSWIDTH_20MS 0x02 // When select Pulse mode: 20 ms.
-
msg4.lParam=pMsg->lParam;
+
#define GP2_PSWIDTH_100MS 0x03 // When select Pulse mode: 100 ms.
-
GetKeyNameText(pMsg->lParam,StrTemp,StrSize);
+
//--------------------------------------------------------------------------------------------------------
-
m_edit4.SetWindowText(StrTemp);
+
#define GPIO3X_PULSE_CONTROL 0x43 // GPIO3x Level/Pulse Control Register
-
setbutton4=false;
+
// 0:Level Mode
-
}
+
// 1:Pulse Mode
-
}
+
#define GPIO3X_Output_Data 0x41 // GPIO3x Output Data Register
-
}
+
#define GPIO3X_PULSE_WIDTH_CONTROL 0x44 // GPIO3x Pulse Width Control Register
-
}
+
#define GP3_PSWIDTH_500US 0x00 // When select Pulse mode: 500 us.
-
if(pMsg -> message == WM_KEYDOWN)
+
#define GP3_PSWIDTH_1MS 0x01 // When select Pulse mode: 1 ms.
-
{
+
#define GP3_PSWIDTH_20MS 0x02 // When select Pulse mode: 20 ms.
-
for(int i=1;i<256;i++)
+
#define GP3_PSWIDTH_100MS 0x03 // When select Pulse mode: 100 ms.
-
{
+
//--------------------------------------------------------------------------------------------------------
-
if(pMsg -> wParam == i)
+
#define WDT_TIMER_RANGE 0x37 // 0-255 (secord or minute program by WDT_UNIT)
-
{
+
#define WDT_CONFIGURATION 0x36 // Configure WDT Function
-
if(setbutton1== true)
+
#define WDT_TIMEOUT_FLAG 0x40 // When watchdog timeout.this bit will be set to 1.
-
{
+
#define WDT_ENABLE 0x20 // Enable watchdog timer
-
msg1.wParam=pMsg->wParam;
+
#define WDT_PULSE 0x10 // Configure WDT output mode
-
msg1.lParam=pMsg->lParam;
+
// 0:Level Mode
-
GetKeyNameText(pMsg->lParam,StrTemp,StrSize);
+
// 1:Pulse Mode
-
m_edit1.SetWindowText(StrTemp);
+
-
setbutton1=false;
+
#define WDT_UNIT 0x08 // Watchdog unit select.
-
}
+
// 0:Select second.
-
if(setbutton2== true)
+
// 1:Select minute.
-
{
+
 
-
msg2.wParam=pMsg->wParam;
+
#define WDT_LEVEL 0x04 // When select level output mode:
-
msg2.lParam=pMsg->lParam;
+
// 0:Level low
-
GetKeyNameText(pMsg->lParam,StrTemp,StrSize);
+
// 1:Level high
-
m_edit2.SetWindowText(StrTemp);
+
 
-
setbutton2=false;
+
#define WDT_PSWIDTH_1MS 0x00 // When select Pulse mode: 1 ms.
-
}
+
#define WDT_PSWIDTH_20MS 0x01 // When select Pulse mode: 20 ms.
-
if(setbutton3== true)
+
#define WDT_PSWIDTH_100MS 0x02 // When select Pulse mode: 100 ms.
-
{
+
#define WDT_PSWIDTH_4000MS 0x03 // When select Pulse mode: 4 s.
-
msg3.wParam=pMsg->wParam;
+
</pre>
-
msg3.lParam=pMsg->lParam;
+
-
GetKeyNameText(pMsg->lParam,StrTemp,StrSize);
+
-
m_edit3.SetWindowText(StrTemp);
+
-
setbutton3=false;
+
-
}
+
-
if(setbutton4== true)
+
-
{
+
-
msg4.wParam=pMsg->wParam;
+
-
msg4.lParam=pMsg->lParam;
+
-
GetKeyNameText(pMsg->lParam,StrTemp,StrSize);
+
-
m_edit4.SetWindowText(StrTemp);
+
-
setbutton4=false;
+
-
}
+
-
}
+
-
}
+
-
}
+
-
}
+
-
return CDialog::PreTranslateMessage(pMsg);
+
-
}</pre>
+

Revision as of 14:24, 5 July 2013

Contents

The Sample code source you can download from

Source file: F75111_DIO_Src_v2.7W(32bit).zipF75111_DIO_Src_v2.7W(64bit).zip

Binary file: F75111_DIO_Bin_v2.7W(32bit).zipF75111_DIO_Bin_v2.7W(64bit).zip

We do the demo test with a test tool which DIx connect to DOx with Relay.
Image:cn003.jpg

How to use this Demo Application

         one F75111                          two F75111
Image:F75111v2.6w.jpg  Image:F75111v2.6w650.jpg

Attention Please:You must be install vcredist_x86.exe when first time you run the F75111_DIO.exe DEMO AP,The vcredist_x86.exe include all required DLL file.

1. Press the "Start" button to test DIO function

2. Press the "Enable" button to test WDT function

3. Press the "Disable" button to disable WDT

4. Check the "Enable Loop" box and press "Enable" to do WDT loop test

5. Press "Install WDT" to set the system to autorun this application when booting, press again to remove this application when booting.

6. If WDT enable, system icon will be Image:enable.jpg. if disable, system icon will be Image:disale.jpg


Image:flowchart.jpg

p.s.

f75111 send "F75111_SetWDTEnable(BYTE byteTimer)" including a parameter "timer",

if there's no disable signal (F75111_SetWDTDisable()) to stop it before timer countdown to 0, System will reboot.

if there's disable signal received, resent Enable WDT signal, for a loop to prevent from reboot

Introduction

Initial Internal F75111 port address (0x9c)

   define GPIO1X, GPIO2X, GPIO3X to input or output 
   and Enable WDT function pin 

Set F75111 DI/DO ( sample code as below Get Input value/Set output value )

   DO: InterDigitalOutput(BYTE byteValue))
   DI: InterDigitalInput()

Enable/Disable WDT

   Enable : F75111_SetWDTEnable (BYTE byteTimer)
   Disable: F75111_SetWDTDisable ()  

PULSE mode

Sample to setting GP33, 32, 31, 30 output 1mS low pulse signal.

{ 
    this->Write_Byte(F75111_INTERNAL_ADDR, GPIO3X_PULSE_CONTROL,       0x00);             //This is setting low pulse output
    this->Write_Byte(F75111_INTERNAL_ADDR, GPIO3X_PULSE_WIDTH_CONTROL, 0x01);             //This selects the pulse width to 1mS
    this->Write_Byte(F75111_INTERNAL_ADDR, GPIO3X_CONTROL_MODE,        0x0F);             //This is setting the GP33, 32, 31, 30 to output function.    
    this->Write_Byte(F75111_INTERNAL_ADDR, GPIO3X_Output_Data ,        0x0F);             //This is setting the GP33, 32, 31, 30 output data.
}

Initial internal F75111

void F75111::InitInternalF75111()
{
    this->Write_Byte(F75111_INTERNAL_ADDR,GPIO1X_CONTROL_MODE  ,0x00);        //set GPIO1X to Input  function     
    this->Write_Byte(F75111_INTERNAL_ADDR,GPIO3X_CONTROL_MODE  ,0x00);        //set GPIO3X to Input  function
    this->Write_Byte(F75111_INTERNAL_ADDR,GPIO2X_CONTROL_MODE  ,0xFF);        //set GPIO2X to Output function

    this->Write_Byte(F75111_INTERNAL_ADDR,F75111_CONFIGURATION, 0x03);        //Enable WDT OUT function
}

Set output value

void F75111::InterDigitalOutput(BYTE byteValue)
{
     BYTE byteData = 0;
     byteData = (byteData & 0x01 )? byteValue + 0x01 : byteValue;
     byteData = (byteData & 0x02 )? byteValue + 0x02 : byteValue;
     byteData = (byteData & 0x04 )? byteValue + 0x04 : byteValue;
     byteData = (byteData & 0x80 )? byteValue + 0x08 : byteValue;
     byteData = (byteData & 0x40 )? byteValue + 0x10 : byteValue;
     byteData = (byteData & 0x20 )? byteValue + 0x20 : byteValue; 
     byteData = (byteData & 0x10 )? byteValue + 0x40 : byteValue;
     byteData = (byteData & 0x08 )? byteValue + 0x80 : byteValue;           // get value bit by bit
   
     this->Write_Byte(F75111_INTERNAL_ADDR,GPIO2X_OUTPUT_DATA,byteData);    // write byteData value via GPIO2X output pin
}

Get Input value

BYTE F75111::InterDigitalInput()
{
    BYTE byteGPIO1X = 0;
    BYTE byteGPIO3X = 0;
    BYTE byteData   = 0;

    this->Read_Byte(F75111_INTERNAL_ADDR,GPIO1X_INPUT_DATA,&byteGPIO1X) ;   // Get value from GPIO1X
    this->Read_Byte(F75111_INTERNAL_ADDR,GPIO3X_INPUT_DATA,&byteGPIO3X) ;   // Get value from GPIO3X	

    byteGPIO1X = byteGPIO1X  & 0xF0;                                        // Mask unuseful value
    byteGPIO3X = byteGPIO3X  & 0x0F;                                        // Mask unuseful value

    byteData = ( byteGPIO1X & 0x10 )? byteData + 0x01 : byteData;
    byteData = ( byteGPIO1X & 0x80 )? byteData + 0x02 : byteData;
    byteData = ( byteGPIO1X & 0x40 )? byteData + 0x04 : byteData;	
    byteData = ( byteGPIO3X & 0x01 )? byteData + 0x08 : byteData;
	
    byteData = ( byteGPIO3X & 0x02 )? byteData + 0x10 : byteData;
    byteData = ( byteGPIO3X & 0x04 )? byteData + 0x20 : byteData;
    byteData = ( byteGPIO3X & 0x08 )? byteData + 0x40 : byteData;
    byteData = ( byteGPIO1X & 0x20 )? byteData + 0x80 : byteData;           // Get correct DI value from GPIO1X & GPIO3X
	
    return byteData;
}

Enable WatchDog

void F75111_SetWDTEnable (BYTE byteTimer)
{
    WriteByte(F75111_INTERNAL_ADDR,WDT_TIMER_RANGE  ,byteTimer);                                                       // set WatchDog range and timer
    WriteByte(F75111_INTERNAL_ADDR,WDT_CONFIGURATION,WDT_TIMEOUT_FLAG | WDT_ENABLE | WDT_PULSE | WDT_PSWIDTH_100MS);   // Enable WatchDog, Setting WatchDog configure
}

Disable WatchDog

void F75111_SetWDTDisable ()
{
    WriteByte(F75111_INTERNAL_ADDR,WDT_CONFIGURATION,0x00);                                                            // Disable WatchDog
}

define F75111 pin in F75111.h

//--------------------------------------------------------------------------------------------------------
#define    F75111_INTERNAL_ADDR        0x9C   //  OnBoard  F75111 Chipset
#define    F75111_EXTERNAL_ADDR        0x6E   //  External F75111 Chipset
//--------------------------------------------------------------------------------------------------------
#define    F75111_CONFIGURATION        0x03   //  Configure GPIO13 to WDT2 Function
//--------------------------------------------------------------------------------------------------------
#define    GPIO1X_CONTROL_MODE         0x10   //  Select Output Mode or Input Mode
#define    GPIO2X_CONTROL_MODE         0x20   //  Select GPIO2X Output Mode or Input Mode 
#define    GPIO3X_CONTROL_MODE         0x40   //  Select GPIO3X Output Mode or Input Mode 
//--------------------------------------------------------------------------------------------------------
#define    GPIO1X_INPUT_DATA           0x12   //  GPIO1X Input
#define    GPIO3X_INPUT_DATA           0x42   //  GPIO3X Input
//--------------------------------------------------------------------------------------------------------
#define    GPIO2X_OUTPUT_DATA          0x21   //  GPIO2X Output
//--------------------------------------------------------------------------------------------------------
#define    GPIO1X_PULSE_CONTROL        0x13   //  GPIO1x Level/Pulse Control Register
                                              //  0:Level Mode 
                                              //  1:Pulse Mode
#define    GPIO1X_PULSE_WIDTH_CONTROL  0x14   //  GPIO1x Pulse Width Control Register
#define    GP1_PSWIDTH_500US           0x00   //  When select Pulse mode:	500	us.
#define    GP1_PSWIDTH_1MS             0x01   //  When select Pulse mode:	1	ms.
#define    GP1_PSWIDTH_20MS            0x02   //  When select Pulse mode:	20	ms.
#define    GP1_PSWIDTH_100MS           0x03   //  When select Pulse mode:	100	ms.
//--------------------------------------------------------------------------------------------------------
#define    GPIO2X_PULSE_CONTROL        0x23   //  GPIO2x Level/Pulse Control Register
                                              //  0:Level Mode 
                                              //  1:Pulse Mode
#define    GPIO2X_PULSE_WIDTH_CONTROL  0x24   //  GPIO2x Pulse Width Control Register
#define    GP2_PSWIDTH_500US           0x00   //  When select Pulse mode:	500	us.
#define    GP2_PSWIDTH_1MS             0x01   //  When select Pulse mode:	1	ms.
#define    GP2_PSWIDTH_20MS            0x02   //  When select Pulse mode:	20	ms.
#define    GP2_PSWIDTH_100MS           0x03   //  When select Pulse mode:	100	ms.
//--------------------------------------------------------------------------------------------------------
#define    GPIO3X_PULSE_CONTROL        0x43   //  GPIO3x Level/Pulse Control Register
                                              //  0:Level Mode 
                                              //  1:Pulse Mode
#define    GPIO3X_Output_Data          0x41   //  GPIO3x Output Data Register 
#define    GPIO3X_PULSE_WIDTH_CONTROL  0x44   //  GPIO3x Pulse Width Control Register
#define    GP3_PSWIDTH_500US           0x00   //  When select Pulse mode:	500	us.
#define    GP3_PSWIDTH_1MS             0x01   //  When select Pulse mode:	1	ms.
#define    GP3_PSWIDTH_20MS            0x02   //  When select Pulse mode:	20	ms.
#define    GP3_PSWIDTH_100MS           0x03   //  When select Pulse mode:	100	ms.
//--------------------------------------------------------------------------------------------------------
#define    WDT_TIMER_RANGE             0x37   //  0-255 (secord or minute program by WDT_UNIT)
#define    WDT_CONFIGURATION           0x36   //  Configure WDT Function
#define    WDT_TIMEOUT_FLAG            0x40   //  When watchdog timeout.this bit will be set to 1.
#define    WDT_ENABLE                  0x20   //  Enable watchdog timer
#define    WDT_PULSE                   0x10   //  Configure WDT output mode
                                              //  0:Level Mode 
                                              //  1:Pulse Mode
												
#define    WDT_UNIT                    0x08   //  Watchdog unit select.
                                              //  0:Select second.
                                              //  1:Select minute.

#define    WDT_LEVEL                   0x04   //  When select level output mode:
                                              //  0:Level low
                                              //  1:Level high

#define    WDT_PSWIDTH_1MS             0x00   //  When select Pulse mode:	1	ms.
#define    WDT_PSWIDTH_20MS            0x01   //  When select Pulse mode:	20	ms.
#define    WDT_PSWIDTH_100MS           0x02   //  When select Pulse mode:	100	ms.
#define    WDT_PSWIDTH_4000MS          0x03   //  When select Pulse mode:	4	 s.
Personal tools