You can use FB41(Standard libriary) for PID control... Highlight it in S7 and press F1, it will give you some useful info about FB41 block...
Chrispen is right, Use HardWare configuration utility from S7 to set up I/O cards and their adresses, so you will be able to read/write to/from them in your program...