What are the basic components of a PLC (Programmable Logic Controller), and can you explain how a standard scan cycle works?