3 ms·
I just got my feet wet with an s7-1200 and I could not have imagined how horrible the programming of a PLC is. I spent a day just to get the plc send out UDP pa
by tda 4y ago
I just got my feet wet with an s7-1200 and I could not have imagined how horrible the programming of a PLC is. I spent a day just to get the plc send out UDP packets at 25Hz.
Apparently going above 10Hz is not really supported so you have to do silly tricks. I ended up running the send command on every tick, and running a time triggered cycle that toggles a bit at 50Hz and then using the rising edge of that bit to actually start the secretly async task of sending 20 bytes on the wire.
Son far I have learnt that async tasks are hidden, memory is measured in Kb, there is no guarantee for cycle time whatsoever, the programming model is really awkward, lots of config cannot be stored as code, version control is a bolted on nightmare, etc, etc.
Really makes me wonder what a PLC can do that an arduino/esp32/rp2040 can not. I'm really struggling to see the value other than that the hardware is reliable and "industrial".
- dfox 4y agoIn industrial automation you are not supposed to do anything at 50Hz, the reasoning is simple: more times than not you are simply turning on and off something that is AC powered and you do that probably with mechanical relays and contactors, quite obviously it is pointless to do that faster than some multiple of AC line period. It is simply about trusting the supplier, certifications and perceived reliability of the thing. On the other hand even brand name PLC hardware is not that expensive if you factor in the fact that interfacing with 24V and mains-level logic is somewhat complex engineering problem. Relays and optocouplers are expensive. Edit: and as for what PLCs can do that random MCU cannot: the Chinese Mitsubishi GX/FX clones mentioned in the sibling thread are essentially STM32 eval boards with industrial I/O and preloaded PLC firmware, nothing more, nothing less, so there you go.