Fanuc SDK documentation
Inputs & Outputs
Read and write digital signals (SDI, SDO, RDI, RDO, UI, UO, SI, SO, WI, WO) and numeric I/O (GI, GO, AI, AO) via SNPX.
SNPX supports 13 digital signal types and 5 numeric I/O types, all with single and range read/write operations.
Digital signals
Digital signals are boolean values. The following types are available:
| Type | Description |
|---|---|
SDI / SDO | Standard Digital Input / Output |
RDI / RDO | Robot Digital Input / Output |
UI / UO | User Input / Output |
SI / SO | System Input / Output |
WI / WO | Weld Input / Output |
WSI | Wire Stick Input |
PMC_K | PMC Keep Relays |
PMC_R | PMC Internal Relays |
Read and write digital signals
// Read SDI[10]bool sdi10 = robot.Snpx.SDI.Read(10);// Write RDO[1] = ONrobot.Snpx.RDO.Write(1, true);// Read UI[5]bool ui5 = robot.Snpx.UI.Read(5);// Read 100 SDI signals starting at index 1bool[] values = robot.Snpx.SDI.Read(1, 100);// Write 3 SDO signals starting at index 1robot.Snpx.SDO.Write(1, new[] { true, false, true });
Numeric I/O
Numeric I/O signals are 16-bit unsigned integers (ushort):
| Type | Description |
|---|---|
GI / GO | Group Input / Output |
AI / AO | Analog Input / Output |
PMC_D | PMC Data |
Read and write numeric I/O
// Read GI[1]ushort gi1 = robot.Snpx.GI.Read(1);// Write GO[1] = 500robot.Snpx.GO.Write(1, 500);// Read AI[1]ushort ai1 = robot.Snpx.AI.Read(1);// Write AO[2] = 32767robot.Snpx.AO.Write(2, 32767);// Read a range of GI valuesushort[] giValues = robot.Snpx.GI.Read(1, 100);
Complete example
using UnderAutomation.Fanuc;using UnderAutomation.Fanuc.Common;public class SnpxIo{public static void Main(){FanucRobot robot = new FanucRobot();ConnectionParameters parameters = new ConnectionParameters("192.168.0.1");parameters.Snpx.Enable = true;robot.Connect(parameters);/**/// --- Digital signals (boolean) ---// Read a single digital inputbool sdi10 = robot.Snpx.SDI.Read(10);// Write a single digital outputrobot.Snpx.RDO.Write(1, true);// Read a range of digital inputs (100 signals starting at index 1)bool[] sdiRange = robot.Snpx.SDI.Read(1, 100);// Write a range of digital outputsrobot.Snpx.SDO.Write(1, new[] { true, false, true });// Other digital signal types: UI, UO, SI, SO, WI, WO, WSI, PMC_K, PMC_Rbool ui5 = robot.Snpx.UI.Read(5);robot.Snpx.SO.Write(3, false);// --- Numeric I/O (ushort) ---// Read Group Inputushort gi1 = robot.Snpx.GI.Read(1);// Write Group Outputrobot.Snpx.GO.Write(1, 500);// Read Analog Inputushort ai1 = robot.Snpx.AI.Read(1);// Write Analog Outputrobot.Snpx.AO.Write(2, 32767);// Read a range of numeric I/Oushort[] giRange = robot.Snpx.GI.Read(1, 100);// Other numeric I/O types: PMC_Dushort pmcD = robot.Snpx.PMC_D.Read(1);/**/}}
API reference
Members of Snpx.Internal.DigitalSignals :public class DigitalSignals : SnpxElements<bool, int> {// Reads the digital signal at the specified index.public override bool Read(int index)// Reads a range of digital signals.public bool[] Read(int firstIndex, ushort count)// Gets the segment name identifying this signal group.public SegmentName SegmentName { get; }// Gets the segment offset for this signal group.public SegmentOffset SegmentOffset { get; }// Gets the segment selector for this signal group.public SegmentSelector SegmentSelector { get; }// Writes a value to the digital signal at the specified index.public void Write(int index, bool value)// Writes values to consecutive digital signals.public void Write(int firstIndex, bool[] values)}
public class NumericIO : SnpxElements<ushort, int> {// Reads the numeric I/O value at the specified index.public override ushort Read(int index)// Reads a range of numeric I/O values.public ushort[] Read(int firstIndex, ushort count)// Gets the segment name identifying this I/O group.public SegmentName SegmentName { get; }// Gets the segment offset for this I/O group.public SegmentOffset SegmentOffset { get; }// Gets the segment selector for this I/O group.public SegmentSelector SegmentSelector { get; }// Writes a value to the numeric I/O at the specified index.public void Write(int index, ushort value)// Writes values to consecutive numeric I/O.public void Write(int firstIndex, ushort[] values)}