Console.WriteLine("📜 Recorder");
const int VALUES_PER_RECORD = 2;
const int RECORD_PERIOD_SAMPLES = 1;
const int RECORD_TIME = 250;
const int INPUT_INDEX = 0;
MotionController controller = MotionController.Get();
try
{
controller.RecorderCountSet(1);
if (controller.RecorderEnabledGet() == true)
{
controller.RecorderStop();
controller.RecorderReset();
}
controller.RecorderPeriodSet(RECORD_PERIOD_SAMPLES);
controller.RecorderCircularBufferSet(false);
controller.RecorderDataCountSet(VALUES_PER_RECORD);
controller.RecorderDataAddressSet(1, digitalInput.
AddressGet());
controller.RecorderStart();
controller.OS.Sleep(RECORD_TIME);
int recordsAvailable = controller.RecorderRecordCountGet();
Console.WriteLine($"There are {recordsAvailable} records available");
for (int i = 0; i < recordsAvailable; i++)
{
controller.RecorderRecordDataRetrieve();
double positionRecord = controller.RecorderRecordDataDoubleGet(0);
int digitalInputValue = controller.RecorderRecordDataValueGet(1);
if ((digitalInputValue & digitalInput.
MaskGet()) == digitalInput.
MaskGet())
{
Console.WriteLine($"Encoder position was: {positionRecord} when input triggered");
break;
}
}
controller.RecorderStop();
controller.RecorderReset();
}
finally
{
controller.Delete();
}
Constants used in the C# sample apps.
const int AXIS_0_INDEX
Default: 0.
static void CheckErrors(RapidCodeObject rsiObject)
Checks for errors in the given RapidCodeObject and throws an exception if any non-warning errors are ...
static void PhantomAxisReset(Axis phantomAxis)
Configures a phantom axis on the controller.
Helpers class provides static methods for common tasks in RMP applications.
uint64_t AddressGet(RSIAxisAddressType addressType)
Get the an address for some location on the Axis.
Represents a single axis of motion control. This class provides an interface for commanding motion,...
uint64_t AddressGet()
Get the Host Address for the I/O point.
static IOPoint * CreateDigitalInput(Axis *axis, RSIMotorDedicatedIn motorDedicatedInNumber)
Create a Digital Input from an Axis' Dedicated Input bits.
int32_t MaskGet()
Get the bit mask for the I/O point.
Represents one specific point: Digital Output, Digital Input, Analog Output, or Analog Input....
RSIControllerAddressType
Used to get firmware address used in User Limits, Recorders, etc.
RSIAxisAddressType
Used to get firmware address used in User Limits, Recorders, etc.