If i'm not wrong You assign your 2 AI PIW addresses via HW-Config. You just read value from those assigned addreses and process it as any other inputs.
With the CP342-5 you need to exchange the i/o image via the standard blocks DP_SEND and DP_RECV.
I have made a description in the downloads section under Siemens.