- Linux MultiMedia Studio Computer Accessories User Manual
PC Based Motion Control
MN1278 05.2001
41
Stop Switch
The install function for stop switch events, it accepts a pointer to a function, if this is a NULL pointer the handler
is uninstalled.
typedef void TStopSwitchEventHandler (void *pController)
__int16 installStopSwitchEventHandler (TStopSwitchEventHandler *pHandler)
Timer
The install function for timer events, it accepts a pointer to a function, if this is a NULL pointer the handler is
uninstalled. The parameter passed to the event handler is always zero.
typedef void TTimerEventHandler (void *pController, __int16 nTimerEvent)
__int16 installTimerEventHandler (TTimerEventHandler *pHandler)
Unknown
The install function for unknown events, it accepts a pointer to a function, if this is a NULL pointer the handler is
uninstalled.
typedef void TUnknownEventHandler (void *pController, __int16 nCode)
__int16 installUnknownEventHandler (TUnknownEventHandler *pHandler)
This handler will pick up any otherwise un-handled interrupt codes on the host. Under normal circumstances it
will not be called, as all interrupts will be routed to the appropriate event hander. If this handler is not installed
then unknown interrupts will be discarded.
Example:
The following code sample will install a timer event handler.
// prototypes
void cdecl FAR myTimerEventHandler (void *p, __int16 nTimerEventNumber);
// main program
void main ( void )
{
// Create an instance of the CNextMovePCI class
CNextMovePCI1 myPCI ( 0, 0 );
// install timer event handler
myPCI.installTimerEventHandler ( myTimerEventHandler ));
myPCI.setTimerEvent(1000); // set periodic timer event to 1000ms
while(1) {
myPCI.setRelay(0, 1); // Turn the main board relay on
myPCI.doWait(500); // Wait for 500 ms
myPCI.setRelay(0, 0); // Turn the main board relay off
myPCI.doWait(500); // Wait for 500 ms
}
}