AXIOMTEK IRU151-I Reference Manual

AXIOMTEK IRU151-I Reference Manual

Software development kit

Advertisement

Quick Links

IRU151-I
Software Development
Kit
Reference Manual

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the IRU151-I and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Summary of Contents for AXIOMTEK IRU151-I

  • Page 1 IRU151-I Software Development Reference Manual...
  • Page 2: Revision History

    Revision History Version Revised Author Description Date 2018/12/05 Hank release...
  • Page 3: How To Use This Document

    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”...
  • Page 4: Table Of Contents

    Table of Contents Revision History .................... ii How to Use This Document ................ iii CHAPTER 1 Introduction ..............1 The Basic of the Programming ..........1 Create a Receiver Data Example ..........3 The Calibration Flow Chart ............5 CHAPTER 2 Function Description ........... 7 Open_Device ................
  • Page 5 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...
  • Page 6 This page is intentionally left blank.
  • Page 7: Chapter 1 Introduction

    IRU151-I Programmer Guidel CHAPTER 1 Introduction This chapter introduces the information of the SDK. 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"...
  • Page 8 IRU151-I Programmer Guidel Step 3 : Get information from device via API i=0; char *pDevInfo; short length; (Continue) 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");...
  • Page 9: Create A Receiver Data Example

    IRU151-I Programmer Guidel 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 channel = 1; filter = 0 trig = 2; stop; ret; ret = Open_Device("IRU151");...
  • Page 10 IRU151-I Programmer Guidel if(stop == 2){ break; Close_Device(); Introduction...
  • Page 11: The Calibration Flow Chart

    IRU151-I Programmer Guidel The Calibration Flow Chart Introduction...
  • Page 12 IRU151-I Programmer Guidel This page is intentionally left blank. Introduction...
  • Page 13: Chapter 2 Function Description

    IRU151-I Programmer Guidel CHAPTER 2 Function Description This chapter describes the detail information of the SDK functions. 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) ...
  • Page 14: Closedevice

    IRU151-I Programmer Guidel 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;...
  • Page 15: Getdevinfoex

    IRU151-I Programmer Guidel GetDevInfoEx  Description Get the device information.  Definition int GetDevInfoEx( infoIndex, char *info, *infoLen  Parameters infoIndex [in]: This information index. 0x00 : Model Name 0x01 : Manufacture 0x02 : Firmware version *info [out]: The information string.
  • Page 16: Enaireceiver

    IRU151-I Programmer Guidel if (ret == AXIO_OK) printf(“%s\n”, info); else printf("Get Device info failure\n"); 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) ...
  • Page 17: Disaireceiver

    IRU151-I Programmer Guidel 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 ret;...
  • Page 18: Readaidataex

    IRU151-I Programmer Guidel ReadAIDataEx  Description Read AI data from SDK  Definition void ReadAIDataEx( size, char *data, *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.
  • Page 19: Readaivoltex

    IRU151-I Programmer Guidel if (length > 0) for(i=0;i< length;i++) printf(“0x%02x “, data[i]); printf(“\n”); ReadAIVoltEx  Description Read voltage data from SDK  Definition void ReadAIVoltEx ( size, double *data, * 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.
  • Page 20 IRU151-I Programmer Guidel  Example ret = 0; i = 0; double data[1024]; length = 0; ret = ReadAIVoltEx (1024, data, &length); (Continue) if (length > 0) for(i=0;i< DataLength;i++) printf(“%lf \n”, data[i]); printf(“\n”); Function Description...
  • Page 21: Setaitrigconfex

    IRU151-I Programmer Guidel SetAITrigConfEx  Description Set up the AI trigger configure for channel 0.  Definition int SetAITrigConfEx( mode, source, condition, level  Parameters mode Trigger mode 0x00 : Auto run. 0x01 : Post trigger source Triger source 0x00 : AI channel 0 (Analog trigger)
  • Page 22: Setaichannel

    IRU151-I Programmer Guidel  Example ret = 0; mode = 0x1; source = 0x0; condition = 0x0; level = 2500; /* 2.5 voltage */ ret = SetAITrigConfEx(mode, source, condition, levelV); if(ret != AXIO_OK) printf(“Set AI Trigger configure failure\n”); SetAIChannel ...
  • Page 23: Setaisamplerate

    IRU151-I Programmer Guidel 2.10 SetAISampleRate  Description Set AI sample rate. (This API is not support on IRU151)  Definition int SetAISampleRate ( divisor  Parameters divisor [in]: The divisor of sample rate.. The internal clock source is 88.67M. Sample rate = 88.67M / divisor (24 bit) ...
  • Page 24: Setainputrange

    IRU151-I Programmer Guidel 2.11 SetAInputRange  Description Set AI input range. There are 4 types to be chosen. (IRU151 only supports -5~+5V, -10~+10V, 0~20 mA)  Definition int SetAInputRange ( short range  Parameters range Input voltage range 0 : 0V ~ +5V...
  • Page 25: Factorycalibratedrestore

    IRU151-I Programmer Guidel 2.12 FactoryCalibratedRestore  Description Reset the AI calibration value to default value.  Definition int FactoryCalibratedRestore(void);  Parameters NULL  Return value AXIO_OK if success, or other value represents the error. (See Error Code)  Example ret;...
  • Page 26: Readcalifactors

    IRU151-I Programmer Guidel 2.13 ReadCaliFactors  Description Read clalibrated value from flash.  Definition int ReadCaliFactory ( mode, size, CALI_FACTORS *factors, *length  Parameters mode [in]: 0: User mode, 1: Factory mode *size [in]: The buffer size of factors. *factors [out]: The factors buffer.
  • Page 27: Getaisinglevalueex

    IRU151-I Programmer Guidel if(ret == AXIO_OK){ for(i=0;i<length;i++) printf("Input range: %d\n", factors[i].inputRange); printf("Offset: %d\n", factors[i].offset); printf("Gain: %lf\n", factors[i].gain); printf("\n"); printf(“\n”); } else printf(“Read calibration factor failure\n”); 2.14 GetAISingleValueEx  Description Get the AI single voltage with the selected channels and input range.
  • Page 28 IRU151-I Programmer Guidel ret = SetAIChannel (15); if(ret != AXIO_OK) printf(“Set AI channel failure\n”); ret = SetAInputRange (0); if(ret != AXIO_OK) printf(“Set AI input range failure\n”); ret = GetAISingleValueEx (16, data, &length); (Continue) if (ret == AXIO_OK) for(i=0;i<length;i++) printf(“%lf”, data[i]);...
  • Page 29: Getaiinitconfex

    IRU151-I Programmer Guidel 2.15 GetAIinitConfEx  Description Get AI initial setting from flash memory.  Definition int GetAIinitConfEx ( configSize, AI_CONIFG *config, *length  Parameters configSize [in]: The buffer size of AI configuration. *config [out]: The AI configuration buffer. *length [out]: The length of AI configuration.
  • Page 30: Setaiinitconf

    IRU151-I Programmer Guidel printf("Sample rate: %d\n", config[i].sampleRate); printf("===============================================\n"); 2.16 SetAIinitConf  Description Store AI initial configuration to flash memory.  Definition int SetAIinitConf (void)  Parameters NULL  Return value AXIO_OK if success, or other value represents the error. (See Error Code) ...
  • Page 31: Aicalibrationex

    IRU151-I Programmer Guidel 2.17 AICalibrationEx  Description Start the AI calibration mode. (IRU151 only supports -5~+5V and -10~+10V)  Definition int AICalibrationEx( mode, size, char *data, *length  Parameters mode [in]: The calibration mode. 0x01 : Enter the user calibrate mode.
  • Page 32 IRU151-I Programmer Guidel char * pCalibratedInfo; short length; ret; ret = AICalibration(1, & pCalibratedInfo, &length); if(ret == AXIO_OK) for(i=0;i<length;i++) printf(“0x%02x “, *( pCalibratedInfo +i)); printf(“\n”); else printf(“Calibration Fail \n”); Function Description...
  • Page 33: Restoreaiconf

    IRU151-I Programmer Guidel 2.18 RestoreAIConf  Description Reset AI intial configuration to default in flash memory.  Definition int RestoreAIConf (void)  Parameters NULL  Return value AXIO_OK if success, or other value represents the error. (See Error Code) ...
  • Page 34: Getaidatalength

    IRU151-I Programmer Guidel 2.19 GetAIDataLength  Description Get remaining AI data length in SDK.  Definition int GetAIDataLength (int *length);  Parameters *length [out]: The length of remaining data.  Return value AXIO_OK if success, or other value represents the error. (See Error Code) ...
  • Page 35: Getditrigconfex

    IRU151-I Programmer Guidel 2.20 GetDITrigConfEx  Description Get DI trigger configuration.  Definition int GetDITrigConf ( DI_TRIGGER_CONFIG *config  Parameters *config [out]: The DI trigger configuration.  Return value AXIO_OK if success, or other value represents the error. (See Error Code) ...
  • Page 36: Clearditrigconf

    IRU151-I Programmer Guidel 2.21 ClearDITrigConf  Description Restore the default settings in the flash memory.  Definition int ClearDITrigConf (void)  Parameters NULL.  Return value AXIO_OK if success, or other value represents the error. (See Error Code)  Example ret;...
  • Page 37: Setditrigconf

    IRU151-I Programmer Guidel 2.22 SetDITrigConf  Description Save the DI trigger setting in the flash memory.  Definition int SetDITrigConf (void)  Parameters NULL  Return value AXIO_OK if success, or other value represents the error. (See Error Code) ...
  • Page 38: Getdilevelex

    IRU151-I Programmer Guidel 2.23 GetDILevelEx  Description Get current DI level.  Definition int GetDILevel (int *level)  Parameters *level [out]: The current DI level.  Return value AXIO_OK if success, or other value represents the error. (See Error Code) ...
  • Page 39: Endireceiver

    IRU151-I Programmer Guidel 2.24 EnDIReceiver  Description Enable the DI receiver.  Definition int EnDIReceiver( short channel, short filter, short condition  Parameters channel [in]: Channel. (Bit0-7 indicates channel 0-7) filter [in]: DI filter time. (0-250 ms) condition [in]: DI trigger condition 0x00 : Raising edge.
  • Page 40: Disdireceiver

    IRU151-I Programmer Guidel 2.25 DisDIReceiver  Description Disable the DI receiver.  Definition int DisDIReceiver( short channel  Parameters channel [in]: Channel. (Bit0-7 indicates channel 0-7)  Return value AXIO_OK if success, or other value represents the error. (See Error Code) ...
  • Page 41: Endicounterex

    IRU151-I Programmer Guidel 2.26 EnDICounterEx  Description Enable the DI channe. (Only channel 0 support this mode on IRU device.)  Definition int EnDICounterEx( channel condition, counter  Parameters channel [in]: Channel (Bit0-7 indicates channel 0-7) condition [in]: Set the trigger condition 0x00 : Raising edge.
  • Page 42: Disdicounterex

    IRU151-I Programmer Guidel 2.27 DisDICounterEx  Description Disable the DI counter mode.  Definition int DisDICounterEx( channel, char *data, *length  Parameters channel [in]: Channel (Bit0-7 indicates channel 0-7) data [out]: The data of DI counter. Byte0: Channel index. Byte1: Number of counts. (HI) Byte2: Number of counts.
  • Page 43: Getdicounterex

    IRU151-I Programmer Guidel 2.28 GetDICounterEx  Description Get the DI counter number.  Definition int GetDICounterEx (int channel, int *data)  Parameters channel [in]: The channel index. (Bit0-7 indicates channel 0-7) data [out]: The current data of DI counter. ...
  • Page 44: Setdicountercompletedcallback

    IRU151-I Programmer Guidel 2.29 SetDICounterCompletedCallback  Description Set the DI counter finish callback function.  Definition int SetDICounterCompletedCallback( DICounterCompletedCallback callback  Parameters callback The callback function for receiving counter finished value.  Return value AXIO_OK if success, or other value represents the error. (See Error Code) ...
  • Page 45: Setdistatuschangedcallback

    IRU151-I Programmer Guidel 2.30 SetDIStatusChangedCallback  Description Set the DI status change callback function for the notification while receiving the DI Data.  Definition int SetDIStatusChangedCallback( DIStatusChanged_Callback callback  Parameters callback [in]: The callback function for receiving DI Data notification..
  • Page 46: Getdoinitconfex

    IRU151-I Programmer Guidel 2.31 GetDOInitConfEx  Description Get the DO setting from the flash memory.  Definition int GetDOInitConfEx ( char *config, *length  Parameters *config [out]: The data of the gotten information. [Byte 0 : Channel 0 ] 0x00 : Low...
  • Page 47: Cleardoinitconf

    IRU151-I Programmer Guidel if(ret == AXIO_OK){ for(i = 0; i < length; i++) printf("DO%d: %s\n", i, (config[i] == 0 ? "Low" : config[i] == 1 ? "High" : "Default")); printf("\n"); } else printf("Get DO setting failure\n"); 2.32 ClearDOInitConf  Description Clear the DO setting.
  • Page 48: Setdoinitconf

    IRU151-I Programmer Guidel 2.33 SetDOInitConf  Description Save DO settings.  Definition int SetDOInitConf (void)  Parameters NULL  Return value AXIO_OK if success, or other value represents the error. (See Error Code)  Example int ret; ret = SetDOInitConf ();...
  • Page 49: Setdostatus

    IRU151-I Programmer Guidel 2.34 SetDOStatus  Description Set the DO status on the selected channel..  Definition int SetDOStatus( channel, level  Parameters channel [in]: Selected channel. Bit 0 to 1 indicates the channels 0 ~ 1. level [in]: The output status.
  • Page 50: Getdostatus

    IRU151-I Programmer Guidel 2.35 GetDOStatus  Description Get the DO status on the selected channels  Definition int GetDOStatus ( short channel, *level  Parameters [in]: The value of 1 to 3 indicates the channels 0 – 1. channel *level [out]: The current DO output status.
  • Page 51: Endopwm

    IRU151-I Programmer Guidel 2.36 EnDOPWM  Description Enable PWM mode on the channel 0 and set all parameters.  Definition int EnDOPWM ( channel , dutycycle, short freq  Parameters channel Selected channel (Must be 0) dutycycle The range of the duty cycle is from 1(%) to 99(%).
  • Page 52: Disdopwm

    IRU151-I Programmer Guidel 2.37 DisDOPWM  Description Disable PWM mode on the channel 0.  Definition int DisDOPWM ( channel  Parameters channel Selected channel (Must be 0)  Return value AXIO_OK if success, or other value represents the error. (See Error Code) ...
  • Page 53: Getdopwmconf

    IRU151-I Programmer Guidel 2.38 GetDOPWMConf  Description During DO PWM starting, User can call this function to get the DO PWM mode configuration.  Definition int GetDOPWMConf ( char *config, *length  Parameters *config The data of the gotten information.
  • Page 54 IRU151-I Programmer Guidel if(ret != AXIO_OK) printf(“Get DO PWM Configure failure\n”); else for(int i=0;i<length ;i++) printf(“0x%02x”, config[i]); printf(“\n”); Function Description...
  • Page 55: Appendix A Error Code

    IRU151-I Programmer Guidel APPENDIX A Error Code Error Code List Error Code Error Name Description 0x00000000 AXIO_OK Success 0xE0000001 AXIO_ERR_HANDLE The invalid handle. 0xE0000502 AXIO_ERR_CMD The command operation failure. 0xE0000003 AXIO_ERR_PARAMETERS The input parameters are incorrect.. 0xE0000004 AXIO_ERR_NOT_SUPPORTED The feature is not support.

Table of Contents