ICP DAS USA I-9K Series Manual

ICP DAS USA I-9K Series Manual

Module linux api reference

Advertisement

Quick Links

I-9048 / I-8048W Module
Linux API Reference
(For Linux platform)
V 1.0.2 April 2021
Written by Sean Hsu
Edited by Cindy Huang

Advertisement

Table of Contents
loading

Summary of Contents for ICP DAS USA I-9K Series

  • Page 1 I-9048 / I-8048W Module Linux API Reference (For Linux platform) V 1.0.2 April 2021 Written by Sean Hsu Edited by Cindy Huang...
  • Page 2 Warranty All products manufactured by ICP DAS are under warranty regarding defective materials for a period of one year, beginning from the date of delivery to the original purchaser. Warning ICP DAS assumes no liability for any damage resulting from the use of this product. ICP DAS reserves the right to change this manual at any time without notice.
  • Page 3: Table Of Contents

    Table of Contents Table of Contents ............................3 Preface ................................ 5 Introduction ............................6 1.1. I/O Module Dimensions ......................7 1.2. Inserting the I/O Modules ......................8 1.3. Wire Connections ........................10 1.4. Demo Programs ......................... 11 I-9048 / I-8048W module features ....................12 2.1.
  • Page 4 3.15. I8048W_InstallISR ........................43 3.16. I8048W_UnInstallISR ....................... 45 3.17. I8048W_UnFreezeINT ......................46 3.18. I8048W_GetLibVersion ......................47 Revision History ............................48...
  • Page 5: Preface

    Preface The I-9048 / I-8048W is an 8-channel digital input module with hardware interrupt capability for real-time system application. Each channel can be programmed as an interrupt input channel to invoke an interrupt on falling edges, rising edges or both falling and rising edges. Each channel can be eithers Isolated or Non-isolated TTL Input, selectable by Jumper.
  • Page 6: Introduction

    Safe value for DO module Programmable slew-rate for AO module Refer to http://www.icpdas.com/en/product/guide+Remote__I_O__Module__and__Unit+_%EF%BC%86amp;__Local__I_O__Modules+I-9K_I-97K__Series more details regarding of I-9K series module specification, jumper settings details and wiring information. Refer to http://www.icpdas.com/en/product/guide+Remote__I_O__Module__and__Unit+_%EF%BC%86amp;__Local__I_O__Modules+I-8K_I-87K__Series__(High_ for more details regarding of I-8K series module specification, jumper settings details and _Profile) wiring information.
  • Page 7: I/O Module Dimensions

    1.1. I/O Module Dimensions All dimensions are in millimeters. I-9K module with spring clamp terminal connector Left Side View Top View I-8K module with screw terminals connector...
  • Page 8: Inserting The I/O Modules

    1.2. Inserting the I/O Modules Follow the procedure described below to insert the I-9048 module. 1. Insert the I/O module 2. Wiring connection The metal part of the cord end terminal on the wire can be direct wired to the terminal. Note: The I-9048 module supports spring clamp terminal connector.
  • Page 9 A tip on how to connect the wiring to the connector 1. Use screwdriver to push the orange 2. Insert the wiring into the terminal clip in. block Keep on pushing Insert the wire A tip on how to remove the wiring from the connector 1.
  • Page 10: Wire Connections

    1.3. Wire Connections...
  • Page 11: Demo Programs

    1.4. Demo Programs ICP DAS provides a range of demo programs for different platforms that can be used to verify the functions of the I-8048W/9048. The source code contained in these programs can also be reused in your own custom programs if needed. Both I-8048W/9048 use the same library and demo.
  • Page 12: I-9048 / I-8048W Module Features

    2. I-9048 / I-8048W module features The I-9048 / I-8048W is an 8-channel digital input module with hardware interrupt capability for real-time system application. Each channel can be programmed as an interrupt input channel to invoke an interrupt on falling edges, rising edges or both falling and rising edges. Each channel can be eithers Isolated or Non-isolated TTL Input, selectable by Jumper.
  • Page 13: General Introduction

    2.1. General Introduction The I-9048 / I-8048W module is an 8-channel digital input module designed for interrupt applications. The key features of the I-9048 / I-8048W are as following: Isolation Intra-module Isolation 1500 Vrms EMS Protection ESD (IEC 61000-4-2) ± 4 kV Contact for Each Terminal LED Indicators Status 1 x Power and 8 x DI...
  • Page 14: Pin Assignment For The I-9048

    2.1.1. Pin Assignment for the I-9048 The pin assignment for the I-9048 is shown as follows: Pin 1 and 11: TTL GND, ground for non-isolated input signals Pins 2 ~ 9, 12~19: 8-channel digital input Pins 10 and 20: Isolated power supply, 5V, 200mA max.
  • Page 15: Pin Assignment For The I-8048W

    2.1.2. Pin Assignment for the I-8048W The pin assignment for the I-8048W is shown as follows: Pin 1: TTL GND, ground for non-isolated input signals Pins 3 ~ 18: 8-channel digital input Pins 19 and 20: Isolated power supply, 5V, 200mA max.
  • Page 16: Block Diagram

    2.1.3. Block Diagram The signal flow block diagram for I-9048 is shown as follows:...
  • Page 17 The signal flow block diagram for I-8048W is shown as follows:...
  • Page 18: Isolated Or Ttl Input

    2.1.4. Isolated or TTL Input The input signal can be either isolated or TTL input for I-9048 as follows: Isolated input V i n + V i n - JP1 ~ JP8 in the DOWN position will select the isolated input 1 ~ 8 TTL input V i n - V i n +...
  • Page 19 The input signal can be either isolated or TTL input for I-8048W as follows: Isolated input TTL input for ch0 for ch1 for ch2 for ch3 for ch4 for ch5 for ch6 Isolated input (default) TTL input for ch7...
  • Page 20: Digital Input & Led Indicators

    2.1.5. Digital Input & LED indicators The LED status and the digital input relation are listed as follows: power LED i-9048 Isolated: Input status Digital Input( Logic level ) Electric signal OPEN 0 ~ +1V +4 ~ +30V High TTL: Input status Digital Input( Logic level ) Electric signal...
  • Page 21: Programmable Rising/Falling Interrupt

    2.1.6. Programmable Rising/Falling interrupt Each channel of the I-9048 can be programmed as one of the following types individually.  Rising edge interrupt input  Falling edge interrupt input  Rising edge and Falling edge interrupt input The Interrupt trigger types are as follows: Digital Input (Logic value) Application...
  • Page 22 Digital Input (Logic value) Application Service Falling Edge Interrupt Digital Input (Logic value) Application Service Rising and falling Edge Interrupt T is the leading time between I-9048 receiving the input signal to the application receiving the interrupt service. Note: If the interrupt signal is too short, the new status may be as same as old status. In that condition, the interrupt service thread cannot identify which interrupt source is active.
  • Page 23: Software Introduction

    2.2. Software Introduction Users can follow the sections to understand the usage of I-9048 / I-8048W Library software. We offer multi-functions in the I-9048 / I-8048W library, and users can use these functions to develop I-9048 / I-8048W program.
  • Page 24: Software Flow Chart

    2.2.1. Software flow chart Application System Kernel Initialize I-9048 Enable falling edge or rising edge Install Interrupt Service Thread External signal (IST) Event IST loop function  Initialize I-9048: Gives all internal variables an initial value. Any interrupt signal clear to low, then all interrupt will not be blocked and CPU will be able to receive any further interrupts.
  • Page 25  Enable falling edge or rising edge: Each channel can set to:  Rising edge interrupt  Falling edge interrupt  Rising edge and Falling edge interrupt User can enable one channel, several channels or all channels as interrupt signal input. The function declaration: ...
  • Page 26: Recognize Different Interrupt Service Requests

    2.2.2. Recognize different interrupt service requests I-9048 / I-8048W is an 8 channels rising/falling edge programmable interrupt module. It can plug into slot of the PAC controllers. The section introduces how to recognize interrupt requests from different slots and channels. I-9048/I-8048W Linux API Reference, v 1.0.2 E-mail: service@icpdas.com...
  • Page 27 Requests from different slots Each slot is assigned an interrupt pin of the CPU shown in section 1.3. So their ISTs are different. CPU executes different ISR when the request is from different slot. Considering when the interrupts occur, the situations can be divided to two kinds. Interrupted at different time CPU executes ISTs one by one in the order of when they occurred.
  • Page 28: Api References

    3. API References ICPDAS supplies a range of C API functions for the I-8048W/I-9048 module. When developing a custom program, refer to either the i8048.h header file, or the API functions described in the following sections for more detailed information. The following is an overview of the functions provided in the LinPAC library - libi8k.a.
  • Page 29: Function List

    3.1. Function List The common API functions of I-8048W / I-9048 Module list as below table. Detailed information related to individual functions can be found in the following sections. Systematics Function Description This function reads the full channel DI value of I8048W_DI_ALL the I-9048 module.
  • Page 30: I8048W_Di_All

    3.2. I8048W_DI_ALL This function reads the full channel DI value of the I-8048W / I-9048 module. Syntax 【C】 int I8048W_DI_ALL ( int iSlot Parameters iSlot [in] Specifies the slot number (1 - 8). Return Value Return the full channel DI value. Example int byteData, slotNumber = 0;...
  • Page 31: I8048W_Di_Ch

    3.3. I8048W_DI_Ch This function read the single-channel DI status of the I-8048W / I-9048 module. Syntax 【C】 int I8048W_DI_Ch( int slot, int DI_Channel, Parameters slot [in] Specifies the slot number (1 - 8). DI_Channel [in] The single channel of the I-9048 module to be read. Return Value 1: DI ON 0: DI OFF...
  • Page 32: I8048W_ Set_Risingreg

    3.4. I8048W_ Set_RisingReg I-8048W / This function is used to Enable/Disable the Rising interrupt of an I-9048 channel. Syntax 【C】 void I8048W_Set_RisingReg( int slot, int channel, int enable Parameters slot [in] Specifies the slot number (1 - 8). channel [in] Specifies the channel number ( 0 to 7). Enable [in] Select Enable or Disable, 1=Enable, 0=Disable Return Value...
  • Page 33: I8048W_ Set_Fallingreg

    3.5. I8048W_ Set_FallingReg I-8048W / This function is used to Enable/Disable the Falling interrupt of an I-9048 channel. Syntax 【C】 void I8048W_Set_FallingReg( int slot, int channel, int enable Parameters slot [in] Specifies the slot number (1 - 8). channel [in] Specifies the channel number ( 0 to 7). Enable [in] Select Enable or Disable, 1=Enable, 0=Disable Return Value...
  • Page 34: I8048W_Read_Risingreg

    3.6. I8048W_Read_RisingReg This function Read the rising interrupt setting status of an I-8048W / I-9048 channel. Syntax 【C】 int I8048W_Read_RisingReg ( int slot, int channel Parameters slot [in] Specifies the slot number (1 - 8). channel [in] Specifies the channel number ( 0 to 7). Return Value Rising status: 1: Enable...
  • Page 35: I8048W_Read_Fallingreg

    3.7. I8048W_Read_FallingReg This function Read the falling interrupt setting status of an I-8048W / I-9048 channel. Syntax 【C】 int I8048W_Read_FallingReg ( int slot, int channel Parameters slot [in] specifies the slot number (1 - 8). channel [in] Specifies the channel number ( 0 to 7). Return Value 1: Enable 0: Disable...
  • Page 36: I8048W_Read_Risingevent

    3.8. I8048W_Read_RisingEvent This function read rising interrupt status from the I-8048W / I-9048 modules. Syntax 【C】 int I8048W_Read_RisingEvent( int slot, int channel Parameters slot [in] specifies the slot number (1 - 8). channel [in] Specifies the channel number( 0 to 7). Return Value 1: Rising interrupt occur 0: No rising interrupt occur...
  • Page 37: I8048W_Read_Fallingevent

    3.9. I8048W_Read_FallingEvent This function read falling interrupt status from the I-8048W / I-9048 modules. Syntax 【C】 int _I8048W_Read_FallingEvent ( int slot, int channel Parameters slot [in] Specifies the slot number (1 - 8). channel [in] Specifies the channel number ( 0 to 7). Return Value 1: falling interrupt occur 0: No falling interrupt occur...
  • Page 38: I8048W_Read_Risingeventcount

    3.10. I8048W_Read_RisingEventCount This function read total count values of the rising interrupt occurred on an I-8048W / I-9048 channel. Syntax 【C】 DWORD I8048W_Read_RisingEventCount( int slot, int channel Parameters slot [in] Specifies the slot number (1 - 8). channel [in] Specifies the channel number ( 0 to 7). Return Value Rising interrupt count value I-9048/I-8048W Linux API Reference, v 1.0.2...
  • Page 39: I8048W_Read_Fallingeventcount

    3.11. I8048W_Read_FallingEventCount This function read total count values of the rising interrupt occurred on an I-8048W / I-9048 channel. Syntax 【C】 DWORD I8048W_Read_FallingEventCount( int slot, int channel Parameters slot [in] Specifies the slot number (1 - 8). channel [in] Specifies the channel number ( 0 to 7). Return Value falling interrupt count value I-9048/I-8048W Linux API Reference, v 1.0.2...
  • Page 40: I8048W_Clear_Risingeventcount

    3.12. I8048W_Clear_RisingEventCount This function clear total count values of the rising interrupt occurred on an I-8048W / I-9048 channel. Syntax 【C】 void I8048W_Clear_RisingEventCount ( int slot, int channel Parameters slot [in] Specifies the slot number (1 - 8). channel [in] Specifies the channel number ( 0 to 7). Return Values None Return Value None.
  • Page 41: I8048W_Clear_Fallingeventcount

    3.13. I8048W_Clear_FallingEventCount This function clear total count values of the falling interrupt occurred on an I-8048W / I-9048 channel. Syntax 【C】 void I8048W_Clear_FallingEventCount ( int slot, int channel Parameters slot [in] Specifies the slot number (1 - 8). channel [in] Specifies the channel number ( 0 to 7). Return Value None I-9048/I-8048W Linux API Reference, v 1.0.2...
  • Page 42: I8048W_Init

    3.14. I8048W_Init This function is used to initialize the driver and confirm the hardware ID of the I-8048W / I-9048 module. Syntax 【C】 int I8048W_Init( int iSlot Parameters iSlot [in] Specifies the slot number (1 - 8). Return Value Return 0 if success, otherwise false. Example int ret = 0;...
  • Page 43: I8048W_Installisr

    3.15. I8048W_InstallISR This function is used to install a slot interrupt service thread for I-9048. Syntax 【C】 void I8048W_InstallISR ( int iSlot, CALLBACK_FUNC *IST_Function, Parameters iSlot [in] Specifies the slot number (1 - 8). *ISR_Function [in] After installing an IST, the CPU will execute the ISR_Function when “External signal” enters the I-9048.
  • Page 44 Example int slotNumber = 1; int channelNumber =1; int ret=0; ret = I8048W_Init(slotNumber); if (!ret){ I8048W_Set_RisingReg(slotNumber,channelNumber,1); I8048W_Set_FallingReg(slotNumber,channelNumber,0); I8048W_InstallISR(slotNumber, ISRFUN); … Void ISRFUN(){ int temp = 0; …. I8048W_UnFreezeINT(slotNumber, channelNumber); return 1; I-9048/I-8048W Linux API Reference, v 1.0.2 E-mail: service@icpdas.com...
  • Page 45: I8048W_Uninstallisr

    3.16. I8048W_UnInstallISR This function is used to uninstall a slot interrupt service thread and disable a hardware interrupt. Syntax 【C】 void I8048W_UnInstallISR ( int iSlot, Parameters iSlot [in] Specifies the slot number (1 - 8). Return Value None Example int slotNumber = 1; I8048W_UnInstallISR(slotNumber);...
  • Page 46: I8048W_Unfreezeint

    3.17. I8048W_UnFreezeINT This function clear interrupt status of the I-8048W / I-9048 channel. Syntax 【C】 void I8048W_UnFreezeINT( int slot, int channel Parameters slot [in] Specifies the slot number (1 - 8). channel [in] Specifies the channel number ( 0 to 7). Return Value None Examples...
  • Page 47: I8048W_Getlibversion

    3.18. I8048W_GetLibVersion This function to get the library version of I-8048W / I-9048W. Syntax 【C】 short I8048W_GetLibVersion() Return Value Version number For Example : 0x106 = Rev 1.0.6 I-9048/I-8048W Linux API Reference, v 1.0.2 E-mail: service@icpdas.com...
  • Page 48: Revision History

    Revision History This chapter provides revision history information to this document. The table below shows the revision history. Revision Date Description 1.0.2 October 2020 Initial issue I-9048/I-8048W Linux API Reference, v 1.0.2 E-mail: service@icpdas.com...

This manual is also suitable for:

I-8k seriesI-9048I-8048w

Table of Contents