??? 11/02/04 06:21 Read: times |
#80246 - RE: PLC SPEC - Requirement Responding to: ???'s previous message |
I normally use Schneider TWIDO plcs - as they use MODBUS. These can be configured as a modbus master or slave and can have two serial ports - RS485 or RS232. See www.twido.com for more info. As you may be aware, PLCs are just a micro with custom hardware and software. The TWIDOs use a Mitsubishi flash based micro (you can reflash them with your own code if you're brave). The PLC software interprets a 'machine code' which varies from manufacturer to manufacturer (and from model to model). The user software (on the PC) converts the ladder logic representation into this 'machine code' which is downloaded onto the PLC. From this point on, the PLC can operate stand alone. The usual processing loop of a PLC is: read inputs process the 'machine code' update outputs process modbus comms (if any) goto beginning Therefore the PLc can only process one modbus request per processing loop. The time of this processing loop varies depending on the downloaded 'machine code' that represents the ladder logic. Therefore, if there is a lot of logic to process, the modbus response maybe slow. An average number for a small PLC may be around 200mS for a process loop. Normally, the PLC would be a Modbus slave and the PC the master. The PLC still operates even though there is no communication from the PC - the PC usually requests the input values and status. The PC can update variables like alarm values via the Modbus communication. The PC can read the input values and update output values or bits via the Modbus if it is required. In some applications I have just used the PLC as an i/o device for the PC - the PLC has no ladder logic so the outputs are under control from the PC. You can decide for yourself where you want the processing to happen. As for designing your own PLC - commercially it's hard to beat a mass-produced piece of hardware. Most PLCs are expensive when you want analog inputs/outputs - my solution here would be to reverse engineer the PLC's i/o expansion bus and build a board to suit your requirements. That way, you minimise your hardware and software design time. There are a couple of Modbus tools for the PC that are well worth purchasing - MODSCAN and MODSIM, modscan is a modbus master program for the pc that allows you to talk to modbus slave devices, MODSIM emulates a modbus slave device on the PC. Just what you need when debugging your own code. see www.win-tech.com Just a suggestion here - you've mentioned three different micros for use in your project - try to settle on one as you'll only need one set of software tools to do the lot. My leaning would be an AVR or an ARM processor rather than a 8051/2 - since I do most of my code in 'c' the choice of processor is only a minor concern - it comes down to what cpu has the best set of peripherals suited to the job and the availability/cost of it. Like most of the other respondants, we've all built boards with digital i/o, analog and maybe a lcd display, I've often thought of adding the ability to interpret the ladder logic machine language, but have never been motivated enough to do it - I just write the logic in 'c' as with the rest of the code. I have a standard framework of code that does the i/o and modbus and I just add the code to do what I need. That's served me well for the last 6 years on about 6 different micros. |