![Forenex FES91W Series User Manual Download Page 48](http://html1.mh-extra.com/html/forenex/fes91w-series/fes91w-series_user-manual_2318966048.webp)
48
-
4-2 GPIO Control
4-2.1> How to control GPIO for FES91W
In FES91W, there are 16 definable GPIO. Depends on setting of each GPIO, user could
read or write the level status of each GPIO of FES91W.
FES91W provide
control functions for GPIO
; user can use it to initial the General Purpose
GPIO as input or output. (Refer to section 3-2 to know how)
Below procedures are to merge
GPIO control functions
into user
’s program:
STEP1.
Add “
fn_9g45_lib.dll
” into project folder.
STEP2.
Load “
fn_9g45_lib.dll
” in public declare area of user’s program.
STEP3.
Use the function
“
gpio_output
” & “
gpio_input
” refer to below 4-2.2.
●
The source code located the folder of
“CD\FES91Wxx_xxx \FES91W-AP source code\GPIO”
4-2.2> Example code
Below is a simple example code to use the GPIO controlling functions in Visual Studio 2005.
'Declaration loaded GPIO control function from DLL file
<DllImport(
"fn_9g45_lib.dll"
)> _
Public
Shared
Function
gpio_output(
ByVal
pin_num
As
Integer
,
ByVal
hi_low
As
Integer
)
As
Integer
End
Function
<DllImport(
"fn_9g45_lib.dll"
)> _
Public
Shared
Function
gpio_input(
ByVal
pin_num
As
Integer
)
As
Integer
End
Function
'The following program is how to execute GPIO function on RadioButton
Private
Sub
RadioButton1_CheckedChanged(
ByVal
sender
As
System.Object,
ByVal
e
As
System.EventArgs)
Handles
RadioButton1.CheckedChanged
If
ComboBox1.SelectedIndex = 0
Then
' Select GPIO become Output mode
If
RadioButton1.Checked =
True
Then
' Hight
gpio_output(0, 1)
'Set GPIO(0) to be output mode and set voltage is HI
End
If
End
If
If
ComboBox1.SelectedIndex = 1
Then
' Select
GPIO become Input mode
If
RadioButton1.Checked =
True
Then
'LOW
End
If
End
If
End
Sub