??? 09/12/07 11:13 Read: times Msg Score: +1 +1 Good Answer/Helpful |
#144442 - PLCs Responding to: ???'s previous message |
Most of the small PLCs I've come across don't use a RTOS - they are a simple loop. I'm sure they use interrupts for the timers and serial comms and maybe for fast inputs/outputs.
Andy has discussed software timers which is how the PLCs I've looked at implement their timers. For most of the stuff I do, I use two interrupts - one for the main system tick timer and the other for serial comms. For a basic PLC controller, that's all you need. Most commercial PLCs execute a proprietry instruction set that does the basic operations. Many of the manufacturers document this as they allow you to write in PLC 'assembler' as well as ladder logic. You need to define your own instructions (or borrow someone elses) and write an interpreter to execute these instructions - no RTOS needed here as there is only one thread of execution - the interpreter works its way through the ladder/assembler code from start to finish then does it all again. Serial comms is usually done at the start or end of this loop as otherwise you'd have strange operations if the serial comms altered a value part way through the loop. |