I8093w API Reference Manual v1.0.1
I8093w API Reference Manual v1.0.1
----------------------------------------
General Information
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.The information furnished by ICP DAS is believed to be accurate and
reliable.However, no responsibility is assumed by ICP DAS for its use, not for
any infringements of patents or other rights of third parties resulting from its use.
Copyright
Copyright @ 2009 by ICP DAS Co., Ltd.All rights are reserved.
Trademark
The names used for identification only may be registered trademarks of their
respective companies.
---
TABLE OF CONTENTS
1. Introduction......................................................................................5
1.1. Specification ....................................................................................................6
1.2. Pin Assignment.................................................................................................7
1.3. Block Diagram .................................................................................................8
1.4. Wiring Connection ..........................................................................................9
---
4.1. pac_i8093W_Init.............................................................................................35
4.2. pac_i8093W_GetFirmwareVersion.............................................................37
4.3. pac_i8093W_GetLibVersion ........................................................................38
4.4. pac_i8093W_GetLibDate.............................................................................39
4.5. pac_i8093W_SetMode .................................................................................40
4.6. pac_i8093W_GetMode................................................................................42
4.7. pac_i8093W_SetXOR ....................................................................................44
4.8. pac_i8093W_GetXOR ...................................................................................46
4.9. pac_i8093W_GetLineStatus.........................................................................48
4.10. pac_i8093W_GetIndex...............................................................................50
4.11. pac_i8093W_Read32BitEncoder..............................................................52
4.12. pac_i8093W_ResetEncoder ......................................................................54
---
1. INTRODUCTION
I-8093W is a 3-axis encoder counter board on I-8000 platform. I-8093W encoder
card has 32 bits counter and high counting rate 10Mpps. The application of
I-8093W board is position/distance measurement, velocity measurement,
feedback for motor control, hard wheel input and so on.
Features:
3-axis, 32-bit encoder counter
Encoder counting mode: CW/CCW , Pulse/Direction, A/B Phase
Maximum counting rate: 4 MHz
Encoder Input: A, B, Z differential
Input Level: 5V, 12V/24V with external resistor
A/B/Z signal isolation voltage: 2500V optical isolation
Built-in XOR logic for active high or active low encoder input
---
1.1. Specification
Parallel I/O Module
3-axis, 32 bits encoder counter.
Encoder Mode
1. CW/CCW mode
2. Pulse/Dir mode
3. Quadrant mode
Input Level
1. Input level 5 V
Logic High: 4 V ~ 5 V
Logic Low: 0 V ~ 2 V
2. Input 12 V with external resistor 1 K ohm
Logic High: 5 V ~ 12 V
Logic Low: 0 V ~ 2 V
3. Input 24V with external resistor 2K ohm
Logic High: 7 V ~ 24 V
Logic Low: 0 V ~ 2 V
Power consumption
1.0 W
---
---
The input signal maybe active low or active high. The XOR0/XOR1/XOR2 are
designed to invert the active low signal for internal logic requirement. If the value of
XOR0/1/2 is the encoder value will have different errors. Refer to chapter 2 for
more information.
---
---
---
10
---
11
The internal counting logic is expected as active high. User can use XOR control
bit to select the proper waveform as follows:
If the value of XOR control bit is error, the encoder value will have different errors
given as follows:
The counting direction will be inverted
The Z is inverted
I8093W API Reference Manual, Version 1.0.1, August 2009
---
12
5V Differential Encoder
5V Single-ended Encoder
---
13
Note:
1. Input 12V with external resistor(R) 1K ohm
2. Input 24V with external resistor(R) 2K ohm
---
14
---
15
3.1. i8093W_Init
This function can initial the I-8093W and can check the hardware ID, if return 0 for
input slot index, it means the ID of this slot index is I-8093W,if return -1, it means
there is no I-8093W for this slot index.
Syntax
Parameter
slot: 0 ~ 7
Return Values
Please refer to Error Code Table.
---
16
Examples
[C]
int slotIndex,err;
err=i8093W_Init(slotIndex);
if(err==0)
{
printf(There is an I-8093W at slot %d\n,slotIndex);
}
else
{
printf(There is no I-8093W at slot %d\n,slotIndex);
}
---
17
3.2. i8093W_GetFirmwareVersion
This function gets the firmware version of I-8093W hardware.
Syntax
Parameter
slot: 0 ~ 7
Return Values
The firmware version of I-8093W hardware
Examples
[C]
short firmware_version;
firmware_version = i8093W_GetFirmwareVersion (slot);
---
18
3.3. i8093W_GetLibVersion
This function gets the library version of i8093W.dll.
Syntax
Parameter
none
Return Values
The library version of i8093W.dll
Examples
[C]
short version;
version = i8093W_GetLibVersion ();
---
19
3.4. i8093W_GetLibDate
This function gets the library built date of i8093W.dll.
Syntax
Parameter
LibDate the string buffer of library built date
Return Values
The library built date of i8093W.dll
Examples
[C]
char lib_date[32];
i8093W_GetLibDate(lib_date);
---
20
3.5. i8093W_SetMode
This function to set the operation mode of I-8093W.
Syntax
Parameter
slot: 0 ~ 7
ch: 0 ~ 2
mode:
1: CW/CCW counting mode
2: Pulse/Direction counting mode
3: AB Phase (Quadrant counting) mode
Return Values
Please refer to Error Code Table.
---
21
Examples
[C]
int slot,ch;
slot = 0;
for(ch=0;ch<3;ch++)
{
i8093W_SetMode(slot,ch,3); // AB Phase
}
---
22
3.6. i8093W_GetMode
This function to get the operation mode of I-8093W.
Syntax
Parameter
slot: 0 ~ 7
ch: 0 ~ 2
mode:
1: CW/CCW counting mode
2: Pulse/Direction counting mode
3: AB Phase (Quadrant counting) mode
Return Values
Please refer to Error Code Table.
---
23
Examples
[C]
int slot,ch,mode;
slot = 0;
for(ch=0;ch<3;ch++)
{
i8093W_SetMode(slot,ch,&mode);
}
---
24
3.7. i8093W_SetXOR
This function to set the xor of I-8093W for each channel.
Syntax
Parameter
slot: 0 ~ 7
ch: 0 ~ 2
xor: 0/1
Return Values
Please refer to Error Code Table.
Examples
[C++]
int slot,ch;
slot = 0;
for(ch=0;ch<3;ch++)
{
i8093W_ SetXOR (slot,ch,0);
}
---
25
3.8. i8093W_GetXOR
This function to get the xor of I-8093W for each channel.
Syntax
Parameter
slot: 0 ~ 7
ch: 0 ~ 2
mode:
1: CW/CCW counting mode
2: Pulse/Direction counting mode
3: AB Phase (Quadrant counting) mode
Return Values
Please refer to Error Code Table.
---
26
Examples
[C]
int slot,ch,mode;
slot = 0;
for(ch=0;ch<3;ch++)
{
i8093W_SetMode(slot,ch,&mode);
}
---
27
3.9. i8093W_GetLineStatus
This function to get A,B and Z status of I-8093W.
Syntax
Parameter
slot: 0 ~ 7
ch: 0 ~ 2
A: 0/1
B: 0/1
Z: 0/1
Return Values
Please refer to Error Code Table.
---
28
Examples
[C]
int slot,ch,A,B,Z;
slot = 0;
for(ch=0;ch<3;ch++)
{
i8093W_GetLineStatus (slot,ch,&A,&B,&Z);
}
---
29
3.10. i8093W_GetIndex
This function to get Z index status of I-8093W.
Syntax
Parameter
slot: 0 ~ 7
ch: 0 ~ 2
Z: 0/1
Return Values
Please refer to Error Code Table.
Examples
[C]
int slot,ch,Z;
slot = 0;
for(ch=0;ch<3;ch++)
{
i8093W_GetIndex (slot,ch,&Z);
}
---
30
3.11. i8093W_Read32BitEncoder
This function to get 32-Bit Encoder value of I-8093W.
Syntax
Parameter
slot: 0 ~ 7
ch: 0 ~ 2
encVal: 32-Bit Encoder value of I-8093W (0 ~ 0xffffffff)
Return Values
Please refer to Error Code Table.
Examples
[C]
int slot,ch;
long encoder=0;
slot = 0;
for(ch=0;ch<3;ch++)
{
i8093W_ Read32BitEncoder(slot,ch,&encoder);
}
I8093W API Reference Manual, Version 1.0.1, August 2009
---
31
3.12. i8093W_ResetEncoder
This function to reset 32-Bit Encoder value to zero.
Syntax
Parameter
slot: 0 ~ 7
ch: 0 ~ 2
Return Values
Please refer to Error Code Table.
Examples
[C]
int slot,ch;
slot = 0;
for(ch=0;ch<3;ch++)
{
i8093W_ResetEncoder (slot,ch);
}
---
32
---
33
---
34
4.1. pac_i8093_Init
This function can initial the I-8093W and can check the hardware ID, if return 0 for
input slot index, it means the ID of this slot index is I-8093W,if return -1, it means
there is no I-8093W for this slot index.
Syntax
Parameter
Slot: 0 ~ 7
Return Values
Please refer to Error Code Table.
---
35
Examples
[C++]
int slotIndex,err;
err=pac_i8093_Init(slotIndex);
if(err==0)
{
printf(There is an I-8093W at slot %d\n,slotIndex);
}
Else
{
printf(There is no I-8093W at slot %d\n,slotIndex);
}
[C#]
using pac8093WNet;
int slotIndex,err;
err= pac8093W.Init(slotIndex);
if(err==0)
{
printf(There is an I-8093W at slot %d\n,slotIndex);
}
else
{
printf(There is no I-8093W at slot %d\n,slotIndex);
}
---
36
4.2. pac_i8093_GetFirmwareVersion
This function gets the firmware version of I-8093W hardware.
Syntax
Parameter
slot
Return Values
The firmware version of I-8093W hardware
Examples
[C++]
short firmware_version;
firmware_version = pac_i8093_GetFirmwareVersion (slot);
[C#]
using pac8093WNet;
short version;
firmware_version = pac8093W.GetFirmwareVersion (slot);
---
37
4.3. pac_i8093_GetLibVersion
This function gets the library version of pac_i8093.dll.
Syntax
Parameter
none
Return Values
The library version of pac_i8093.dll
Examples
[C++]
short version;
version = pac_i8093_GetLibVersion ();
[C#]
using pac8093WNet;
short version;
version = pac8093W.GetLibVersion ( );
---
38
4.4. pac_i8093_GetLibDate
This function gets the library built date of pac_i8093.dll.
Syntax
Parameter
LibDate the string buffer of library built date
Return Values
The library built date of pac_i8093.dll
Examples
[C++]
char lib_date[32];
pac_i8093_GetLibDate(lib_date);
[C#]
using pac8093WNet;
string lib_date;
lib_date = pac8093W. GetLibDate ( );
---
39
4.5. pac_i8093_SetMode
This function to set the operation mode of I-8093W.
Syntax
Parameter
slot: 0 ~ 7
ch: 0 ~ 2
mode:
1: CW/CCW counting mode
2: Pulse/Direction counting mode
3: AB Phase (Quadrant counting) mode
Return Values
Please refer to Error Code Table.
---
40
Examples
[C++]
int slot,ch;
slot = 0;
for(ch=0;ch<3;ch++)
{
pac_i8093_SetMode(slot,ch,3); // AB Phase
}
[C#]
using pac8093WNet;
int slot,ch;
slot = 0;
for(ch=0;ch<3;ch++)
{
pac8093W.SetMode(slot,ch,3); // AB Phase
}
---
41
4.6. pac_i8093_GetMode
This function to get the operation mode of I-8093W.
Syntax
Parameter
slot: 0 ~ 7
ch: 0 ~ 2
mode:
1: CW/CCW counting mode
2: Pulse/Direction counting mode
3: AB Phase (Quadrant counting) mode
Return Values
Please refer to Error Code Table.
---
42
Examples
[C++]
int slot,ch,mode;
slot = 0;
for(ch=0;ch<3;ch++)
{
pac_i8093_SetMode(slot,ch,&mode);
}
[C#]
using pac8093WNet;
int slot,ch,mode=0;
slot = 0;
for(ch=0;ch<3;ch++)
{
pac8093W.GetMode(slot,ch,ref mode);
}
---
43
4.7. pac_i8093_SetXOR
This function to set the xor of I-8093W for each channel.
Syntax
Parameter
slot: 0 ~ 7
ch: 0 ~ 2
xor: 0/1
Return Values
Please refer to Error Code Table.
---
44
Examples
[C++]
int slot,ch;
slot = 0;
for(ch=0;ch<3;ch++)
{
pac_i8093_ SetXOR (slot,ch,0);
}
[C#]
using pac8093WNet;
int slot,ch;
slot = 0;
for(ch=0;ch<3;ch++)
{
pac8093W. SetXOR (slot,ch,0);
}
---
45
4.8. pac_i8093_GetXOR
This function to get the xor of I-8093W for each channel.
Syntax
Parameter
slot: 0 ~ 7
ch: 0 ~ 2
mode:
1: CW/CCW counting mode
2: Pulse/Direction counting mode
3: AB Phase (Quadrant counting) mode
Return Values
Please refer to Error Code Table.
---
46
Examples
[C++]
int slot,ch,mode;
slot = 0;
for(ch=0;ch<3;ch++)
{
pac_i8093_SetMode(slot,ch,&mode);
}
[C#]
using pac8093WNet;
int slot,ch,xor=0;
slot = 0;
for(ch=0;ch<3;ch++)
{
pac8093W.GetXOR(slot,ch,ref xor);
}
---
47
4.9. pac_i8093_GetLineStatus
This function to get A,B and Z status of I-8093W.
Syntax
Parameter
slot: 0 ~ 7
ch: 0 ~ 2
A: 0/1
B: 0/1
Z: 0/1
Return Values
Please refer to Error Code Table.
---
48
Examples
[C++]
int slot,ch,A,B,Z;
slot = 0;
for(ch=0;ch<3;ch++)
{
pac_i8093_GetLineStatus (slot,ch,&A,&B,&Z);
}
[C#]
using pac8093WNet;
int slot,ch,A=0,B=0,Z=0;
slot = 0;
for(ch=0;ch<3;ch++)
{
pac8093W.GetLineStatus (slot,ch,ref A,ref B, ref Z);
}
---
49
4.10. pac_i8093_GetIndex
This function to get Z index status of I-8093W.
Syntax
Parameter
slot: 0 ~ 7
ch: 0 ~ 2
Z: 0/1
Return Values
Please refer to Error Code Table.
---
50
Examples
[C++]
int slot,ch,Z;
slot = 0;
for(ch=0;ch<3;ch++)
{
pac_i8093_GetIndex (slot,ch,&Z);
}
[C#]
using pac8093WNet;
int slot,ch, Z=0;
slot = 0;
for(ch=0;ch<3;ch++)
{
pac8093W.GetIndex(slot,ch, ref Z);
}
---
51
4.11. pac_i8093_Read32BitEncoder
This function to get 32-Bit Encoder value of I-8093W.
Syntax
Parameter
slot: 0 ~ 7
ch: 0 ~ 2
encVal: 32-Bit Encoder value of I-8093W (0 ~ 0xffffffff)
Return Values
Please refer to Error Code Table.
---
52
Examples
[C++]
int slot,ch;
long encoder=0;
slot = 0;
for(ch=0;ch<3;ch++)
{
pac_i8093_ Read32BitEncoder(slot,ch,&encoder);
}
[C#]
using pac8093WNet;
int slot,ch, Z=0;
long encoder=0
slot = 0;
for(ch=0;ch<3;ch++)
{
pac8093W. ReadEncoder(slot,ch, ref encoder);
}
---
53
4.12. pac_i8093_ResetEncoder
This function to reset 32-Bit Encoder value to zero.
Syntax
Parameter
slot: 0 ~ 7
ch: 0 ~ 2
Return Values
Please refer to Error Code Table.
---
54
Examples
[C++]
int slot,ch;
slot = 0;
for(ch=0;ch<3;ch++)
{
pac_i8093_ResetEncoder (slot,ch);
}
[C#]
using pac8093WNet;
int slot,ch;
slot = 0;
for(ch=0;ch<3;ch++)
{
pac8093W.ResetEncoder (slot,ch);
}
---
55
OK
-1
ID_ERROR
-2
SLOT_OUT_RANGE
-3
CHANNEL_OUT_RANGE
-4
MODE_ERROR
---
56