You provided too limited information - for example, is that Modbus RTU or Modbus TCP? I suppose both are possible, it depends on what is the protocol and mapping of your slave device. You have both ports available as a hardware in that CPU.
Look in the manuals and help files for COM_MOD_MAST block in case it is Modbus RTU. Also there are a lot of similar posts with examples and hints here in AKS, despite the official manuals.