![Forenex FES91W Series Скачать руководство пользователя страница 51](http://html1.mh-extra.com/html/forenex/fes91w-series/fes91w-series_user-manual_2318966051.webp)
51
-
4-4 ADC Control
4-4.1> How to control ADC for FES91W
In FES91W, there are 4 definable A/D converters. FES91W provide
control functions for
ADC
; user can use it to read the level status from ADC channel. (Refer to section 3-2 to know
how)
Below procedures are to merge
ADC control functions
into user
’s program:
STEP1.
Add “
fn_9g45_lib.dll
” into project folder.
STEP2.
Include
“
fn_9g45_lib.dll
” in public declare area of user’s program.
STEP3.
Use the function
“
adc_config
” refer to below 4-4.2.
●
The source code located the folder of
“CD\FES91Wxx_xxx \FES91W-AP source code\GPIO”
4-4.2> Example code
Below is a simple example code to use the ADC controlling functions in Visual Studio 2005.
' Declaration loaded ADC control function from DLL file
<DllImport(
"fn_9g45_lib.dll"
)> _
Public
Shared
Function
adc_config(
ByVal
adc_num
As
Integer
)
As
Integer
End
Function
'The following program is how to execute ADC function
Dim
adc1_val
As
Single
'Read ADC1 value, and divide by 1000
adc1_val = adc_config(1) / 1000