1. An event-driven method for programming a programmable logic controller, the method comprising: registering at least one event; storing at least one event handler program section corresponding to the at least one event; detecting the occurrence of the at least one event; adding the at least one event into an event queue; extracting an event from the event queue; executing an event handler program section corresponding to the extracted event.