AXIOMTEK IRU151-I User manual

IRU151-I
Software Development
Kit
Reference Manual

ii
Revision History
Version
Revised
Date
Author
Description
1.0
2018/12/05
Hank
- 1st release

iii
How to Use This Document
This document is written to provide the information of the SDK and helps users
implement their own applications
Chapter 1, “Basic Structure” introduces the fundamental information for applying
the functions in this document.
Chapter 2, “Function Description” introduces the detailed information of the
functions provided by the SDK.
Appendix A, “Error Code”describes the meaning of the error code returned by
the functions.
Appendix B, “Function Table”shows all IRU151 function.

iv
Table of Contents
Revision History............................................................................................ii
How to Use This Document ........................................................................iii
CHAPTER 1 Introduction ................................................................... 1
1.1 The Basic of the Programming.................................................1
1.2 Create a Receiver Data Example ..............................................3
1.3 The Calibration Flow Chart .......................................................5
CHAPTER 2 Function Description................................................... 7
2.1 Open_Device ..............................................................................7
2.2 CloseDevice................................................................................8
2.3 GetDevInfoEx..............................................................................9
2.4 EnAIReceiver............................................................................10
2.5 DisAIReceiver...........................................................................11
2.6 ReadAIDataEx...........................................................................12
2.7 ReadAIVoltEx............................................................................13
2.8 SetAITrigConfEx.......................................................................15
2.9 SetAIChannel............................................................................16
2.10 SetAISampleRate .....................................................................17
2.11 SetAInputRange .......................................................................18
2.12 FactoryCalibratedRestore .......................................................19
2.13 ReadCaliFactors.......................................................................20
2.14 GetAISingleValueEx.................................................................21
2.15 GetAIinitConfEx........................................................................23
2.16 SetAIinitConf ............................................................................24
2.17 AICalibrationEx ........................................................................25
2.18 RestoreAIConf..........................................................................27
2.19 GetAIDataLength......................................................................28
2.20 GetDITrigConfEx ......................................................................29
2.21 ClearDITrigConf........................................................................30
2.22 SetDITrigConf...........................................................................31
2.23 GetDILevelEx............................................................................32
2.24 EnDIReceiver............................................................................33
2.25 DisDIReceiver...........................................................................34
2.26 EnDICounterEx.........................................................................35
2.27 DisDICounterEx........................................................................36
2.28 GetDICounterEx .......................................................................37
2.29 SetDICounterCompletedCallback...........................................38
2.30 SetDIStatusChangedCallback.................................................39
2.31 GetDOInitConfEx......................................................................40

v
2.32 ClearDOInitConf .......................................................................41
2.33 SetDOInitConf...........................................................................42
2.34 SetDOStatus.............................................................................43
2.35 GetDOStatus.............................................................................44
2.36 EnDOPWM ................................................................................45
2.37 DisDOPWM ...............................................................................46
2.38 GetDOPWMConf.......................................................................47
APPENDIX A Error Code.................................................................. 49

vi
This page is intentionally left blank.

IRU151-I Programmer Guidel
Introduction 1
CHAPTER 1
Introduction
This chapter introduces the information of the SDK.
1.1 The Basic of the Programming
To create an application with SDK, please follow the steps below.
Step 1 : Include IRU head file.
When user program a IRU application to call IRU API, user has to include "libiru.h"
and "axiomtek_err.h" files.
"libiru.h" files is for API and control IRU device.
and "axiomtek_err.h" files. Is error code respectively.
It can help user to analyze what problem is.
#include "libiru.h"
#include "axiomtek_err.h"
Step 2 : Create a device
int ret;
ret = Open_Device("IRU151");
if(ret != AXIO_OK)
printf("Create Device Failure\n");
(Continue)

IRU151-I Programmer Guidel
2 Introduction
Step 3 : Get information from device via API
int i=0;
char *pDevInfo;
short length;
(Continue)
int modelidx = 1;
ret = GetDevInfo(modelidx, &pDevInfo, &length);
if(ret == AXIO_OK){
for(i=0;i<length;i++)
printf("%c", toascii( *(pDevInfo +i)));
printf("\n");
} else
printf("Get Device info failure\n");
Step 4 : Close a device.
Close_Device();
Step 5 : The application can be closed

IRU151-I Programmer Guidel
Introduction 3
1.2 Create a Receiver Data Example
This example shows how to receive DI data. The sample is for a digital I/O receiver.
#define AXIO_OK 0x00
int channel = 1;
int filter = 0
int trig = 2;
int stop;
int ret;
ret = Open_Device("IRU151");
if(ret != AXIO_OK){
printf("open iru151 failure …\n");
return;
}
while(1)
{
switch(stop){
case 0:
ret = EnDIReceiver(channel, filter, trig);
if(ret != AXIO_OK)
printf("Enable DI Receiver failure \n");
break;
case 1:
ret = DisDIReceiver(channel);
if(ret != AXIO_OK)
printf("Enable DI Receiver failure \n");
break;
case 2:
printf("Exit \n");
break;
}

IRU151-I Programmer Guidel
4 Introduction
if(stop == 2){
break;
}
}
Close_Device();

IRU151-I Programmer Guidel
Introduction 5
1.3 The Calibration Flow Chart

IRU151-I Programmer Guidel
6 Introduction
This page is intentionally left blank.

IRU151-I Programmer Guidel
Function Description 7
CHAPTER 2
Function Description
This chapter describes the detail information of the SDK functions.
2.1 Open_Device
Description
Open the communication channel of I/O module.
Definition
int Open_Device (
char *devName
);
Parameters
*devName [in]: The name of target module. (IRU151/IR152)
Return value
AXIO_OK if successful. Other value represent the error. (See Error Code)
Example
int ret;
ret = Open_Device( “IRU151”);
if(ret != AXIO_OK)
printf (“Open Device failure\n”);

IRU151-I Programmer Guidel
8 Function Description
2.2 CloseDevice
Description
Close the communication channel of I/O module.
Definition
int Close_Device ();
Parameters
NULL
Return value
AXIO_OK if successful. Other value represent the error. (See Error Code)
Example
Int ret = 0;
ret = Close_Device ();

IRU151-I Programmer Guidel
Function Description 9
2.3 GetDevInfoEx
Description
Get the device information.
Definition
int GetDevInfoEx(
int infoIndex,
char *info,
int *infoLen
);
Parameters
infoIndex [in]: This information index.
0x00 : Model Name
0x01 : Manufacture
0x02 : Firmware version
*info [out]: The information string.
*infoLen [out]: The length of information string.
Return value
AXIO_OK if success, or other value represents the error. (See Error Code)
Example
int ret;
int infoLen = 0;
char info[128] = “”;
ret = GetDevInfo(0x00, info, &infoLen);
(Continue)

IRU151-I Programmer Guidel
10 Function Description
if (ret == AXIO_OK)
{
printf(“%s\n”, info);
}
else
{
printf("Get Device info failure\n");
}
2.4 EnAIReceiver
Description
Enable the receiver of the selected AI receiver.
Definition
int EnAIReceiver (void);
Parameters
NULL
Return value
AXIO_OK if success, or other value represents the error. (See Error Code)
Example
int ret;
ret = EnAIReceiver ();
if(ret != AXIO_OK)
printf(“Enable AI Receiver failure\n”);

IRU151-I Programmer Guidel
Function Description 11
2.5 DisAIReceiver
Description
Disable the receiver of the selected AI channel.
Definition
int DisAIReceiver (void);
Parameters
NULL
Return value
AXIO_OK if success, or other value represents the error. (See Error Code)
Example
int ret;
ret = DisAIReceiver ();
if(ret != AXIO_OK)
printf(“Disable AI Receiver failure\n”);

IRU151-I Programmer Guidel
12 Function Description
2.6 ReadAIDataEx
Description
Read AI data from SDK
Definition
void ReadAIDataEx(
int size,
char *data,
int *length
);
Parameters
size [in]: The buffer size.
*data [out]: The AI data.
(For example: Setting AI channel are 0, 1, 2, the input
data will put buffer by order. The data of channel 0 is
stored in data[0] and and data[1], the data of channe 1
is stroed in data[2] and and data[3] , the data of
channel 2 is stored in data[4] and and data[5] and so
on.
* length [out]: The length of AI data.
Return value
NULL
Example
int ret = 0;
int I = 0;
char buffer[1024 * 32] = “”;
int length = 0;
ret = ReadAIDataEx(1024*32, buffer, &length);
(Continue)

IRU151-I Programmer Guidel
Function Description 13
if (length > 0)
{
for(i=0;i< length;i++)
printf(“0x%02x “, data[i]);
printf(“\n”);
}
2.7 ReadAIVoltEx
Description
Read voltage data from SDK
Definition
void ReadAIVoltEx (
int size,
double *data,
int * length
);
Parameters
size [in]: The buffer size.
*data [out]: The voltage data
(For example: Setting AI channel are 0, 1, 3, the input
data will put buffer by order. The data of channel 0 is
stored in data[0], the data of channel 1 is stroed in
data[1], the data of channel 3 is stored in data[2] and so
on.
*length [out]: The length of voltage data.
Return value
NULL

IRU151-I Programmer Guidel
14 Function Description
Example
int ret = 0;
int i = 0;
double data[1024];
int length = 0;
ret = ReadAIVoltEx (1024, data, &length);
(Continue)
if (length > 0)
{
for(i=0;i< DataLength;i++)
printf(“%lf \n”, data[i]);
printf(“\n”);
}
Table of contents
Other AXIOMTEK Microcontroller manuals
Popular Microcontroller manuals by other brands

NXP Semiconductors
NXP Semiconductors S12ZVM-EWP user guide

Texas Instruments
Texas Instruments MSP430 series manual

Trident
Trident 4DWAVE-DX Technical reference manual

Renesas
Renesas RX Series user manual

Great Lakes
Great Lakes BIORADIO user guide

Crystalfontz America
Crystalfontz America CFAF240400C0-030SC-A1-2 quick start guide