ICPDAS I-8000 I-8090 3-axis encoder card, I-8000 I-8091 2-axis stepping/servo motor control card User Manual
Below you will find brief information for 3-axis encoder card I-8000 I-8090, 2-axis stepping/servo motor control card I-8000 I-8091. The I-8090 is a 3-axis encoder counter board on the I-8000 platform. The application of the I-8090 board is position/distance measurement, velocity measurement, feedback for motor control, handwheel input and so on. The I-8091 card is a 2-axis command-type stepping motor control card on the I-8000 platform, it also can be used as servo motor control (pulse input type). It has an embedded CPU which performs motion commands transferred from the I-8000 main system to increase system performance and a 2Kbytes-FIFO is introduced as a command buffer.
Advertisement
Advertisement
I-8090/I-8091 User Manual Version 1.0 06/2001
User Manual
Part 1: I-8090 3-axis encoder card
Part 2: I-8091 2-axis stepping/servo control card
http://www.icpdas.com
ICPDAS
I-8090/I-8091 User Manual Version 1.0 06/2001
I-8090 Contents _
1. Hardware
1.1 I-8000 hardware address
1.2 Registers of I-8090 Board
1.3 LED indicator
1.4 Connection
2. Software
2.1 Constants and Functions
2.2 Eaxmples
2.2.1 Detect I-8090 card
2.2.2 Start to use I-8090 card
2.2.3 Get X, Y, Z-axis encoder counter’s value
2.2.4 Software 32 bits encoder counter programming
1-9
1-13
1-13
1-17
1-17
1-18
1-18
1-20
1-4
1-4
1-5
1-8 http://www.icpdas.com
ICPDAS
I-8090/I-8091 User Manual Version 1.0 06/2001
I-8091 Contents _
1. Introduction 2-4
1.1 System Block Diagram
1.2 DDA technology
2. Hardware
2-4
2-5
2-8
2.1 I-8000 hardware address
2.2 Register of I-8091 board
2.3 LED indicator
2.4 Hardware configuration
2.4.1 Limit switch configuration
2.4.2 Output pulse mode configuration
2.4.3 Direction configuration
2.4.4 Turn Servo ON/OFF (Hold ON/OFF)
2.4.5 Automatic protection
2.4.6 Set limit switch as normal close condition
2.5 Connection
2.5.1 Pin assignment of connector CN2
2-12
2-13
2-14
2-14
2.5.2 The internal circuit of CW_PULSE, CCW_DIR, HOLD 2-15
2.5.3 The internal circuit of limit switch input 2-15
2.5.4 Example of connection
3. Software
2-16
2-18
3.1 Functions
3.1.1 Setting commands
3.1.2 Stop commands
3.1.3 Simple motion commands
3.1.4 Interpolation commands
2-18
2-20
2-24
2-25
2-30
2-8
2-9
2-10
2-11
2-11
2-12
2-12
2-12
3.1.5 Others
3.2 Start up and end of program
4. Example
4.1 Detect I-8091 card
4.2 Example: DEMO.cpp
4.3 Example: DEMO1.cpp
2-35
2-37
2-39
2-39
2-40
2-40 http://www.icpdas.com
ICPDAS
I-8090 User Manual
I-8090
3-axis encoder card
User Manual
Version 1.0 06/2001 Edition
Version 1.0 06/2001
Warranty: All products manufactured by ICP DAS are warranted against defective materials for one year from the date of delivery to the original purchaser
Warning: ICP DAS assumes no liability for damage consequent to 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 it’s use, nor for any infringements of patents or other rights of third parties resulting from it’s use.
Copyright
Copyright 2001 by ICP DAS. All right are reserved
Trademark
The names used for identification only maybe registered trademarks of their respective companies.
http://www.icpdas.com
1-1 ICPDAS
I-8090 User Manual Version 1.0 06/2001
I-8090 3-axis encoder card
I-8090 is a 3-axis encoder counter board on I-8000 platform. I-8090 encoder card has internal digital filter, 16 bits counter and high counting rate
1Mpps. The application of I-8090 board is position/distance measurement, velocity measurement, feedback for motor control, handwheel input and so on.
A system including I-8000 (main system), I-8091 (2-axis stepping/servo control card), I-8090 (3-axis encoder card) can be implemented as a standalone motion controller system for low cost automatical machine.
Features
! 3-axis, 16 bits encoder counter.
! 32 bits encoder counter by software.
! Maximum counting rate : 1M pulse/sec.
! Differential input A+, A-, B+, B-, C+, C-.
! Quadrant counting mode, CW/CCW counting mode, Pulse/Dir counting mode.
! 2500V optical isolation http://www.icpdas.com
1-2 ICPDAS
I-8090 User Manual Version 1.0 06/2001
8090 Contents _
1. Hardware
1.1 I-8000 hardware address
1.2 Registers of I-8090 Board
1.3 LED indicator
1.4 Connection
2. Software
2.1 Constants and Functions
2.2 Eaxmples
2.2.1 Detect I-8090 card
2.2.2 Start to use I-8090 card
2.2.3 Get X, Y, Z-axis encoder counter’s value
2.2.4 Software 32 bits encoder counter programming
1-9
1-13
1-13
1-17
1-17
1-18
1-18
1-20
1-4
1-4
1-5
1-8 http://www.icpdas.com
1-3 ICPDAS
I-8090 User Manual Version 1.0 06/2001
1. Hardware _
1.1 I-8000 hardware address
The hardware address of I-8000 main system is fixed as following table.
There are 4 slots I-8000 and 8 slots I-8000.
I-8000, 4 slot
Address
I-8000, 8 slot
Address
Slot 1 Slot 2 Slot 3 Slot 4 Slot 5 Slot 6 Slot 7 Slot 8
0x080 0x0A0 0x0C0 0x0E0 ---------
0x080 0x0A0 0x0C0 0x0E0 0x140 0x160 0x180 0x1A0
Slot 1 Slot 2 Slot 3 Slot 4
88888
I-8000, 4 slots
I-8000, 8 slots
88888
Slot 1 Slot 2 Slot 3 Slot 4 Slot 5 Slot 6 Slot 7 Slot 8
Fig(1) I-8000 hardware address http://www.icpdas.com
1-4 ICPDAS
I-8090 User Manual
1.2 Registers of I-8090 board
The
I-8090
card’s registers table as following.
Version 1.0 06/2001
Register Add. R/W Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
ID 0x00 R 0x0D
XDATA 0x01 R
YDATA 0x02 R
ZDATA 0x03 R
INDEX 0x04 R
XCTRL 0x00 W
YCTRL 0x01 W
ZCTRL 0x02 W
X-axis encoder value
Y-axis encoder value
Z-axis encoder value
S1
S1
S0
S0
S1 S0
ZI YI XI
/RST /INH /SEL
/RST /INH /SEL
/RST /INH /SEL
Register Add. R/W Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
ID 0x00 R 0x0D
The ID register is read only and its value is fixed as 0x0D. User can check this register to identify I-8090 card or not.
Register Add. R/W Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
XDATA 0x01 R X-axis encoder value
XDATA: the X-axis encoder counter value can be read out from this register.
The low byte value of 16 bits encoder counter can be read out when set
/SEL=0 (XCTRL register), the high byte can be read out when set /SEL=1
(XCTRL register).
Register Add. R/W Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
YDATA 0x02 R Y-axis encoder value
YDATA : the Y-axis encoder counter value can be read out from this register.
The low byte value of 16 bits encoder counter can be read out when set
/SEL=0 (YCTRL register), the high byte can be read out when set /SEL=1
(YCTRL register).
Register Add. R/W Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
ZDATA 0x03 R Z-axis encoder value
ZDATA : the Z-axis encoder counter value can be read out from this register.
The low byte value of 16 bits encoder counter can be read out when set http://www.icpdas.com
1-5 ICPDAS
I-8090 User Manual Version 1.0 06/2001
/SEL=0 (ZCTRL register), the high byte can be read out when set /SEL=1
(ZCTRL register).
Register Add. R/W Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
INDEX 0x04 R ZI YI XI
The index input C+/C- can read out from this register. These bits are active high.
XI : indicate the index of X-axis (C+/C- input).
YI : indicate the index of Y-axis (C+/C- input).
ZI : indicate the index of Z-axis (C+/C- input).
Register Add. R/W Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
XCTRL 0x00 W S1 S0 /RST /INH /SEL
YCTRL 0x01 W
ZCTRL 0x02 W
S1
S1
S0
S0
/RST /INH /SEL
/RST /INH /SEL
The XCTRL,YCTRL and ZCTRL register are control registers for X-axis, Yaxis, Z-axis respectively.
/RST : reset counter to zero
/INH : inhibit the counter data latch. This bit must be set 0 before read out the counter value to inhibit the counter data latch to DATA registers.
/SEL : to select low byte or high byte for reading the counter value.
0 : low byte
1 : high byte
S1, S0 : to select counting mode
00 : quadrant counting mode
A
B counter 1 2 3 4 5 6
Quadrant Counting Mode
Fig(2) Quadrant counting mode
01 : CW/CCW counting mode http://www.icpdas.com
1-6 ICPDAS
I-8090 User Manual Version 1.0 06/2001
CW
CCW counter
X2=0
1 2 3 2 1
CW/CCW Counting Mode
Fig(3) CW/CCW counting mode
10 : Pulse/Direction counting mode
Pulse
Direction counter
X2=0
1 2 3 2
Pulse/Direction Counting Mode
1
Fig(4) Pulse/Direction counting mode
Example: assign counting mode x_mode=y_mode=z_mode=0x00; card[cardNo].ctrl1 = 0x07 | x_mode; card[cardNo].ctrl2 = 0x07 | y_mode; card[cardNo].ctrl3 = 0x07 | z_mode; outportb(card[cardNo].base + WR1, card[cardNo].ctrl1); outportb(card[cardNo].base + WR2, card[cardNo].ctrl2); outportb(card[cardNo].base + WR3, card[cardNo].ctrl3);
Example: read X-axis encoder value
card[cardNo].ctrl1 &= 0xFC; //1111 1100 low byte
outportb(card[cardNo].base + WR1, card[cardNo].ctrl1);
value = inportb(card[cardNo].base + RD1);
card[cardNo].ctrl1 |= 0x01; //0000 0001 high byte
outportb(card[cardNo].base + WR1, card[cardNo].ctrl1);
value += inportb(card[cardNo].base + RD1)*256;
card[cardNo].ctrl1 |= 0x03; //0000 0011
outportb(card[cardNo].base + WR1, card[cardNo].ctrl1); http://www.icpdas.com
1-7 ICPDAS
I-8090 User Manual
1.3 LED Indicator
power
Version 1.0 06/2001
1A 1B 1C 2A 2B 2C
3A
3B
Fig(5) I-8090 LED indicator
Where
1A, 1B, 1C indicate X-axis’s 1A+/1A-, 1B+/1B-, 1C+/1C- signal input.
2A, 2B, 2C indicate Y-axis’s 2A+/2A-, 2B+/2B-, 2C+/2C- signal input.
3A, 3B, indicate Z-axis’s 3A+/3A-, 3B+/3B- signal input.
http://www.icpdas.com
1-8 ICPDAS
I-8090 User Manual
1.4 Connection
Version 1.0 06/2001
1A+
1A-
1B+
1B-
1C+
1C-
E5V
EGND
2A+
2A-
2B+
2B-
2C+
2C-
E5V
EGND
3A+
3A-
3B+
3B-
3C+
3C-
E5V
EGND
EGND
4
17
5
18
6
19
7
20
8
21
9
22
10
23
11
24
12
25
13
1
14
2
15
3
16
CN2
DB25M-90
Fig (6) Pin out of CN2 connector
Pin name
1A+
1A-
1B+
1B-
1C+
1C-
E5V
EGND
2A+
2A-
2B+
2B-
2C+
2Chttp://www.icpdas.com
1
Table of CN2 connector
Pin number description
A+ input of X-axis encoder
14 A- input of X-axis encoder
4
17
5
18
2
15
3
16
6
19
7
20
B+ input of X-axis encoder
B- input of X-axis encoder
C+ input of X-axis encoder
C- input of X-axis encoder
Isolated 5V supply, max. 50mA (sum of pin 4,8,12)
Signal ground
A+ input of Y-axis encoder
A- input of Y-axis encoder
B+ input of Y-axis encoder
B- input of Y-axis encoder
C+ input of Y-axis encoder
C- input of Y-axis encoder
1-9 ICPDAS
I-8090 User Manual
E5V
EGND
3A+
3A-
3B+
3B-
3C+
3C-
E5V
EGND
EGND
12
25
13
10
23
11
24
8
21
9
22
Version 1.0 06/2001
Isolated 5V supply, max. 50mA (sum of pin 4,8,12)
Signal ground
A+ input of Z-axis encoder
A- input of Z-axis encoder
B+ input of Z-axis encoder
B- input of Z-axis encoder
C+ input of Z-axis encoder
C- input of Z-axis encoder
Isolated 5V supply, max. 50mA (sum of pin 4,8,12)
Signal ground
Signal ground
Encoder
A+
A-
B+
B-
C+
C-
5V
GND
1A+
1A-
1B+
1B-
1C+
1C-
E5V
EGND
2A+
2A-
2B+
2B-
2C+
2C-
E5V
EGND
3A+
3A-
3B+
3B-
3C+
3C-
E5V
EGND
EGND
1
14
2
15
3
16
4
17
5
18
6
19
7
20
8
21
9
22
10
23
11
24
12
25
13
CN2
DB25M-90
Fig (7) Connection between encoder and I-8090 card http://www.icpdas.com
1-10 ICPDAS
I-8090 User Manual
Encoder
A+
B+
C+
5V
GND
Version 1.0 06/2001
1A+
1A-
1B+
1B-
1C+
1C-
E5V
EGND
2A+
2A-
2B+
2B-
2C+
2C-
E5V
EGND
3A+
3A-
3B+
3B-
3C+
3C-
E5V
EGND
EGND
22
10
23
11
24
12
25
13
7
20
8
21
9
1
14
2
15
3
16
4
17
5
18
6
19
CN2
DB25M-90
Fig (8) Connection between open collecter type encoder and I-8090 card
CW/PULSE
CCW/DIR
INDEX
1A+
1A-
1B+
1B-
1C+
1C-
E5V
EGND
2A+
2A-
2B+
2B-
2C+
2C-
E5V
EGND
3A+
3A-
3B+
3B-
3C+
3C-
E5V
EGND
EGND
16
4
17
5
18
6
19
1
14
2
15
3
22
10
23
11
24
12
25
13
7
20
8
21
9
CN2
DB25M-90
Fig (9) The connection for CW/CCW or Pulse/Direction counting mode http://www.icpdas.com
1-11 ICPDAS
I-8090 User Manual Version 1.0 06/2001
S5V
CW_PULSE1
CW_PULSE2
CCW_DIR1
CCW_DIR2
HOLD1
HOLD2
SGND
EXT_VCC
(12V~24V)
PHOME2
EXT_VCC
PHOME1
PLS11
PLS21
PLS14
PLS24
PEMG
EXT_GND
1
14
2
15
3
16
4
17
5
18
6
19
7
20
8
21
9
22
10
23
11
24
12
25
13
CN2
DB25M-90
S8091 card
1A+
1A-
1B+
1B-
1C+
1C-
E5V
EGND
2A+
2A-
2B+
2B-
2C+
2C-
E5V
EGND
3A+
3A-
3B+
3B-
3C+
3C-
E5V
EGND
EGND
1
14
2
15
3
16
4
17
5
18
6
19
7
20
8
21
9
22
10
23
11
24
12
25
13
CN2
DB25M-90
S8090 card
Fig (10) The connection between I-8090 and I-8091 for function testing or pulse feedback by I-8090 encoder card.
http://www.icpdas.com
1-12 ICPDAS
I-8090 User Manual Version 1.0 06/2001
2. Software _
User’s applications could be compiled under DOS Turbo/Borland C/C++ environment. It should be include i8090.h and i8090.LIB to compile the target execution file. The execution files can be downloaded under I-8000 main system (execute 7188x.exe), and then run the target execution file as under
PC system. About the I-8000’s resource or environment, please refer to the manual of I-8000 system or its software programming guide.
The following section will introduce the I-8090’s functions and examples.
2.1 constants and functions
Constants
#define YES 1
#define NO 0
#define ON 1
#define OFF 0
#define X_axis 1
#define Y_axis 2
#define Z_axis 3
#define ENC_QUADRANT 0x00
#define ENC_CW_CCW 0x10
#define ENC_PULSE_DIR 0x20
Functions
(1) unsigned char i8090_REGISTRATION(unsigned char cardNo, unsigned int address)
In order to distinguish more than one I-8090 card in I-8000 platform, the I-8090 cards should be registrated before using it. This command will assign a card number=“cardNo” to I-8090 card address=”address” .
If there is not I-8090 at the given address, this command will return
“NO”.
cardNo: 0~19, assign the address as which card.
http://www.icpdas.com
1-13 ICPDAS
I-8090 User Manual Version 1.0 06/2001 address: hardware address which defined at chapter 1.1
Return: “YES” : registration successful
“NO” : registration failure.
Example: This example will assign I-8090 card address=0x080 as
CARD1 (1). Then initial the I-8090 card and reset X,Y,Z axis encoder counter value to 0.
#define CARD1 1
… i8090_REGISTRATION(CARD1, 0x080); i8090_INIT_CARD(CARD1, ENC_QUADRANT, ENC_QUADRANT,
ENC_QUADRANT); i8090_RESET_ENCODER(CARD1, X_axis); i8090_RESET_ENCODER(CARD1, Y_axis); i8090_RESET_ENCODER(CARD1, Z_axis);
(2) void i8090_INIT_CARD(unsigned char cardNo,
unsigned char x_mode,
unsigned char y_mode,
unsigned char z_mode)
This command will reset all three axis’s counter value of “cardNo” card, and assign its counting mode. The counting mode (S1,S0) has been explained in registers XCTRL, YCTRL, ZCTRL.
cardNo: 0~19, select which card.
x_mode, y_mode, z_mode: select the counting mode.
0x00 : quadrant counting mode
0x10 : CW/CCW counting mode
0x20 : Pulse/Direction counting mode
Example:
#define ENC_QUADRANT 0x00
#define ENC_CW_CCW 0x10
#define ENC_PULSE_DIR 0x20 http://www.icpdas.com
1-14 ICPDAS
I-8090 User Manual Version 1.0 06/2001 i8090_INIT_CARD(CARD1, ENC_QUADRANT, ENC_QUADRANT,
ENC_QUADRANT);
(3) unsigned int i8090_GET_ENCODER(unsigned char cardNo, unsigned char axis)
This command will return the counter value of the selected “axis” and
“cardNo”.
cardNo: 0~19, select which card.
axis : select which axis.
1 : X-axis
2 : Y-axis
3 : Z-axis return : a 16 bits unsigned integer value.
(4) void i8090_RESET_ENCODER(unsigned char cardNo, unsigned char axis)
This command will reset the counter value of the selected “axis” and
“cardNo”.
cardNo: 0~19, select which card.
axis : select which axis.
1 : X-axis
2 : Y-axis
3 : Z-axis
(5) unsigned char i8090_GET_INDEX(unsigned char cardNo)
It will return the “INDEX” register’s value of the selected “cardNo” card.
cardNo: 0~19, select which card.
Register Add. R/W Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
INDEX 0x04 R ZI YI XI
The index input C+/C- can read out from this register. These bits are active high.
XI : indicate the index of X-axis.
YI : indicate the index of Y-axis.
ZI : indicate the index of Z-axis.
http://www.icpdas.com
1-15 ICPDAS
I-8090 User Manual Version 1.0 06/2001
32 bits encoder counts command sets
(6) void i8090_ENCODER32_ISR(unsigned char cardNo)
(7) void i8090_RESET_ENCODER32(unsigned char cardNo, unsigned char axis)
(8) long i8090_GET_ENCODER32(unsigned char cardNo, unsigned char axis) cardNo: 0~19, select which card.
axis : select which axis.
1 : X-axis
2 : Y-axis
3 : Z-axis
The above three commands provided a software method to get 32 bits encoder counts.
The i8090_ENCODER32_ISR(unsigned char cardNo) command calculates the difference pulse between present and last time, and then add this difference into a ”long type” variable. According to this idea, so, the i8090_ENCODER32_ISR() command should be executed periodically in 2~10ms by timer interrupt or manually call it.
The i8090_RESET_ENCODER32((unsigned char cardNo,
unsigned char axis) command can reset the “long type” variable to zero.
The long i8090_GET_ENCODER32(unsigned char cardNo,
unsigned char axis) command can return the value of the “long type” variable.
http://www.icpdas.com
1-16 ICPDAS
I-8090 User Manual
2.2 examples
2.2.1 Detect I-8090 card
//---------------------------------------------------
// detect i8090,i8091,i8092 card
//---------------------------------------------------
#include "8000.h"
#include "i8090.h"
Version 1.0 06/2001
#define i8090 0x0d
#define i8091 0x0e
#define i8092 0x0f
#define NOCARD 0x00
#define MAX_SLOT_NO 8 unsigned int PortAddress[8]={0x080, 0x0a0, 0x0c0, 0x0e0, 0x140, 0x160,
0x180, 0x1a0};
//--------------------------------------------------void main ()
{ unsigned char slot,temp;
for (slot=0; slot<MAX_SLOT_NO; slot++)
{
temp=inportb(PortAddress[slot]);
switch (temp)
{
case i8090: //i8090 3-axis encoder card
Print("Slot %d = i8090\r\n",SlotNum); return i8090;
case i8091: //i8091 2-axis stepping card
Print("Slot %d = i8091\r\n",SlotNum); return i8091;
case i8092: //i8092
Print("Slot %d = i8092\r\n",SlotNum); http://www.icpdas.com
1-17 ICPDAS
I-8090 User Manual return i8092;
default:
Print("Slot %d = No Card\r\n",SlotNum); return NOCARD;
};
Delay(500);
}
};
2.2.2 Start to use I-8090 card
#define CARD1 1
if (i8090_REGISTRATION(CARD1, PortAddress[0])==YES)
{
i8090_INIT_CARD(CARD1, ENC_QUADRANT, ENC_QUADRANT,
ENC_QUADRANT);
i8090_RESET_ENCODER(CARD1, X_axis);
i8090_RESET_ENCODER(CARD1, Y_axis);
i8090_RESET_ENCODER(CARD1, Z_axis);
}
else
{
Print(“ Not found I-8090 card in slot 0!”);
return;
}
2.2.3 Get X, Y, Z-axis encoder counter’s value
unsigned int i8090_GET_ENCODER(unsigned char cardNo, unsigned char
{ axis) unsigned int value;
switch (axis)
{
case X_axis: http://www.icpdas.com
1-18
Version 1.0 06/2001
ICPDAS
I-8090 User Manual Version 1.0 06/2001
card[cardNo].ctrl1 &= 0xFC; //1111 1100 low byte
outportb(card[cardNo].base + WR1, card[cardNo].ctrl1);
value = inportb(card[cardNo].base + RD1);
card[cardNo].ctrl1 |= 0x01; //0000 0001 high byte
outportb(card[cardNo].base + WR1, card[cardNo].ctrl1);
value += inportb(card[cardNo].base + RD1)*256;
card[cardNo].ctrl1 |= 0x03; //0000 0011
outportb(card[cardNo].base + WR1, card[cardNo].ctrl1);
break;
case Y_axis:
card[cardNo].ctrl2 &= 0xFC; //1111 1100 low byte
outportb(card[cardNo].base + WR2, card[cardNo].ctrl2);
value = inportb(card[cardNo].base + RD2);
card[cardNo].ctrl2 |= 0x01; //0000 0001 high byte
outportb(card[cardNo].base + WR2, card[cardNo].ctrl2);
value += inportb(card[cardNo].base + RD2)*256;
card[cardNo].ctrl2 |= 0x03; //0000 0011
outportb(card[cardNo].base + WR2, card[cardNo].ctrl2);
break;
case Z_axis:
card[cardNo].ctrl3 &= 0xFC; //1111 1100 low byte
outportb(card[cardNo].base + WR3, card[cardNo].ctrl3);
value = inportb(card[cardNo].base + RD3);
card[cardNo].ctrl3 |= 0x01; //0000 0001 high byte
outportb(card[cardNo].base + WR3, card[cardNo].ctrl3);
value += inportb(card[cardNo].base + RD3)*256;
card[cardNo].ctrl3 |= 0x03; //0000 0011
outportb(card[cardNo].base + WR3, card[cardNo].ctrl3); http://www.icpdas.com
1-19 ICPDAS
I-8090 User Manual
break;
default : break;
}
#define Insert 0x0000
#define BasePort 0x0080
#define SlotOffset 0x0020
#define IDPort 0x0000 http://www.icpdas.com
1-20
Version 1.0 06/2001
}
return value;
2.2.4 Software 32 bits encoder counter programming
//--------------------------------------------------------------------
// demo1.cpp for I-8090 card
// This program demostrates the software 32 bits encoder method by
// void i8090_ENCODER32_ISR(unsigned char cardNo);
// void i8090_RESET_ENCODER32(unsigned char cardNo, unsigned char axis);
// long i8090_GET_ENCODER32(unsigned char cardNo, unsigned char axis);
//--------------------------------------------------------------------
// v1.0 4/7/2001
//
//--------------------------------------------------------------------
#include <dos.h>
#include <math.h>
#include "8000.h"
#include "i8090.h"
#define i8090 0x0d
#define i8091 0x0e
#define i8092 0x0f
#define NOCARD 0x00
ICPDAS
I-8090 User Manual Version 1.0 06/2001
#define CARD1 1
#define CARD2 2
#define MAX_SLOT_NO 8 unsigned int PortAddress[8]={0x080, 0x0a0, 0x0c0, 0x0e0, 0x140, 0x160,
0x180, 0x1a0};
//-------------------------------------------------------------------long x_value; long y_value; long z_value; unsigned char index; unsigned char x_index; unsigned char y_index; unsigned char z_index; unsigned char i8090Slot;
//--------------------------------------------------------------------
//-------------------------------------------------------------------void ShowLedValue(long value,unsigned char axis)
{ long j; unsigned char negative_value;
if (value<0) negative_value=1;
else negative_value=0;
value=labs(value);
j=value-10*(value/10);
if (negative_value) Show5DigitLedWithDot(0x05, j);
else Show5DigitLed(0x05, j);
value=value/10;
j=value-10*(value/10); http://www.icpdas.com
1-21 ICPDAS
I-8090 User Manual
Show5DigitLed(0x04, j);
value=value/10;
j=value-10*(value/10);
if (axis==Z_axis) Show5DigitLedWithDot(0x03, j);
else Show5DigitLed(0x03, j);
value=value/10;
j=value-10*(value/10);
if (axis==Y_axis) Show5DigitLedWithDot(0x02, j);
else Show5DigitLed(0x02, j);
value=value/10;
j=value-10*(value/10);
if (axis==X_axis) Show5DigitLedWithDot(0x01, j);
}
else Show5DigitLed(0x01, j);
//---------------------------------------------------
{ void ShowCardName(unsigned char SlotNum) unsigned char temp;
Show5DigitLed(0x05, SlotNum);
temp=inportb(PortAddress[SlotNum]);
switch (temp)
{
case i8090: //i8090 3-axis encoder card
Show5DigitLedSeg (0x01, 0x7F);
Show5DigitLedSeg (0x02, 0x7E);
Show5DigitLedSeg (0x03, 0x7B);
Show5DigitLedSeg (0x04, 0x7E);
break;
case i8091: //i8091 2-axis stepping card
Show5DigitLedSeg (0x01, 0x7F);
Show5DigitLedSeg (0x02, 0x7E);
Show5DigitLedSeg (0x03, 0x7B);
Show5DigitLedSeg (0x04, 0x30); http://www.icpdas.com
1-22
Version 1.0 06/2001
ICPDAS
I-8090 User Manual
break;
default:
Show5DigitLedSeg (0x01, 0x01);
Show5DigitLedSeg (0x02, 0x01);
Show5DigitLedSeg (0x03, 0x01);
Show5DigitLedSeg (0x04, 0x01);
break;
};
}
//---------------------------------------------------
{ unsigned char CardSearch(unsigned char SlotNum) unsigned char temp;
Version 1.0 06/2001
temp=inportb(PortAddress[SlotNum]);
ShowCardName(SlotNum);
switch (temp)
{
case i8090: //i8090 3-axis encoder card
Print("Slot %d = i8090\r\n",SlotNum);
return i8090;
case i8091: //i8091 2-axis stepping card
Print("Slot %d = i8091\r\n",SlotNum);
return i8091;
default:
Print("Slot %d = No Card\r\n",SlotNum);
return NOCARD;
}
};
//--------------------------------------------------------------------------------void main ()
{ unsigned char j; http://www.icpdas.com
1-23 ICPDAS
I-8090 User Manual int key,ShowAxis;
i8090Slot=99;
for (j=0; j<MAX_SLOT_NO; j++)
{
if (CardSearch(j)==i8090) i8090Slot=j;
Delay(500);
};
if (i8090Slot==99)
{
Print("Not found i8090 card in 8 slot!\r\n");
return;
}
Version 1.0 06/2001
i8090_REGISTRATION(CARD1, PortAddress[i8090Slot]);
i8090_INIT_CARD(CARD1, ENC_QUADRANT, ENC_QUADRANT,
ENC_QUADRANT);
i8090_RESET_ENCODER(CARD1, X_axis);
i8090_RESET_ENCODER(CARD1, Y_axis);
i8090_RESET_ENCODER(CARD1, Z_axis);
i8090_RESET_ENCODER32(CARD1, X_axis);
i8090_RESET_ENCODER32(CARD1, Y_axis);
i8090_RESET_ENCODER32(CARD1, Z_axis);
Print("-----------------------------------------------------------------------\r\n");
Print(" i8090 DEMO1 program demo1.PRJ, demo1.cpp, i8090.lib
\r\n");
Print(" 32 bits encoder demostration \r\n");
Print("-----------------------------------------------------------------------\r\n");
Print("Press any key to stop...\r\n");
ClearSystemKey();
ShowAxis=0;
do http://www.icpdas.com
1-24 ICPDAS
I-8090 User Manual Version 1.0 06/2001
{
Delay(5); //delay 5ms
//---------------------------------------------------
// i8090_ENCODER32_ISR(CARD1) should be called in 2~10ms
// or call it by a timer interrupt service routine by 2~10ms
//---------------------------------------------------
i8090_ENCODER32_ISR(CARD1);
//---------------------------------------------------
x_value = i8090_GET_ENCODER32(CARD1, X_axis);
y_value = i8090_GET_ENCODER32(CARD1, Y_axis);
z_value = i8090_GET_ENCODER32(CARD1, Z_axis);
index = i8090_GET_INDEX(CARD1);
x_index = index & 0x01;
y_index = (index & 0x02) >> 1;
z_index = (index & 0x04) >> 2;
if (IsSystemKey())
{
key=GetSystemKey();
ClearSystemKey();
switch (key)
{
case SKEY_DOWN:
ShowAxis++;
if (ShowAxis>2) ShowAxis=0;
break;
case SKEY_UP:
ShowAxis--;
if (ShowAxis<0) ShowAxis=2;
break;
};
} http://www.icpdas.com
1-25 ICPDAS
I-8090 User Manual
switch (ShowAxis)
{
case 0: ShowLedValue(x_value,X_axis); break;
case 1: ShowLedValue(y_value,Y_axis); break;
case 2: ShowLedValue(z_value,Z_axis); break;
};
if (x_index) LedRunOff(); else LedRunOn();
if (y_index) LedCommOff(); else LedCommOn();
}
if (z_index) LedBattOff(); else LedBattOn();
} while (!Kbhit());
Version 1.0 06/2001 http://www.icpdas.com
1-26 ICPDAS
I-8091 User Manual Version 1.0 06/2001
I-8091
2-axis stepping/servo motor control card
User Manual
Version 1.0 06/2001 Edition
Warranty: All products manufactured by ICP DAS are warranted against defective materials for one year from the date of delivery to the original purchaser
Warning: ICP DAS assumes no liability for damage consequent to 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 it’s use, nor for any infringements of patents or other rights of third parties resulting from it’s use.
Copyright
Copyright 2001 by ICP DAS. All right are reserved
Trademark
The names used for identification only maybe registered trademarks of their respective companies.
http://www.icpdas.com
2-1 ICPDAS
I-8091 User Manual Version 1.0 06/2001
I-8091
2-axis Stepping/Servo Motor Control Card
The I-8091 card is a 2-axis command-type stepping motor control card on I-8000 platform, it also can be used as servo motor control (pulse input type). This card has an embedded CPU which performs motion commands transfered from I-8000 main system to increase the system performance. A
2Kbytes-FIFO is introduced as command buffer. This buffer can provide over
700ms buffer time.
A system including I-8000(main system), I-8091(2-axis stepping/servo control card), I-8090(3-axis encoder card) can be implemented as a stand along motion controller system for low cost automatical machine.
Features
! 2-axis independent, simultaneous stepping motor control / servo motor control (pulse input type).
! Maximum pulse rate: 1Mpps.
! Maximum step counts: 2 32 −
1 steps.
! command type interface.
! 2-axis linear, 2-axis circular interpolation.
! automatic trapezoidal acceleration / deceleration.
! output pulse modes : CW/CCW or pulse/direction.
! output polarity can be programmable.
! 2500Vrms optical isolated signal output.
! 3 optical isolated digital inputs per axis for limit switches.
! programmable limit switch initial condition as normal open(N.O.) or normal close(N.C.).
http://www.icpdas.com
2-2 ICPDAS
I-8091 User Manual Version 1.0 06/2001
I-8091 Contents _
1. Introduction 2-4
1.1 System Block Diagram
1.2 DDA technology
2. Hardware
2-4
2-5
2-8
2.1 I-8000 hardware address
2.2 Register of I-8091 board
2.3 LED indicator
2.4 Hardware configuration
2.4.1 Limit switch configuration
2.4.2 Output pulse mode configuration
2.4.3 Direction configuration
2.4.4 Turn Servo ON/OFF (Hold ON/OFF)
2.4.5 Automatic protection
2.4.6 Set limit switch as normal close condition
2.5 Connection
2.5.1 Pin assignment of connector CN2
2-12
2-13
2-14
2-14
2.5.2 The internal circuit of CW_PULSE, CCW_DIR, HOLD 2-15
2.5.3 The internal circuit of limit switch input 2-15
2.5.4 Example of connection
3. Software
2-16
2-18
3.1 Functions
3.1.1 Setting commands
3.1.2 Stop commands
3.1.3 Simple motion commands
3.1.4 Interpolation commands
2-18
2-20
2-24
2-25
2-30
2-8
2-9
2-10
2-11
2-11
2-12
2-12
2-12
3.1.5 Others
3.2 Start up and end of program
4. Example
4.1 Detect I-8091 card
4.2 Example: DEMO.cpp
4.3 Example: DEMO1.cpp
2-35
2-37
2-39
2-39
2-40
2-40 http://www.icpdas.com
2-3 ICPDAS
I-8091 User Manual Version 1.0 06/2001
1. Introduction _
1.1 System Block Diagram
The I-8091 stepping motor control card is a micro-computer controlled, 2-axis pulse generation card. It includes a 2Kbytes-FIFO to receive motion command from host, a micro-computer for profile generation and protection, 2-axis DDA chip to execute DDA function when interpolation command is used, 2500Vrms optical isolation inserted for industrial application.
2K FIFO
Interface
CPU
Profile Generation
Protection
DDA Chip
X-axis
Bus
DDA Chip
Y-axis
Limit Switch
Input Port
Limit Switch
Input Port
Limit Switch Signal
Fig.(1) block diagram of I-8091 card
Optical
Isolation
Connector http://www.icpdas.com
2-4 ICPDAS
I-8091 User Manual Version 1.0 06/2001
1.2 DDA Technology
The DDA chip is the heart of I-8091 card, it will generate equal-space pulse train corresponding to specific pulse number during a DDA period.
This mechanism is very useful to execute pulse generation and interpolation function. The DDA period can be determined by DDA cycle.
Table(1) shows the relation among DDA cycle, DDA period and output pulse rate. When DDA cycle set to 1, the DDA period is equal to
(1+1)x1.024ms = 2.048ms. The output pulse number can be set to 0~2047, therefore the maximum output pulse rate will be 1Mpps. The minimum output pulse rate is 3.83pps when set DDA cycle=254 (DDA period =
(254+1)x1.024ms = 261.12ms).
DDA period
DDA cycle
X pulse = 3
Y pulse = 6
Z pulse = 4
Fig.(2) DDA mechanism
Table(1) The Relation among DDA cycle, DDA period and output pulse rate.
DDA cycle DDA period Max. pulse rate(n=2047)
Min. pulse rate (n=1)
1
2
3
2.048ms
3.072ms
4.096ms
999511pps
666341pps
.
488pps
325pps
.
.
N
.
254
.
(N+1)*1.024ms
2047/(DDA period)
.
261.12ms
.
.
7839pps
.
1/(DDA period)
.
3.83pps
The DDA cycle can be set by i8091_SET_VAR() command which decribed in charpter 3. The selection criterion of DDA cycle was described as following.
http://www.icpdas.com
2-5 ICPDAS
I-8091 User Manual Version 1.0 06/2001
(1) The required max. output pulse rate.
PRmax = Vmax*N/60
PRmax =
( DDAcycle
2047
+
1 1 024 ms
PRmax : max. output pulse rate.
Vmax : max. speed (rpm).
N : the pulse number of stepping motor per revolution.
(pulse/rev).
2. The required speed resolution.
The maximum output pulse number is Np(0~2047), therefore the speed resolution is Vmax(max. speed)/Np. The DDA cycle can be obtained by following equation.
PRmax =
( DDAcycle
Np
+
1 ) * .
ms
3. When choose large DDA cycle (DDA period), it will occur vibration between different pulse input which generally can be observed during acceleration or deceleration. So, the small
DDA cycle , the smooth acceleration/deceleration curve as long as the speed resolution is acceptable.
Example: Stepping Motor
The specification of stepping motor is 500 pulse/rev, max. speed 500 rpm, speed resolution 2 rpm.
The required max. pulse rate
PRmax = 500 rpm*500/60 = 4166.67 pps
The maximum output pulse
Np = 500rpm/2rpm =250 pulse number
The DDA cycle can be calculated by follow equation
PRmax = ( DDAcycle
Np
+
1 ) * .
ms
4166.67 = ( DDAcycle
250
+
1 1 024 ms
DDA cycle = 58 http://www.icpdas.com
2-6 ICPDAS
I-8091 User Manual Version 1.0 06/2001
High Speed = 247 pulse (4166.67*58*0.001024)
The above results means that maximum speed is 500rpm when send command i8091_SET_VAR(0, 58, 2, 2, 247) to I-8091 card.
Example: Pulse type input Servo Motor
The specification of servo motor is 8000 pulse/rev, max. speed 3000 rpm, speed resolution 2 rpm.
The required max. pulse rate
PRmax = 3000 rpm*8000/60 = 400,000 pps
The maximum output pulse
Np = 3000rpm/2rpm =1500 pulse number
The DDA cycle can be calculated by follow equation
PRmax =
( DDAcycle
Np
+
1 ) * .
ms
400,000 =
( DDAcycle
1500
+
1 1 024 ms
DDA cycle = 3
High Speed = 1638 pulse (400,000*4*0.001024)
The above results means that maximum speed is 3000rpm when send command i8091_SET_VAR(0, 3, 2, 2, 1638) to I-8091 card.
http://www.icpdas.com
2-7 ICPDAS
I-8091 User Manual Version 1.0 06/2001
2 Hardware _
2.1 I-8000 hardware address
The hardware address of I-8000 main system is fixed as following table.
There are 4 slots I-8000 and 8 slots I-8000.
I-8000, 4 slot address
I-8000, 8 slot address
Slot 1 Slot 2 Slot 3 Slot 4 Slot 5 Slot 6 Slot 7 Slot 8
0x080 0x0A0 0x0C0 0x0E0 ---------
0x080 0x0A0 0x0C0 0x0E0 0x140 0x160 0x180 0x1A0
Slot 1 Slot 2 Slot 3 Slot 4
88888
I-8000, 4 slots
I-8000, 8 slots
88888
Slot 1 Slot 2 Slot 3 Slot 4 Slot 5 Slot 6 Slot 7 Slot 8
Fig.(3) I-8000 hardware address http://www.icpdas.com
2-8 ICPDAS
I-8091 User Manual
2.2 Registers of I-8091 board
The I-8091 card’s registers table as following.
Version 1.0 06/2001
Register Add. R/W Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
ID 0x00 R 0x0E
LIMIT1 0x01 R /EMG /FFFF /FFEF /LS14
LIMIT2 0x02 R
WRFF 0x01 W
/YSTOP /XSTOP /LS24
Command port
/LS11 /ORG1
/LS21 /ORG2
RSTFF 0x02 W Reset FIFO
Register Add. R/W Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1
ID 0x00 R 0x0E
The ID register is read only and its value is fixed as 0x0E. User can check this register to identify I-8091 card or not.
Bit 0
Register Add. R/W Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
LIMIT1 0x01 R /EMG /FFFF /FFEF /LS14 /LS11 /ORG1
/ORG1 : original point limit switch of X-axis.
/LS11, /LS14 : limit switches of X-axis, which must be configured as chapter
2.4.1.
/EMG : emergency switch.
/FFEF : active low, indicate FIFO is empty.
/FFFF : active low, indicate FIFO is full.
Register Add. R/W Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
LIMIT2 0x02 R /YSTOP /XSTOP /LS24 /LS21 /ORG2
/ORG2 : original point switch of Y-axis.
/LS21, /LS24 : limit switches of Y-axis, which must be configured as chapter
2.4.1.
/XSTOP, /YSTOP : These signals indicate the operating situation of X, Y axis in CPU.
1 : busy, 0 : stop
The commands i8091_WAIT_X( ) and i8091_WAIT_Y( ) just to waiting for http://www.icpdas.com
2-9 ICPDAS
I-8091 User Manual
'/XSTOP' or '/YSTOP' signal become to '0'.
Version 1.0 06/2001
Register Add. R/W Bit 7
WRFF 0x01 W
Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1
Command port
Bit 0
I-8091 driver will send motion command by way of this register. Please do not use this register to write any thing, or I-8091 will not operate properly.
Register Add. R/W Bit 7
RSTFF 0x02 W
Bit 6 Bit 5 Bit 4
Reset FIFO
Bit 3 Bit 2 Bit 1
This register is used to reset FIFO for clear all of commands pending in the
FIFO buffer.
Bit 0
2.3 LED Indicator
power
/ORG1 /LS11 /LS14 /ORG2 /LS21 /LS24 /EMG
Fig.(4) I-8091 LED indicator
Where
/ORG1: X-axis’s original limit switch for machine home position.
/LS11, /LS14 : X-axis’s negative and positive limit switches.
/ORG2: Y-axis’s original limit switch for machine home position.
/LS21, /LS24 : Y-axis’s negative and positive limit switches.
/EMG : system’s emergency signal input.
http://www.icpdas.com
2-10 ICPDAS
I-8091 User Manual Version 1.0 06/2001
2.4 Hardware Configuration
2.4.1 Limit switch configuration
Because the profile generation and protection is executed by the CPU on I-8091 card, the limit switches must configure as following diagram.
The motion command just can work properly.
CCW/BW CW/FW
Motor ccm
LS11 ORG1
/LS11
/ORG1
/LS14
EXT_GND
/EMG
X axis
Emer gency
Fig.(5) Limit switch configuration of X axis
CCW/BW CW/FW
Motor
LS14 ccm
LS21 ORG2 LS24
/LS21
/ORG2
/LS24
EXT_GND
Y axis
Fig.(6) Limit switch configuration of Y axis http://www.icpdas.com
2-11 ICPDAS
I-8091 User Manual Version 1.0 06/2001
2.4.2 Output pulse mode configuration
I-8091 card provide two kind output method.
(a) CW/CCW mode
(b) Pulse/Direction mode
The command i8091_SET_MODE(cardNo, modeX, modeY) provide parameters CW_CCW (0) and PULSE_DIR (1) to define output pulse mode.
Mode = 0 (CW_CCW)
CW
CCW
Pulse
Mode = 1 (PULSE_DIR)
Direction
Fig.(7) Output pulse mode
2.4.3 Direction configuration
Sometimes, the output direction of X-axis, Y-axis is not in the desired direction due to the motor’s connection or gear train. It is recommended to unify the output direction as shown in Figure(5)(6). The
CW/FW direction is defined as toward outside from motor and the
CCW/BW direction is defined as toward inside to motor. The i8091_SET_DEFDIR(cardNo, defdirX, defdirY) command provides parameters NORMAL_DIR (0) and REVERSE_DIR (1) to define the rotating direction of motor.
2.4.4 Turn Servo ON/OFF (Hold ON/OFF)
To turn servo motor into servo ON(OFF) state, or turn stepping motor into hold ON(OFF) state, the command i8091_SET_SERVO_ON(cardNo, sonX, sonY) provide parameters ON (1) and OFF (0) to turn ON or OFF.
2.4.5 Automatic protection
The I-8091 card has a automatic protected system.
(a) If X-aixs command is executing and moving toward CW/FW direction, http://www.icpdas.com
2-12 ICPDAS
I-8091 User Manual Version 1.0 06/2001
X-axis will immediately stop when LS14 is touched. To release this protection as long as X-axis move toward CCW/BW direction.
(b) If X-aixs command is executing and moving toward CCW/BW direction, X-axis will immediately stop when LS11 is touched. To release this protection as long as X-axis move toward CW/FW direction.
(c) If Y-aixs command is executing and moving toward CW/FW direction,
Y-axis will immediately stop when LS24 is touched. To release this protection as long as Y-axis move toward CCW/BW direction.
(d) If Y-aixs command is executing and moving toward CCW/BW direction, Y-axis will immediately stop when LS21 is touched. To release this protection, as long as Y-axis move toward CW/FW direction.
(e) If the signal of the emergency limit switch /EMG was found in CPU firmware, all motion will be terminated and stop.
2.4.6 Set limit switch as normal close condition
The limit switches /EMG, /LS11, /LS14, /LS21, /LS24, /ORG1, /ORG2 is initially normal open condition, that is, these signal is active when connect it to ground. In industrial application, it might be recommended normal close condition, that is, these signal is active when open from ground.
The i8091_SET_NC(cardNo, sw) command can be set sw=0 (default), for normal open condition. When set sw=1, for normal close condition.
http://www.icpdas.com
2-13 ICPDAS
I-8091 User Manual
2.5 Connection
2.5.1 Pin assignment of connector CN2
CW_PULSE2
CCW_DIR2
HOLD2
ORG2
LS21
LS24
+5V
CW_PULSE1
CCW_DIR1
HOLD1
GND
EXT_VCC (12~24V)
ORG1
LS11
LS14
EMG
EXT_GND
Fig.(8) CN2 connector
3
16
4
17
5
18
6
19
1
14
2
15
7
20
8
21
9
22
10
23
11
24
12
25
13
CN2
DB25M-90
Version 1.0 06/2001 pin name
+5V
CW_PULSE1
CCW_DIR1
HOLD1
GND
EXT_VCC
/ORG1
/LS11
/LS14
/EMG
EXT_GND
+5V
CW_PULSE2
CCW_DIR2
HOLD2
GND
Table of CN2 connector’s pin assignment pin number
Description
7
8
5
6
3
4
1
2
Internal +5V power, Max. output current: 50mA
X-axis CW (Pulse) output pin
X-axis CCW (Direction) output pin
X-axis HOLD (servo on) output pin
Signal ground of pin 2,3,4
External power(12~24V) for limit switches
X-axis original (home) limit switch
X-axis limit switch
9,10 No used
11 X-axis limit switch
12 Emergency input
13 External ground for limit switch
14 Internal +5V power, Max. output current: 50mA
15 Y-axis CW (Pulse) output pin
16 Y-axis CCW (Direction) output pin
17 Y-axis HOLD (servo on) output pin
18 Signal ground of pin 15,16,17 http://www.icpdas.com
2-14 ICPDAS
I-8091 User Manual Version 1.0 06/2001
EXT_VCC
/ORG2
/LS21
/LS24
EXT_GND
19 External power(12~24V) for limit switches
20 Y-axis original (home) limit switch
21 Y-axis limit switch
22,23 No used
24 Y-axis limit switch
25 External ground for limit switch
2.5.2 The internal circuit of CW_PULSE, CCW_DIR, HOLD
When output these signal as 1, it can source 15mA(max.).
When output these signal as 0, it can sink 50mA(max.)
+5V
330
CW_PULSE1
CCW_DIR1
HOLD1
CW_PULSE2
CCW_DIR2
HOLD2 i8091
Fig.(9) internal circuit of pulse output pin
2.5.3 The internal circuit of limit switch input
Initially, the limit switch inputs of I-8091 board are normal open (N.O.), the I-8091 board will automatic protect when limit switch pin connect to EXT_GND. The user can use the command i8091_SET_NC
(cardNo, YES) to let those limit switch input as normal close condition at the beginning of the user’s program.
EXT_VCC (12V~24V)
4.7K
/ORG1, /LS11, /LS14
/ORG2, /LS21, /LS24
/EMG i8091
Fig.(10) internal circuit of limit switch input pin http://www.icpdas.com
2-15 ICPDAS
I-8091 User Manual
2.5.4 Example of connection
Version 1.0 06/2001
1
3
1
3
1
3
+5V
6
5
4
CW_PULSE1 CW +
CW -
1
2
4
3
+5V
6
5
4
CCW_DIR1 CCW +
CCW -
1
2
4
3
+5V
6
5
4
HOLD1
GND
HOLD +
HOLD -
1
2
4
3
DGND FAN-OUT TYPE (VEXTA) DRIVER
Fig.(11) fan-out type driver (VEXTA's motor driver)
1
3
1
3
1
3
+5V
6
5
4
6
5
4
+5V
6
5
4
+5V
DGND
CW_PULSE1
CCW_DIR1
COM
CW/PULSE
CCW/DIR
1
2
4
3
1
2
4
3
1
2 HOLD1
GND
HOLD
SINK TYPE DRIVER
Fig.(12) Sink type driver
4
3 http://www.icpdas.com
2-16 ICPDAS
I-8091 User Manual Version 1.0 06/2001
S5V
CW_PULSE1
CW_PULSE2
CCW_DIR1
CCW_DIR2
HOLD1
HOLD2
SGND
EXT_VCC
(12V~24V)
PHOME2
EXT_VCC
PHOME1
PLS11
PLS21
PLS14
PLS24
PEMG
EXT_GND
18
6
19
7
20
8
21
9
22
10
23
11
24
12
25
13
1
14
2
15
3
16
4
17
5
CN2
DB25M-90
S8091 card
1A+
1A-
1B+
1B-
1C+
1C-
E5V
EGND
2A+
2A-
2B+
2B-
2C+
2C-
E5V
EGND
3A+
3A-
3B+
3B-
3C+
3C-
E5V
EGND
EGND
18
6
19
7
20
8
21
9
22
10
23
11
24
12
25
13
1
14
2
15
3
16
4
17
5
CN2
DB25M-90
S8090 card
Fig.(13) The connection between I-8090 and I-8091 for function testing or pulse feedback by I-8090 encoder card.
http://www.icpdas.com
2-17 ICPDAS
I-8091 User Manual Version 1.0 06/2001
3. Software _
User’s applications could be compiled under DOS Turbo/borland C/C++ environment. It should be include i8091.h and i8091.LIB to compile the target execution file. The execution files can be downloaded under I-8000 main system (execute 7188x.exe), and then run the target execution file as under
PC system. About the I-8000’s resource or environment, please refer to the manual of I-8000 system or its software programming guide.
The following section will introduce the I-8091’s functions and examples.
3.1 Functions
Constants
#define i8091
#define YES
#define NO
#define READY
#define BUSY
#define ON
#define OFF
#define CW_CCW
#define PULSE_DIR
#define NORMAL_DIR 0
#define REVERSE_DIR 1
0
1
1
0
0
1
#define FW
#define BW
#define CW
#define CCW
#define X_axis
#define Y_axis
#define Z_axis
1
2
3
0
1
0
1
0x0e
1
0
I-8091 card is a automatic protected system.
(a) If X-aixs command is executing and moving toward CW/FW direction,
X-axis will immediately stop when LS14 is touched. To release this protection as long as X-axis move toward CCW/BW direction.
http://www.icpdas.com
2-18 ICPDAS
I-8091 User Manual Version 1.0 06/2001
(b) If X-aixs command is executing and moving toward CCW/BW direction, X-axis will immediately stop when LS11 is touched. To release this protection as long as X-axis move toward CW/FW direction.
(c) If Y-aixs command is executing and moving toward CW/FW direction,
Y-axis will immediately stop when LS24 is touched. To release this protection as long as Y-axis move toward CCW/BW direction.
(d) If Y-aixs command is executing and moving toward CCW/BW direction, Y-axis will immediately stop when LS21 is touched. To release this protection, as long as Y-axis move toward CW/FW direction.
http://www.icpdas.com
2-19 ICPDAS
I-8091 User Manual Version 1.0 06/2001
3.1.1 Setting commands
(1) unsigned char i8091_REGISTRATION(unsigned char cardNo, unsigned int address);
In order to distinguish more than one I-8091 card in I-8000 platform, the
I-8091 cards should be registrated before using it. This command will assign a card number=“cardNo” to I-8091 card address=”address” . If there is not I-8091 at the given address, this command will return “NO”.
cardNo : board number 0~19.
address : select the address as well as hardware selected in chapter 2.1.
return NO : board not exist
YES : board exist
Example:
i8091_REGISTRATION(1, 0x080);
(2) i8091_RESET_SYSTEM( unsigned char cardNo )
To reset I-8091 card, this command will terminate the running command in
I-8091 card. User can use this command as software emergency stop.
i8091_RESET_SYSTEM command also will clear all of setting, so, all I-
8091 card’s parameter should be set again.
cardNo : board number 0~19.
(3) i8091_SET_VAR(unsigned char cardNo, unsigned char DDA_cycle, unsigned char Acc_Dec, unsigned int Low_Speed, unsigned int High_Speed) to set DDA cycle, accelerating/decelerating speed, low speed and high speed value.
cardNo : board number 0~19.
Acc_Dec
High_Speed
Acc_Dec
Low_Speed http://www.icpdas.com
2-20 ICPDAS
I-8091 User Manual
Restriction:
1
≤
1
≤
1
≤
≤
254
≤
200
≤
200
_
≤
_
Low_Speed >= Acc_Dec default value
DDA_cycle = 10
Acc_Dec = 1
Low_Speed = 10
High_Speed = 100
≤
2047
Example:
i8091_SET_VAR(1, 5, 2, 10, 150);
Version 1.0 06/2001 where
DDA_cycle = 5
Acc_Dec = 2
Low_Speed = 10
--> DDA period = (5+1)*1.024ms = 6.144ms
--> Acc/Dec speed = 2/(6.144ms)^2 = 52981 p/s^2
--> low speed = 10/6.144ms = 1628pps
High_Speed = 150 --> high speed = 150/6.144ms = 24414pps
(4) i8091_SET_DEFDIR(unsigned char cardNo, unsigned char defdirX, unsigned char defdirY)
Sometimes, the output direction of X-axis, Y-axis is undesired direction due to the motor’s connection or gear train. In oder to unify the output direction as shown in Fig.(5) and Fig.(6). Where CW/FW direction is defined as toward outside from motor, CCW/BW direction is defined as toward inside from motor. i8091_SET_DEFDIR( ) command provide parameters to define the rotating direction of motor.
cardNo : board number 0~19.
defdirX : X axis direction definition defdirY : Y axis direction definition
0 : NORMAL_DIR http://www.icpdas.com
2-21 ICPDAS
I-8091 User Manual
1 : REVERSE_DIR
(5) i8091_SET_MODE(unsigned char cardNo, unsigned char modeX, unsigned char modeY)
I-8091 card provide two kind output method.
cardNo : board number 0~19.
modeX : X axis output mode modeY : Y axis output mode
0 : CW_CCW
1 : PULSE_DIR
CW/CCW mode
Pulse/Direction mode
Mode = 0 (CW_CCW)
CW
CCW
Pulse
Mode = 1 (PULSE_DIR)
Direction
Example: i8091_SET_MODE(1,CW_CCW, PULSE_DIR);
Version 1.0 06/2001
(6) i8091_SET_SERVO_ON(unsigned char cardNo, unsigned char sonX, unsigned char sonY)
To turn servo motor into servo ON(OFF) state, or turn stepping motor into hold ON(OFF) state.
cardNo : board number 0~19.
sonX : X axis servo/hold on switch sonY : Y axis servo/hold on switch
1 : ON
0 : OFF
(7) i8091_SET_NC(unsigned char cardNo, unsigned char sw);
To set all of the following limit switches as N.C.(normal close) or
N.O.(normal open). If set as N.O., those limit switches are active low. If http://www.icpdas.com
2-22 ICPDAS
I-8091 User Manual Version 1.0 06/2001 set as N.C., those limit switches are active high. The auto-protection will automatically change the judgement whatever it is N.O. or N.C..
Limit switches: ORG1, LS11, LS14, ORG2, LS21, LS24, EMG.
cardNo : card number 0~19.
sw: 0(NO) normal open (default).
1(YES) normal close.
http://www.icpdas.com
2-23 ICPDAS
I-8091 User Manual
3.1.2 Stop Commands
Version 1.0 06/2001
(8) i8091_STOP_X(unsigned char cardNo) to stop X axis.
cardNo : board number 0~19.
(9) i8091_STOP_Y(unsigned char cardNo) to stop Y axis.
cardNo : board number 0~19.
(10) i8091_STOP_ALL(unsigned char cardNo) to stop X, Y axis immediatly.
cardNo : board number 0~19.
This command will clear all of commands pending in the FIFO.
The i8091_RESET_SYSTEM can be used as software emergency stop.
The i8091_RESET_SYSTEM command will terminate the running command and clear all of setting, so, all I-8091 card’s parameter should be set again after call i8091_RESET_SYSTEM command.
(11) i8091_EMG_STOP(unsigned char cardNo);
This function is the same as i8091_STOP_ALL(), but i8091_ EMG_STOP() only can be used in interrupt routine.
cardNo : card number 0~19.
This command will clear all of commands pending in the FIFO.
The i8091_RESET_SYSTEM can be used as software emergency stop.
The i8091_RESET_SYSTEM command will terminate the running command and clear all of setting, so, all I-8091 card’s parameter should be set again after call i8091_RESET_SYSTEM command.
http://www.icpdas.com
2-24 ICPDAS
I-8091 User Manual
3.1.3 Simple motion commands
Version 1.0 06/2001
(12) i8091_LSP_ORG(unsigned char cardNo,
unsigned char DIR, unsigned char AXIS)
Low speed move , and stop when ORG1/ORG2 limit switch is touched.
cardNo : board number 0~19.
ORG
Low speed
Example:
i8091_LSP_ORG(1, CCW, X_axis);
i8091_LSP_ORG(1, CCW, Y_axis);
(13) i8091_HSP_ORG(unsigned char cardNo, unsigned char DIR,
unsigned char AXIS)
High speed move , and stop when ORG1/ORG2 limit switch is touched.
cardNo : board number 0~19.
ORG high speed
Example:
i8091_HSP_ORG(1, CCW, X_axis);
i8091_HSP_ORG(1, CCW, Y_axis);
(14) i8091_LSP_PULSE_MOVE(unsigned char cardNo, unsigned char AXIS, long pulseN)
Low speed move #pulseN cardNo : board number 0~19.
#pulseN
Example:
i8091_LSP_PULSE_MOVE(1, X_axis, 20000); http://www.icpdas.com
2-25 ICPDAS
I-8091 User Manual
i8091_LSP_PULSE_MOVE(1, X_axis, -2000);
i8091_LSP_PULSE_MOVE(1, Y_axis, 20000);
i8091_LSP_PULSE_MOVE(1, Y_axis, -2000);
Version 1.0 06/2001 where when pulseN>0, move toward CW/FW direction when pulseN<0, move toward CCW/BW direction
(15) i8091_HSP_PULSE_MOVE(unsigned char cardNo, unsigned char AXIS, long pulseN)
High speed move #pulseN.
cardNo : board number 0~19.
high speed
#pulseN
Example:
i8091_HSP_PULSE_MOVE(1, X_axis, 20000);
i8091_HSP_PULSE_MOVE(1, X_axis, -2000);
i8091_HSP_PULSE_MOVE(1, Y_axis, 20000);
i8091_HSP_PULSE_MOVE(1, Y_axis, -2000); where when pulseN>0, move toward CW/FW direction when pulseN<0, move toward CCW/BW direction
(16) i8091_LSP_MOVE(unsigned char cardNo, unsigned char DIR, unsigned char AXIS)
Low speed move toward direction DIR. It can be stop by i8091_STOP_X or i8091_STOP_Y or i8091_STOP_ALL command.
cardNo : board number 0~19.
http://www.icpdas.com
2-26 ICPDAS
I-8091 User Manual Version 1.0 06/2001
Low speed
Example:
i8091_LSP_MOVE(1, CW, X_axis);
getch( );
i8091_STOP_X(1);
i8091_LSP_MOVE(1, CCW, Y_axis);
getch( );
i8091_STOP_Y(1);
(17) i8091_HSP_MOVE(unsigned char cardNo, unsigned char DIR, unsigned char AXIS)
High speed move toward direction DIR. It can be stop by i8091_STOP_X or i8091_STOP_Y or i8091_STOP_ALL command.
cardNo : board number 0~19.
high speed
Example:
i8091_HSP_MOVE(1, CW, X_axis);
getch( );
i8091_STOP_X(1);
i8091_HSP_MOVE(1, CCW, Y_axis);
getch( );
i8091_STOP_Y(1);
(18) i8091_CSP_MOVE(unsigned char cardNo, unsigned char dir, unsigned char axis, unsigned int move_speed)
This command will accelerate/decelerate the selected axis’s motor to the
“move_speed”. This command can be continuously send to I-8091 to dynamicly change speed. The rotating motor can be stop by the http://www.icpdas.com
2-27 ICPDAS
I-8091 User Manual Version 1.0 06/2001 command i8091_STOP_X(), i8091_STOP_Y(), i8091_STOP_ALL(), or i8091_SLOW_STOP().
cardNo : board number 0~19.
axis : selected axis.
1 : X axis
2 : Y axis dir : moving direction.
0 : CW
1 : CCW
0 < move_speed <= 2040 move speed
Acc_Dec
Example:
i8091_CSP_MOVE(1, CW, X_axis, 10);
delay(10000);
i8091_CSP_MOVE(1, CW, X_axis, 20);
delay(10000);
i8091_CSP_MOVE(1, CW, X_axis, 30);
delay(10000);
(19) i8091_SLOW_DOWN(unsigned char cardNo, unsigned char AXIS) to decelerate to slow speed until i8091_STOP_X( ) or i8091_STOP_Y() or i8091_STOP_ALL is executed.
SLOW_DOWN
Example:
i8091_HSP_MOVE(1, CW, X_axis); http://www.icpdas.com
2-28 ICPDAS
I-8091 User Manual
getch( );
i8091_SLOW_DOWN(1, X_axis);
getch( );
i8091_STOP_X(1);
Version 1.0 06/2001
(20) i8091_SLOW_STOP(unsigned char cardNo, unsigned char AXIS) to decelerate to stop.
cardNo : board number 0~19.
SLOW_STOP
Example:
i8091_HSP_MOVE(1, CW, Y_axis);
getch( );
i8091_SLOW_STOP(1, Y_axis); http://www.icpdas.com
2-29 ICPDAS
I-8091 User Manual Version 1.0 06/2001
3.1.4 Interpolation commands
(21) i8091_INTP_PULSE(unsigned char cardNo, int Xpulse, int Ypulse)
This command will move a short distance (interpolation short line) in X-Y plane. This command provided a method for user to generate an arbitrary curve in X-Y plane.
Y Y
10
(Xpulse,Ypulse)
X
2
3 4
5
6 7
8
9
1
X cardNo : board number 0~19.
Restriction:
−
2047
≤
# Xpulse
≤
2047
−
2047
≤
#Ypulse
≤
2047
Example:
i8091_INTP_PULSE(1,20,20);
i8091_INTP_PULSE(1,20,13);
i8091_INTP_PULSE(1,20,7);
i8091_INTP_PULSE(1,20,0);
i8091_INTP_PULSE(1,15,-5);
(22) i8091_INTP_LINE(unsigned char cardNo, long Xpulse, long Ypulse)
This command will move a long distance (interpolation line) in X-Y plane.
The CPU on I-8091 card will generate a trapezoidal speed profile of X-axis and Y-axis, and execute interpolation by way of DDA chip.
Y
(Xpulse,Ypulse)
X
(0,0) cardNo : board number 0~19.
http://www.icpdas.com
2-30 ICPDAS
I-8091 User Manual
Restriction:
−
524287
≤
# Xpulse
≤
524287
−
524287
≤
#Ypulse
≤
524287
Example:
i8091_INTP_LINE(1,2000,-3000);
i8091_INTP_LINE(1,-500,200);
Version 1.0 06/2001
(23) i8091_INTP_LINE02(unsigned char cardNo, long x, long y
, unsigned int speed
, unsigned char acc_mode)
This command will move a long interpolation line in X-Y plane. Host will automaticly generate a trapezoidal speed profile of X-axis and Y-axis by state-machine-type calculation method. The i8091_INTP_LINE02() only set parameters into the driver. User can directly call the do { } while
(i8091_INTP_STOP( ) !=READY) to execute the computing entity.
cardNo : board number 0~19.
speed : 0~2040 acc_mode: 0: enable acceleration and deceleration profile
1: disable acceleration and deceleration profile
Y
(X,Y)
X
(0,0)
Example:
i8091_INTP_LINE02(CARD1,1000,1000,100,0); do { } while( i8091_INTP_STOP()!=READY) ; //call state machine
(24) i8091_INTP_CIRCLE02(unsigned char cardNo, long x, long y,
unsigned char dir, unsigned int speed,
unsigned char acc_mode)
This command will generate an interpolation circle in X-Y plane. Host will http://www.icpdas.com
2-31 ICPDAS
I-8091 User Manual Version 1.0 06/2001 automaticly generate a trapezoidal speed profile of X-axis and Y-axis by state-machine-type calculation method. The i8091_INTP_CIRCLE02() only set parameters into the driver. User can directly call the do { } while
(i8091_INTP_STOP( ) !=READY) to execute the computing entity.
cardNo : board number 0~19.
x, y : center point of circle relate to present position.
dir : moving direction.
0 : CW
1 : CCW speed : 0~2040 acc_mode: 0: enable acceleration and deceleration profile
1: disable acceleration and deceleration profile
Y
(X,Y)
CW
X
CCW where r adius = sqr t(X^2 + Y^2)
Example:
i8091_INTP_CIRCLE02(CARD1,2000,2000,100,0); do { } while( i8091_INTP_STOP()!=READY) ; //call state machine
(25) i8091_INTP_ARC02(unsigned char cardNo, long x, long y, long R,
unsigned char dir, unsigned int speed,
unsigned char acc_mode)
This command will generate an interpolation arc in X-Y plane. Host will automaticly generate a trapezoidal speed profile of X-axis and Y-axis by state-machine-type calculation method. The i8091_INTP_ARC02() only set parameters into the driver. User can directly call the do { } while
(i8091_INTP_STOP( ) !=READY) to execute the computing entity.
cardNo : board number 0~19.
http://www.icpdas.com
2-32 ICPDAS
I-8091 User Manual x, y : end point of arc relate to present position.
R : radius of arc.
if R>0 , the arc < 180degree if R<0 , the arc > 180 degree dir : moving direction.
0 : CW
1 : CCW
R
R>0
R>0 dir
CW
CCW path of curve
'B'
'C'
R<0
R<0
CW
CCW
'A'
'D'
Version 1.0 06/2001 speed : 0~2040 acc_mode: 0: enable acceleration and deceleration profile
1: disable acceleration and deceleration profile
'A'
CW
Y
'B'
CW
CCW
'C'
(X,Y)
CCW
'D'
X
Restriction:
−
2
32 + ≤
# x
≤
2
32 −
1
−
2
32 + ≤
# y
≤
2
32 −
1
−
2
32 + ≤
# R
≤
2
32 −
1
R
≥ x
2 + y
2
2 http://www.icpdas.com
2-33 ICPDAS
I-8091 User Manual Version 1.0 06/2001
Example:
i8091_INTP_ ARC02(1,2000,-2000,2000,CW,100,0); do { } while( i8091_INTP_STOP()!=READY) ; //call state machine
(26) unsigned char i8091_INTP_STOP()
The above 3 state-machine-type interpolation commands
i8091_INTP_LINE02(), i8091_INTP_CIRCLE02() and
i8091_INTP_ARC02() must use i8091_INTP_STOP() simultaneously. The state-machine-type interpolation commands are only set parameters into the driver. The computing entity is in i8091_INTP_STOP().
This command will compute the interpolation profile. It will return
READY(0) for interpolation command completed. And retrun BUSY(1) for not yet complete.
http://www.icpdas.com
2-34 ICPDAS
I-8091 User Manual Version 1.0 06/2001
3.1.5 Others
(27) unsigned char i8091_LIMIT_X(unsigned char cardNo) to request the condition of X-axis limit switches cardNo : board number 0~19.
MSB 7 6 5 4 3
/EMG /FFFF /FFEF /LS14 xx
2 1 0 LSB xx /LS11 /ORG1
/ORG1 : original point switch of X-axis, low active.
/LS11, /LS14 : limit switches of X-axis, low active, which must be configured as Fig.(5).
/EMG : emergency switch, low active.
/FFEF : active low, FIFO is empty
/FFFF : active low, FIFO is full
Example: unsigned char limit1;
limit1 = i8091_LIMIT_X(1);
(28) unsigned char i8091_LIMIT_Y(unsigned char cardNo) to request the condition of Y-axis limit switches cardNo : board number 0~19.
MSB 7 6 5 4 3 ystop xstop xx /LS24 xx
2 1 0 LSB xx /LS21 /ORG2
/ORG2 : original point switch of Y-axis, low active.
/LS21, /LS24 : limit switches of Y-axis, low active, which must be configured as Fig.(6).
xstop: 1:indicate X-axis is stop ystop: 1:indicate Y-axis is stop
Example: unsigned char limit2; limit2 = i8091_LIMIT_Y(1);
(29) i8091_WAIT_X(unsigned char cardNo) to wait X-axis going to STOP state.
cardNo : board number 0~19.
http://www.icpdas.com
2-35 ICPDAS
I-8091 User Manual Version 1.0 06/2001
(30) i8091_WAIT_Y(unsigned char cardNo) to wait Y-axis going to STOP state.
cardNo : board number 0~19.
(31) unsigned char i8091_IS_X_STOP(unsigned char cardNo)
To check whether X axis is STOP or not.
Return value 0 (NO) : not yet stop
1 (YES) : stop
(32) unsigned char i8091_IS_Y_STOP(unsigned char cardNo)
To check whether Y axis is STOP or not.
Return value 0 (NO) : not yet stop
1 (YES) : stop http://www.icpdas.com
2-36 ICPDAS
I-8091 User Manual Version 1.0 06/2001
3.2 Start up and end of program
Start up program
When you are going to use I-8091 card, there are some commands must be implement in previous.
i8091_REGISTRATION(CARD1,0x80) set CARD1 address, (where CARD1=1) i8091_RESET_SYSTEM(CARD1); reset system i8091_SET_VAR(CARD1, DDA, AD, LSP, HSP); set DDA cycle, accelerating/decelerating speed, low speed and high speed value i8091_SET_DEFDIR(CARD1, xdir, ydir); define direction.
i8091_SET_MODE(CARD1, xmode, ymode); define output mode.
i8091_SET_SERVO_ON(CARD1, xson, yson); set servo ON/OFF.
define output mode.
i8091_SET_NC(CARD1, nc);
To config limit switch as N.C. or N.O.
end of program i8091_RESET_SYSTEM(CARD1);
To reset system
Example
//-----------------------------------------------------------------------------
-
#define CARD1 1 typedef struct {
int address;
unsigned char DDA,AD;
unsigned int LSP,HSP;
unsigned char xmode,ymode;
unsigned char xdir,ydir;
unsigned char xson,yson;
unsigned char NCmode; http://www.icpdas.com
2-37 ICPDAS
I-8091 User Manual Version 1.0 06/2001
} i8091CardType; i8091CardType card1;
//------------------------------------------------------------------------void main ()
{
card1.address=PortAddress[i8091Slot];
card1.DDA = 10;
card1.AD = 5;
card1.LSP = 5;
card1.HSP = 100;
card1.xmode = CW_CCW;
card1.ymode = CW_CCW;
card1.xdir = NORMAL_DIR;
card1.ydir = NORMAL_DIR;
card1.xson = ON;
card1.yson = ON;
card1.NCmode= OFF;
i8091_REGISTRATION(CARD1, card1.address);
i8091_RESET_SYSTEM(CARD1);
i8091_SET_VAR(CARD1, card1.DDA, card1.AD, card1.LSP, card1.HSP);
i8091_SET_DEFDIR(CARD1, card1.xdir, card1.ydir);
i8091_SET_MODE(CARD1, card1.xmode, card1.ymode);
i8091_SET_SERVO_ON(CARD1, card1.xson, card1.yson);
i8091_SET_NC(CARD1, card1.NCmode);
Delay(100);
.
.
//--- end of program ----------------------------
i8091_RESET_SYSTEM(CARD1);
} http://www.icpdas.com
2-38 ICPDAS
I-8091 User Manual Version 1.0 06/2001
4. Example
4.1 Detect I-8091 card
//---------------------------------------------------
// detect i8090,i8091,i8092 card
//---------------------------------------------------
#include "8000.h"
#include "s8090.h"
#define i8090 0x0d
#define i8091 0x0e
#define i8092 0x0f
#define NOCARD 0x00
#define MAX_SLOT_NO 8 unsigned int PortAddress[8]={0x080, 0x0a0, 0x0c0, 0x0e0, 0x140, 0x160,
0x180, 0x1a0};
//--------------------------------------------------void main ()
{ unsigned char slot,temp;
for (slot=0; slot<MAX_SLOT_NO; slot++)
{
temp=inportb(PortAddress[slot]);
switch (temp)
{
case i8090: //i8090 3-axis encoder card
Print("Slot %d = i8090\r\n",SlotNum); return i8090;
case i8091: //i8091 2-axis stepping card
Print("Slot %d = i8091\r\n",SlotNum); return i8091;
case i8092: //i8092
Print("Slot %d = i8092\r\n",SlotNum); http://www.icpdas.com
2-39 ICPDAS
I-8091 User Manual return i8092;
default:
Print("Slot %d = No Card\r\n",SlotNum); return NOCARD;
};
Delay(500);
}
};
Version 1.0 06/2001
4.2 Example: DEMO.cpp
//---------------------------------------------------------------------------
// demo.cpp for I-8091 card
//
// This program can test all of following command
// ----------------------I-8091 testing kit-----------------------------------
// (0)Exit (A)i8091_IS_X_STOP (K)i8091_CSP_MOVE
// (1)i8091_RESET_SYSTEM (B)i8091_IS_Y_STOP (L)i8091_SLOW_DOWN
// (2)i8091_SET_VAR (C)i8091_LIMIT_X (M)i8091_SLOW_STOP
// (3)i8091_SET_DEFDIR (D)i8091_LIMIT_Y (N)i8091_INTP_PULSE
// (4)i8091_SET_MODE (E)i8091_LSP_ORG (O)i8091_INTP_LINE
// (5)i8091_SET_SERVO_ON (F)i8091_HSP_ORG (P)i8091_INTP_LINE02
// (6)i8091_SET_NC (G)i8091_LSP_PULSE_MOVE (Q)i8091_CIRCLE02
// (7)i8091_STOP_X (H)i8091_HSP_PULSE_MOVE (R)i8091_ARC02
// (8)i8091_STOP_Y (I)i8091_LSP_MOVE (S)User Define Testing
// (9)i8091_STOP_ALL (J)i8091_HSP_MOVE
//
// The output pulse amount can be monitored from i8090 card. When directly
// connect the CW/PULSE, CCW/DIR of i8091 to i8090. The encoder value
// can be shown on the LED display. Its format as following.
// ex: 0.2 1 2 8 : X-axis encoder value
// 5 3.4 0 2 : Y-axis encoder value
// 1 0 0.1 0 : Z-axis encoder value
// the dot(.) stands for which axis.
//--------------------------------------------------------------------
4.3 Example:DEMO1.cpp
//--------------------------------------------------------------------
// demo1.cpp for I-8091 card
//
// This a simple program to test I-8091 command
// i8091_INTP_LINE()
// i8091_INTP_LINE02()
//-------------------------------------------------------------------http://www.icpdas.com
2-40 ICPDAS

Public link updated
The public link to your chat has been updated.
Advertisement
Key features
- 3-axis, 16 bits encoder counter
- Maximum counting rate : 1M pulse/sec
- 2-axis independent, simultaneous stepping motor control
- Maximum pulse rate: 1Mpps
- 2-axis linear, 2-axis circular interpolation
- automatic trapezoidal acceleration / deceleration
- 2500Vrms optical isolated signal output