1. A programmable logic controller (PLC), comprising: a single-chip comprising a single-chip timer, a hardware watchdog, a 11.0592M crystal, and an A/D converter module, and having an EEPROM and a system program burned into the EEPROM; a relay output module, an I/O module, and a pulse output module respectively connected to the single-chip; a relay connected to the relay output module; and a servo motor or a stepper motor connected to the pulse output module; wherein the system program comprises a programming module and a control module, the programming module comprises a main function, and a function subroutine library; the main function calls the subroutines of the function subroutine library, and the main function and the function subroutine library are translated to a ladder diagram by a compatible ladder diagram programming software, and then control commands are generated according to user programming data; the control module scans the input signals from the I/O module during a predetermined period, and generates output signals according to the control commands generated by the programming module to control output of the relay output module and the pulse output module.