Hi there
There is no as such programming required for communication to establish between them.
Only thing is you need to put right parameters under communication of WinCC Flexible.
You are trying to communicate through MPI.
Then select the Baud rate of HMI to 187500, select HMI address(make sure this address is unique)
Under Profile select MPI
Check your PLC address and then put same address in Wincc flexible
If you are using the Profibus to connect them then make sure that dip switch setting of the profibus connectors
are in right position.If only PLC and HMI is there, then profibus connector at both PLC and HMI end should be in ON position.
Also check that cable cores Green and red are connected at proper terminals of the connector.