This paper presents an original approach of safe control synthesis of manufacturing systems. This approach is based on the use of a logic filter (placed at the end of PLC (Programmable Logic Controller)) robust to control errors, and formally validated using a model checker. The proposed approach, which separates the functional control part from the safety control part, is simple to implement and ensures that the designed controller is safe. The methodology is based on the use of safety constraints coming from the filter in order to get the most permissive safe controller. This controller is then constrained by functional constraints. The approach is illustrated by using an example of sorting boxes simulated using the ITS PLC software from the Real Games company (www.realgames.pt). The control algorithm is presented and allows to result in a safe control, may be simpler than a conventional approach based on a specification in GRAFCET (IEC 60848), that does not distinguish the functional aspect from the safety aspect. This approach involves a new way to see the control of manufacturing systems and presents interesting perspectives like the management of several operating modes.