- Computers & electronics
- Computer components
- Interface components
- Digital & analog I/O modules
- ADLINK Technology
- PCI-8136M
- User's Guide
advertisement
![Interrupt Control. ADLINK Technology PCI-8136M | Manualzz Interrupt Control. ADLINK Technology PCI-8136M | Manualzz](http://s1.manualzz.com/store/data/001438114_1-e075bc2fb8e61a7cd0411c36ed8396e4-360x466.png)
4.17 Interrupt Control
The PCI-8136M can generate INT signal to host PC according to 8 types of interrupt factors, refer to _8136_S_Set_Int_factor() function for more details.
The following table represents the interrupt setting for all factors.
_8136_S_Set_Int_factor( Cardno, AxisNo, Int_Factor)
AxisNo
0 1 2 3
Int. Factor bit (type)
0
1
2
3
4
5
6
7
EL1
ALM
EL2 EL3 EL4
4
EL5
5
EL6
ORG1 ORG2 ORG3 ORG4 ORG5 ORG6
EZ1 EZ2 EZ3 EZ4 EZ5 EZ6
CMP1 CMP2 CMP3 CMP4 CMP5 CMP6
Timer - - - - -
ADC1 ADC2 ADC3 ADC4 ADC5 ADC6
INP1 INP2 INP3 - - -
Note: EL is both PEL and MEL, EZ is index signal , CMP is position compare true, Timer is card’s internal timer, ADC is analog compare true. INP is motion command finished.
For each axis number, the interrupt can be set according to this table.
Because users can’t deal with interrupt under Windows System. PCI-8136M has another way for user to receive interrupts. That is Windows message system. This card uses events to notice user’s program if interrupt is coming.
Users can create a thread to get the interrupt events and then use
_8136_S_Get_Int_Status() to get the interrupt status. The status bits for each axis is in the following table:
_8136_S_Get_Int_Status(Cardno, AxisNo, Status )
Bits Description
0 Positive limit switch interrupt
1 Negative limit switch interrupt
2 Alarm pin interrupt
3 ORG pins interrupt
4 Index signal interrupt
5 Position counter compare interrupt
6 Internal timer interrupt
7 Analog compared interrupt
8 Motion command finished
Operation Theorem
• 59
Use Thread to deal with Interrupt under Windows NT/95
In order to detect the interrupt signal from PCI-8136M under Windows NT/95, user must create a thread routine first. Then use APIs provided by
PCI-8136M to get the interrupt signal. Each card has 7 events for these interrupts. Event 0 ~ 5 stands for axis 0~5 and event 6 stands for timer interrupt and alarm interrupt. The sample program is as follows:
Situatuins: Assume that we have one card and want to receive Timer interrupt.
Steps:
1. Define a Global Value to deal with interrupt event
HANDLE hEvent[7]; volatile bool ThreadOn;
2. In Initializing Section ( you must Initialize PCI-8136M properly first), set interrupt types and enable an event for each axis.
_8136_S_Set_Int_Factor(0,0, 0x40);
_8136_S_INT_Control(0,1);
_8136_INT_Enable(0,&hEvent[0]);
_8136_INT_Enable function.
Note: For each card, you must assign a 7 -events-array in.
3. Define a Global Function (Thread Body). Use WaitForSingleObject() or WaitForMultipleObjects() to wait events. Remenber to reset this event after you get the event.
UINT IntThreadProc(LPVOID pParam)
{
U32 IntSts;
while(ThreadOn==TRUE)
{
::WaitForSingleObject(hEvent[6],INFINITE);
_8136_S_Get_Int_status(0,0,&IntSts);
::ResetEvent(hEvent[6]);
}
return 0;
}
60
• Operation Theorem
4. Start the thread( Use a boolean value to control the thread’s life )
ThreadOn=TRUE;
AfxBeginThread(IntThreadProc,GetSafeHwnd(),THREAD_PRIORIT
Y_NORMAL);
5. Before exit the program, remember to let the thread go to end naturally.
ThreadOn=FALSE;
We suggest user to create a thread and use WaitForSingleObject() for each events in order to guarantee the performance.
You can also use _8136_Callback_Function() to receive INT event and ignore the above method but the interrupt service routine in this function should be programmed carefully. The total spent time in this call back function should not be too long.
Relative Functions:
_8136_INT_Enable(), _8136_INT_Disable(),
_8136_S_Set_Int_Factor(), _8136_S_INT_Control(),
_8136_S_Get_Int_Status(), _8136_Callback_Function() refer to section 5.9
Operation Theorem
• 61
5
Motion Library
This chapter describes the supporting software for PCI-8136M cards. User can use these functions to develop application program in C or Visual Basic or C++ language.
The function prototypes and some common data types are decelerated in
PCI-8136M.H. These data types are used by PCI-8136M library. We suggest you to use these data types in your application programs. The following table shows the data type names and their range.
Type Name
U8
I16
U16
I32
U32
F32
F64
Boolean
Description
8-bit ASCII character
16-bit signed integer
16-bit unsigned integer
Range
0 to 255
-32768 to 32767
0 to 65535
32-bit signed long integer -2147483648 to 2147483647
32-bit unsigned long integer
32-bit single-precision floating-point
0 to 4294967295
-3.402823E38 to 3.402823E38
64-bit double-precision floating-point
Boolean logic value
-1.797683134862315E308 to
1.797683134862315E309
TRUE, FALSE
The functions of PCI-8136’s software drivers use full-names to represent the functions' real meaning. The naming convention rules are:
In C Environment :
_{hardware_model}_{action_name}. e.g. _8136_Initial().
In order to recognize the difference between C/C++ library and Visual Basic library, A capital "B" is put on the head of each function name of the Visual
Basic function. e.g. B_8136_Initial().
62
• Motion Library
advertisement
Related manuals
advertisement
Table of contents
- 11 Functionality of PCI-8136M
- 12 Features
- 13 Specifications
- 13 Applicable Motors
- 13 Motion
- 13 Motion Interface I/O Signals
- 14 General I/Os
- 15 General Specifications
- 16 Software Supporting
- 16 Programming Library
- 18 What You Have
- 19 Outline Drawing
- 20 Hardware Installation
- 20 Hardware configuration
- 20 PCI slot selection
- 20 Installation Procedures
- 20 Trouble shooting
- 21 Software Installation
- 22 CN1 PIN ASSIGNMENTS: MAIN CONNECTOR
- 23 CN2 PIN ASSIGNMENTS: EXTERNAL POWER INPUT
- 24 CN3 PIN ASSIGNMENTS: DB25 CONNECTOR
- 24 CN4 PIN ASSIGNMENTS: DB9 CONNECTOR
- 26 Pulse output signals OUT and DIR
- 28 Voltage output signals DAC
- 30 Encoder feedback signals EA, EB and EZ
- 33 Analog Input
- 35 Origin signal ORG
- 36 End-Limit signals PEL and MEL
- 37 Emergency stop signal ESTOP
- 38 Servo on signal SVON
- 39 General purpose output P-RDY
- 39 VCC Pin
- 40 Open Loop and Closed Loop Connection
- 43 AD Conversion and Preloaded Trigger
- 43 Voltage Compare
- 44 DA Conversion
- 44 DA Output by Trigger Source
- 45 Local DIO
- 45 Digital Input
- 45 Digital Output
- 46 Pulse Input and Position Compare
- 46 Pulse Input
- 47 Position Counter Value Capture (Latch)
- 48 Position Compare
- 49 Pulse Output
- 51 Remote Serial IO
- 52 Introduction to DDA
- 53 Open-loop and close-loop control
- 53 Open-loop control
- 53 Close-loop control
- 54 Constant Velocity Motion
- 55 Trapezoidal Motion
- 57 S-Curve Profile Motion
- 59 2D Interpolation
- 62 3D Interpolation
- 63 Home Return Mode
- 64 Motion Parameters Setting
- 65 The Motion IO Interface
- 65 SERVO ON
- 65 Limit Switch Signal
- 65 Emergency stop signal (ESTOP)
- 67 Interrupt Control
- 71 List of Functions
- 73 Initialization
- 75 System Parameters
- 77 Card Information
- 78 Digital I/O
- 80 Remote I/O
- 82 Analog I/O
- 85 Pulse I/O
- 89 Interrupt Control
- 92 Close Loop Initialization
- 93 Motion Parameters
- 96 Motion Status
- 98 PTP Movement
- 100 2D Interpolation
- 102 3D Interpolation
- 104 Continuous Motion
- 105 Homing
- 106 Motion Function