- Linux MultiMedia Studio Computer Accessories User Manual
PC Based Motion Control
MN1278 05.2001
43
4.2.3 Interrupting the Host from a Mint Program ( DPR Events )
Events can be manually generated in both directions using the function doDPREvent and the DPREvent handler.
If the host PC calls doDPREvent, this will generate an interrupt to the controller that will call the DPREvent
handler on the controller.
If the controller calls the function doDPREvent, this will generate an interrupt to the host PC that will call the
DPREvent handler on the host PC.
The function doDPREvent accepts an 8 bit code which is passed to the event handler.
Example:
The below code sample will install a DPREvent handler on the host, when a DPREvent is received the code is
printed.
// prototypes
void myDPREventHandler (void *p, __int16 nCode);
// main program
void main(void)
{
// Create an instance of the CNextMovePCI class
CNextMovePCI1 myPCI(0, 0);
// install timer event handler
myPCI.installDPREventHandler ( myDPREventHandler ));
}
// DPREvent handler
void myDPREventHandler (void *p, __int16 nCode)
{
cout<<"DPREvent”<<nCode<<endl;
}
When this application is running on the host PC, calling DPREVENT from either Mint or an embedded
application will generate an interrupt to the PC calling the DPREvent handler.
4.2.4 Handling Events Using the ActiveX Control
As the ActiveX control supports all events; hence, any application that can use the ActiveX control can trap and
handle events from the controller. This allows event handling using Visual Basic and Delphi.
Once the ActiveX Control has been included in the project, the event handlers are accessed as ActiveX events.
The functions listed below are used to tell the controller that a handler exists on the host PC and events of this
type should be generated.
installAxisIdleEventHandler
installCAN1EventHandler
installCAN2EventHandler
installCommsEventHandler
installDPREventHandler