5. Using the Memory Address Map
56
ADI16-4(FIT)GY
Sample program
/*=========================================================================
F&eIT I/F Sample Program
DEVICE ID:
0
Channel:
0 to 3ch
Range:
-10 to 10V
===========================================================================
*/
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include "Fit.h"
/* Address(common) */
#define FIT_IO
(0x00300000)
#define FIT_IO_DEVICE_INFOR
(0x0000)
#define FIT_IO_DEVICE_CONFIG
(0x1000)
#define FIT_IO_INPUT
(0x4000)
#define FIT_IO_OUTPUT
(0x5000)
#define FIT_IO_DEVICE_SIZE
(0x0080)
#define FIT_PRODUCT_CATEGORY
(0x00)
#define FIT_MODULE_START
(0x10)
#define FIT_ERROR_STATUS
(0x11)
/* Information(Common)
*/
#define FIT_PRODUCT_DIGITAL
(0x01)
#define FIT_PRODUCT_ANALOG
(0x02)
#define FIT_PRODUCT_COUNTER
(0x03)
#define FIT_MODULE_START_OFF
(0x00)
#define
FIT_MODULE_START_ON
(0x01)
/* Address(AIO) */
#define FIT_AIO_AI_BIT
(0x12)
#define FIT_AIO_AI_RANGE
(0x13)
#define FIT_AIO_AI_MODE
(0x14)
#define FIT_AIO_AO_BIT
(0x1A)
#define FIT_AIO_AO_RANGE
(0x1B)
/* Information(AIO)
*/
#define FIT_AIO_RANGE_PM10
(0)
#define FIT_AIO_RANGE_PM5
(1)
#define FIT_AIO_RANGE_P10
(50)
#define FIT_AIO_RANGE_P5
(51)
#define FIT_AIO_RANGE_P20MA
(100)
#define FIT_AIO_RANGE_P4TO20MA (101)
/* Sample */
#define
FIT_SAMPLE_IP_ADDRESS "192.168.132.211"
#define FIT_SAMPLE_PORT
(0x5007)
#define FIT_SAMPLE_DEVICE_ID
(0)
int main(void)
{
DWORD dwIpAddress;
DWORD dwVaBase;
DWORD dwVaOffset;
WORD hHandle;