APIs, concepts, guides, and more

◆ MemorySet()

void MemorySet ( uint64_t address,
int32_t data )
Description:
MemorySet writes a value into controller memory
Parameters
addressAny address (host) in the controller's memory.
dataThe data to write.
Sample Code:
IO: Input & Output
const int INPUT_INDEX = 0;
const int OUTPUT_INDEX = 1; // the PDO Index in the user buffer
// get user buffer address for simulated IO point storage
UInt64 userBufferAddress = controller.AddressGet(RSIControllerAddressType.RSIControllerAddressTypeUSER_BUFFER, 0);
// create simulated IOPoints based on memory address and index
IOPoint input0 = IOPoint.CreateDigitalInput(controller, userBufferAddress, INPUT_INDEX);
IOPoint output0 = IOPoint.CreateDigitalOutput(controller, userBufferAddress, OUTPUT_INDEX);
// get & set an output
bool outVal = output0.Get();
output0.Set(outVal);
Console.WriteLine($"Output 0 value: {outVal}");
// test input operations by directly writing to memory
controller.MemorySet(input0.AddressGet(), 1);
bool inVal = input0.Get();
Console.WriteLine($"Input 0 memory set to 1, value: {inVal}");
controller.MemorySet(input0.AddressGet(), 0);
inVal = input0.Get();
Console.WriteLine($"Input 0 memory set to 0, value: {inVal}");
See also
MemoryGet
Examples
MotionHold.cs, MotionHoldReleasedBySoftwareAddress.cpp, UserLimit.cs, io-iopoint-user-buffer.cs, and mathblock-pdo-copy.cs.