MTConnect FANUC Adapter PMC Addresses

The current version of FANUC MTConnect adapter only supports PMC G address.  From a standardization point of view this is a great decision. The other PMC addresses including R,K,D,C and T are used by the machine tool builders and are assigned differently between machines.  Conversely the G Addresses are defined by FANUC and consistent between machines.  However, in practical terms, much can be gleaned about the machine condition through these addresses when customized to the machine.  With just a small modification to the existing FANUC MTConnect adapter, it can support all addresses.

By default, the addresses are defined in the adapter.ini file under the [pmc] section.  The sample adapter.ini file has two addresses mapped, G12-Feedrate override and

Firstly, the source file fanuc_adapter.cpp has one line of code that reads pmc addresses over FOCAS.  The FOCAS call expects the address type as an integer, G=0, F=1, Y=2, X=3, and so on.  In order to read addresses other than G we will need to specify the address.  The easiest was to achieve this is to pass an append the integer of the address to the front of the address.  For example, pmc address Y0078 would become 20078.  Then it’s just a simple matter of separating the prefix from the address.  Additionally, the orginal adapter incorrectly handles a negative value.  The code below is correct so the PMC address is reported properly if it is negative return. Here is the code:

void FanucAdapter::getPMC()
 if (!mConnected)
 for (int i = 0; i < mPMCCount; i++)
 // Seperate the data type
 int pmcType = mPMCAddress[i]/10000;
 int pmcAddress = mPMCAddress[i]%10000;
 short ret = pmc_rdpmcrng(mFlibhndl, pmcType, 0 /* byte */,
 pmcAddress, pmcAddress, 8 + 1,
 if (ret == EW_OK)
 if (buf.u.cdata[0] < 0)
 mPMCVariable[i]->setValue(-buf.u.cdata[0] + 128);
 printf("Could not retrieve PMC data at %d for %s: %d\n",
 mPMCAddress[i], mPMCVariable[i]->getName(), ret);

Now that the source code will properly read any PMC address, we just need to modify the addresses in the adapter.ini file as below:

port = 7878
service = MTC Focus 1
host =
# PMC Types G=0, F=1, Y=2, X=3, A=4, R=5, T=6, K=7, C=8, D=9
# PMC Address G22 would by 00022, R99 would be 50099 etc.
SspeedOvr = 00030
Fovr = 00012
turkey = 50033

This creates the following stream output from the MTConnect FANUC adapter:  Address R33 was 10000000 in binary, which correctly output as turkey|127 in decimal.

output of adapter at  http://some.ip.address:7878/
2014-07-10T15:12:52.633Z|part_count|7|SspeedOvr|0|Fovr|0|turkey|127|tool_id|0|program|3.0|line|0|block|O0000%|path_feedrate|0|path_position|0.0000000000 0.0000000000 -0.0010000000|mode|MANUAL_DATA_INPUT
2014-07-10T15:12:52.633Z|logic|FAULT|100|||PARAMETER ENABLE SWITCH ON

That’s it.  This same procedure will work for all controls including the FANUC FS30/31/32 and FS16/18/21 controls.  However, the address to number conversions may have to be re-arranged.

If you use this post please write a comment below.  Thanks.