The objective of this paper is to reduce the development time of a PLC (Programmable Logic Controller) by automating the task of code generation. For this purpose, we applied t-MPSG (Timed-Message Based Part State Graph). The t-MPSG is an extended finite state automata used to model and generate an execution module for a real-time shop floor controller system. In our proposed method, t-MPSG is used to model the formal specification of the controller system that can be translated into textual structure. After the verification of the t-MPSG model, it can be used as an input to the plc-builder tool. The plc-builder tool is an extended version of a conventional MPSG simulator. It can be used to translate the textual structure of the t-MPSG into an IEC standard PLC code. Finally, the generated code can be downloaded to a PLC emulator or a PLC device for the purpose of simulation and execution. The similarity in the hierarchical structure of the t-MPSG and the IEC standard PLC program has made it convenient to transform from one form to another. Furthermore, an illustration of the methodology to auto-generate IEC standard PLC code using t-MPSG is explained with a suitable example.