MAC Address of PAC Controller


We can use PAC Control to get the IP address of the PAC controller.
How to get the its MAC address in PAC Control?

Hi Edmund,

Short answer: Use the I/O Unit – Memory Map Commands.

Longer answer: (Including pictures, sample code, and OptoMary commentary.) :cool:

Let me answer a more general question (How do I read/write values accessible via PAC Manager in my PAC Control strategy?), using this particular question as the example.

As you may know, many of the commands in PAC Control access parts of the memory map for you. For example, it sounds like you might already be using the built-in command: Get Control Engine Address.

That command does the equivalent of reading the IP address from the mem map (address: F030 0038 as documented in form 1465), then converts it to a string, like the command: Convert Integer 32 to IP Address String does.

In particular for this case, I can see my PAC’s MAC address here in the “Status Read” section of PAC Manager’s Inspect tool. (This even works with SoftPAC, the Ethernet info you see below is for this PC.)

If you don’t already have an I/O Unit configured for the PAC you want to read (for example, if you’re using SoftPAC or a PAC-S series you might not have an I/O Unit since you don’t have any I/O on that unit), configure one something like this:

Then you can use commands like this:

The MAC Address you asked about is a little unusual in that it’s 6 bytes vs. 4 or 8 like most of our data types, so that INTEGER 64 value read above, which I called nnMACplutTwoBytes, has a couple of bytes extra that are not part of the MAC address. (Our variable has 64 bits = 8 bits per byte x 8 bytes). How you deal with those extra 2 bytes of data will depend on what you want to do with that address.

Assuming here that you just want to display it somewhere as a nice string which looks like what you see in PAC Manager, I’d do something like this:

Here’s the text in case you want to copy/paste:

// this yields a string with a couple extra bytes, like this: 6C626DE9A4FD0AC0 (16 characters)
NumberToFormattedHexString( nnMACplusTwoBytes, 16, sMACAddressAsString );

// Get each byte in the MAC Address as a 2-characters string in the table stMACbytes
for nMACByteIndex = 0 to 5 step 1

  GetSubstring( sMACAddressAsString, nMACByteIndex * 2, 2, stMACbytes[nMACByteIndex] );


// Build the human-readable string with a dash between each byte

sMACAddressAsString = ""; // we're re-using the same string here, clear it out first

for nMACByteIndex = 0 to 4 step 1

  sMACAddressAsString = sMACAddressAsString  + stMACbytes[nMACByteIndex] + "-";

sMACAddressAsString = sMACAddressAsString  + stMACbytes[5];

Which gets me this:

I hope that helps! By the way, this post on how to change your IP Address (from within your strategy) might be of interest too:


Edmund and all,

I used the code sample provided by Mary to build a ‘diagnostic’ chart for my controller.
The goal was to show some information about the controller in my groov Project.

Here is a screen shot of some of that information.

In a nut shell, you can get strings and ints and stuff (tech term there) from the mem map location and store them in the controller.
Once in the controller, you can do pretty much anything with them, from Pac Display, to groov, to email alarms and reports and stuff.



1 Like

I don’t know but I’ll look into it.

Hi OptoMary & Ben,

Thanks for your detail information.

We can use the MAC address to protect our PAC Control code.