54using RSI.RapidCode.dotNET;
65class InputOutput : SampleAppTestBase
67 [Test, Timeout(Constants.MAX_TEST_TIME)]
68 public void DedicatedIO()
72 Console.WriteLine(
"RSIMotorDedicatedInLIMIT_HW_NEG: {0} and {1}",
76 Console.WriteLine(
"RSIMotorDedicatedInLIMIT_HW_POS: {0} and {1}",
80 Console.WriteLine(
"RSIMotorDedicatedInHOME: {0} and {1}",
84 Console.WriteLine(
"RSIMotorDedicatedInAMP_FAULT: {0} and {1}",
88 Console.WriteLine(
"RSIMotorDedicatedInAMP_ACTIVE: {0} and {1}",
94 [Test, Timeout(Constants.MAX_TEST_TIME)]
95 public void NetworkInputsAndOutputs()
101 for (
int i = 0; i < inputCount; i++)
112 for (
int i = 0; i < outputCount; i++)
126 public void IOPoints()
130 const int NODE_INDEX = 0;
132 const int OUTPUT_INDEX = 0;
141 Assert.That(output0.
Get(), Is.False,
"The getter function should return a value equal to false");
147 public void IOPointUserBuffer()
151 const int INPUT_INDEX = 0;
152 const int OUTPUT_INDEX = 1;
161 Assert.That(output0.
Get(), Is.False,
"The getter function should return a value equal to false");
163 Assert.That(output0.
Get(), Is.True,
"The getter function should return a value equal to true");
165 Assert.That(input0.
Get(), Is.False,
"The getter function should return a value equal to false");
167 Assert.That(input0.
Get(), Is.True,
"The getter function should return a value equal to true");
172 public void SingleAxisSyncOutputs()
175 const int TOTAL_POINTS = 4;
176 const int EMPTY_CT = -1;
177 const int OUTPUT_INDEX = 0;
178 const int NODE_INDEX = 0;
180 double[] positions = { 1.0, 2.0, 3.0, 4.0 };
181 double[] times = { 0.5, 0.1, 0.2, 0.4 };
182 int outputEnableID = 2;
183 int outputDisableID = 3;
200 axis.
MovePT(
RSIMotionType.RSIMotionTypePT, positions, times, TOTAL_POINTS, EMPTY_CT,
false,
true);
206 Assert.That(output0.
Get(), Is.EqualTo(
true),
"The output should be triggered");
210 Assert.That(output0.
Get(), Is.EqualTo(
false),
"The output should NOT be triggered");
double CommandPositionGet()
Get the current command position.
bool AmpEnableGet()
Get the state of the Amp Enable Output.
bool HomeSwitchGet()
Get the current state of the Home switch input.
bool PositiveLimitGet()
Get the state of the Hardware Positive Limit input.
uint16_t MotionIdExecutingGet()
bool NegativeLimitGet()
Get the state of the Hardware Negative Limit input.
bool AmpFaultGet()
Get the current state of the Amp Fault input.
bool DedicatedInGet(RSIMotorDedicatedIn motorDedicatedInNumber)
Read a digital input.
uint64_t AddressGet()
Get the Host Address for the I/O point.
void Set(bool state)
Set the state of a Digital Output.
static IOPoint * CreateDigitalInput(Axis *axis, RSIMotorDedicatedIn motorDedicatedInNumber)
Create a Digital Input from an Axis' Dedicated Input bits.
static IOPoint * CreateDigitalOutput(Axis *axis, RSIMotorDedicatedOut motorDedicatedOutNumber)
Create a Digital Output from an Axis' Dedicated Output bits.
bool Get()
Get the state of Digital Input or Output.
Represents one specific point: Digital Output, Digital Input, Analog Output, or Analog Input....
NetworkNode * NetworkNodeGet(int32_t nodeNumber)
NetworkNodeGet returns a pointer to a RapidCodeNetworkNode object using its node number and initializ...
void NetworkOutputOverrideValueSet(int32_t index, uint64_t outputValue)
Sets a PDO output directly.
int32_t NetworkInputBitOffsetGet(int32_t index)
void MemorySet(uint64_t address, int32_t data)
Write a value to controller memory.
uint64_t AddressGet(RSIControllerAddressType type)
Get the an address for some location on the MotionController.
uint64_t NetworkInputValueGet(int32_t index)
uint64_t NetworkOutputSentValueGet(int32_t index)
Gets the value sent out over EtherCAT.
void SampleWait(uint32_t samples)
Wait for controller firmware to execute samples.
int32_t NetworkOutputCountGet()
const char *const NetworkOutputNameGet(int32_t index)
Get the name of a PDO output.
int32_t NetworkOutputBitSizeGet(int32_t index)
Get the size (in bits) of a PDO output.
int32_t NetworkOutputBitOffsetGet(int32_t index)
Get the raw PDO offset for an output.
int32_t NetworkInputCountGet()
Get the number of PDO inputs found on the network.
int32_t NetworkInputBitSizeGet(int32_t index)
Get the size (in bits) of a network input.
const char *const NetworkInputNameGet(int32_t index)
Get the name of a PDO network input.
void AmpEnableSet(bool enable)
Enable all amplifiers.
void StreamingOutputAdd(int32_t onMask, int32_t offMask, uint64_t address)
void StreamingOutputsEnableSet(bool enable)
Sets whether Streaming Output is enabled (true) or disabled (false).
void MovePT(RSIMotionType type, const double *const position, const double *const time, int32_t pointCount, int32_t emptyCount, bool retain, bool final)
A move commanded by a list of position and time points.
bool MotionDoneGet()
Check to see if motion is done and settled.
RSIControllerAddressType
Used to get firmware address used in User Limits, Recorders, etc.
RSIMotionType
Streaming motion types.
RSIMotorDedicatedIn
Dedicated Input bits per motor.