MotionController Axis MultiAxis IO IOPoint NetworkNode RsiError
Sample Apps Changelog

RapidCode API

ControllerInterrupts.cpp
#include "rsi.h" // Import our RapidCode Library.
#include "HelperFunctions.h" // Import our SampleApp helper functions.
using namespace RSI::RapidCode;
void controllerInterruptsMain()
{
const int TIMEOUT = (5000); //ms
long interruptType;
// Initialize Controller, enable interrupts
SampleAppsCPP::HelperFunctions::CheckErrors(controller);
controller->InterruptEnableSet(true);
try
{
SampleAppsCPP::HelperFunctions::StartTheNetwork(controller); // [Helper Function] Initialize the network.
while (controller->OS->KeyGet(RSIWaitPOLL) < 0)
{
// add code here to generate interrupts (move axes, etc.)
// wait for an interrupt
interruptType = controller->InterruptWait(TIMEOUT);
if (interruptType != RSIEventTypeTIMEOUT)
{
printf("IRQ %ld\n", interruptType);
printf("%s\n", controller->InterruptNameGet());
printf("InterruptSourceNumber = %ld\n", controller->InterruptSourceNumberGet());
printf("InterruptSampleTimer = %ld\n", controller->InterruptSampleTimeGet());
printf("\n");
}
else
{
printf("Timeout waiting for interrupts...\n");
}
}
}
catch (RsiError const& err)
{
printf("\n%s\n", err.text);
}
controller->Delete(); // Delete the controller as the program exits to ensure memory is deallocated in the correct order.
system("pause"); // Allow time to read Console.
}