PAC Control includes a command to get your PAC’s address (Get Control Engine Address), but what if you need to change some IP Settings either locally or on another mem map device, without using PAC Manager?
Near the end of form 1465 (in the IP Settings–Read/Write section), you’ll find instructions on how to do this, but I always have to look up what “1s complement” means (bitnot)…
Anyway, it’s a 2-step process which does NOT require a store to flash, but DOES require a reboot to take effect. The instructions, direct from form 1465: IP Settings—Read/Write
If you are not using PAC Manager to change IP addressing for the Ethernet network interface(s) on the device, you can use this area of the memory map to do so. All changes made in this area require two steps (PAC Manager does these steps automatically):
Send the new address (8 bytes consisting of the address [4 bytes] plus the 1s complement of it
[4 bytes]). The 1s complement requirement is designed to avoid accidental changes.
Send a reset hardware command (see Status Area Write address F0380000, operation code
0x00000005) to cycle power and make the changes take effect.
Sample OptoScript code:
// Here are some sample address values (these might come from somewhere else, like groov or PAC Display) nIPAddress = IpAddressStringToInt32("10.0.0.1"); nSubnetMask = IpAddressStringToInt32("255.255.0.0"); nGateway = IpAddressStringToInt32("10.192.51.50"); nDNS = IpAddressStringToInt32("220.127.116.11"); // First write the IP address & subnet mask ntMemMapData = nIPAddress; ntMemMapData = bitnot nIPAddress; // 1s Complement ntMemMapData = nSubnetMask; ntMemMapData = bitnot nSubnetMask; // 1s Complement nResult = WriteNumTableToIoUnitMemMap(4, 0, self, 0xFFFFF050, ntMemMapData); // Now write the default gateway address & DNS ntMemMapData = nGateway; ntMemMapData = bitnot nGateway; // 1s Complement ntMemMapData = nDNS; ntMemMapData = bitnot nDNS; // 1s Complement nResult = WriteNumTableToIoUnitMemMap(4, 0, self, 0xFFFFF068, ntMemMapData); // Last step, send hardware reset (USE WITH CAUTION IF WRITING TO SELF) nResult = WriteNumToIoUnitMemMap( self, 0xF0380000, 5 );
Note that this example was for the Secondary IP settings, for Primary settings (as documented in form 1465) the 0xFFFFF050 & 0xFFFFF068 addresses above would need to be: 0xFFFFF008 & 0xFFFFF018 instead.
Note: As you can probably guess, SoftPAC does NOT include this part of the memory map. But you could run this code on a SoftPAC controller, you’d just make sure that the I/O Unit I called “self” in the example above would have to correspond to a non-SoftPAC.