5. Using the Memory Address Map
52
CNT16-8(FIT)GY,
CNT16-8L(FIT)GY
Sample Program
/*===========================================================================
F&eIT I/F Sample Program
DEVICE
ID:
0
Channel:
0ch
========================================================================== */
#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(CNT) */
#define FIT_CNT_BIT
(0x12)
#define FIT_CNT_D_FILTER
(0x13)
#define FIT_CNT_CH_START
(0x00)
#define FIT_CNT_CH_ST_RESET
(0x01)
#define FIT_CNT_CH_INITIAL
(0x02)
#define FIT_CNT_CH_PRESET
(0x03)
/* Sample */
#define FIT_SAMPLE_IP_ADDRESS
"172.17.8.151"
#define FIT_SAMPLE_PORT
(0x5007)
#define FIT_SAMPLE_DEVICE_ID
(0)
#define FIT_SAMPLE_CH
(0)
int main(int argc, char* argv[])
{
DWORD
dwIpAddress;
DWORD
dwVaBase;
DWORD
dwVaBase_Data;
DWORD
dwVaOffset;
DWORD
dwVaChOffset;
DWORD
dwVaChOffset_Data;
DWORD
dwChCarryCnt;
WORD
hHandle;
WORD
wStatus;
BYTE
byCategory;