In the device that is providing its I/O you have to copy over states to/from the i-device from/to the physical i/o.
So, if you have for example:
Master PLC outputs configured for the slave PLC, Q100.0 .. Q101.7
Master PLC inputs configured for the slave PLC, I100.0 .. I101.7
Slave PLC i-device inputs I100.0 .. I101.7
Slave PLC i-device outputs Q100.0 .. Q101.7
Slave PLC physical outputs Q0.0 .. Q1.7
Slave PLC physical inputs I0.0 .. I1.7
In the Slave PLC you must program this:
I100.0 --> Q0.0 // from i-device inputs to physical outputs. edit: Possibly use DPRD_DAT for this, see below.
I100.1 --> Q0.1
etc.
I0.0 --> Q100.0 // from physical inputs to i-device outputs. edit: Possibly use DPWR_DAT for this, see below.
I0.1 --> Q100.1
etc.
In the master PLC when Q100.0 is activated, then Q0.0 in the slave PLC will activate.
And when input I0.0 in the slave PLC activated, then input I100.0 in the master PLC will activate.
edit: Not sure if it is an issue or not, since I dont have experience with S7-1200.
If the i-device addresses are outside the process image of the CPU, you must transfer all the data in one go (i.e. "consistently").
For this purpose you would use DPRD_DAT and DPWR_DAT system functions.
I just mention this for completeness sake. If you assign i-device addresses at the low end, you can just copy the addresses the normal way.