Ladder

May 22, 2007 10 Replies

Hello to everyone, I'm new in Ladder programming. I want to compare if the value of a register is equal to 4. If this is true go to label 1, else go to label 2. How can i check if a register has the value that i want? Thanks!



Every ladder programming environment that I have seen has function blocks for doing things like EQU (equals), LSE (less than or equal), GTE (greater than or equal). Just select the right function block and fill in the parameter spaces.

******************************************************************** Paul E. Bennett .................... Forth based HIDECS Consultancy ..... Mob: +44 (0)7811-639972 Tel: +44 (0)1235-811095 Going Forth Safely ..... EBA. www.electric-boat-association.org.uk.. ********************************************************************

In C

if (reg == 4) { /* this is label 1 */ } else { /* this is label 2 */ } /* this comes next */

In Pascal

IF reg = 4 THEN BEGIN (* this is label 1 *) END (* no semi before ELSE *) ELSE BEGIN (* this is label 2 *) END; (* this comes next *)

I never heard of Ladder.

cbfalconer at maineline dot net

formatting link
formatting link

FWIW, for my masters degree I wrote a ladder diagram editor/compiler that generated C:

formatting link

The place I had worked always drew their ladder diagrams rotated 90 degrees (the "rungs" were vertical instead of horizontal) so that's how I did my examples.

Grant Edwards grante Yow! A shapely CATHOLIC at SCHOOLGIRL is FIDGETING visi.com inside my costume..

Something that did the opposite might be nicer :o) Then you could write all your PLC code in C.

-- Regards, Richard.

  • formatting link
    A free real time kernel for 8, 16 and 32bit systems.

  • formatting link
    An IEC 61508 compliant real time kernel for safety related systems.

Except I don't do PLC code.

At the time I was involved in going the other direction: we had piles of ladder diagrams that needed to be implemented in a procedure language. The language wasn't C, but the ladder diagram compiler can generate source code for pretty much any lanuage with infix boolean operators that can be explicitly grouped using parens or brackets of some sort.

The ladder diagrams had originally been implemented using relays and/or diode-matrixes.

Grant Edwards grante Yow! My mind is a potato at field ... visi.com

Isn't there some awful Pascal-like thing called "Structured Text" that people use for PLCs and map onto ladder logic?

pete

pete@fenelon.com "how many clever men have called the sun a fool?"

I think I remember reading about some ISO or ANSI standardized "structured text" representation that some PLC manufacturers support. IIRC, some of the PLC vendors had editors in which you could even switch back and forth between a ladder diagram view and a structured text view of a program (or something like that).

Since the project I worked on which used ladder diagrams didn't have anything to do with PLCs, I never really looked into it.

Grant Edwards grante Yow! MMM-MM!! So THIS is at BIO-NEBULATION! visi.com

See: IEC 61131-3

Best regards, Spehro Pefhany

"it's the network..." "The Journey is the reward" speff@interlog.com Info for manufacturers: http://www.trexon.com Embedded software/hardware/analog Info for designers: http://www.speff.com

Well, except for the 'map onto'. Structured tesxt is just another language. In prectice it is marginally more portable than the other standard PLC languages. At least cut and paste seems to work between PLC IDEs.

So far I've found one PLC that lets me import from/export to a text file (and thus to a decent editor).

I still haven't figured out a way to get Mitsubishi PLCs to accept functions or variable declarations. Variables must be entered in their database interface and I cannot determine how to enter functions at all. And yes, functions are part of stndard ST. I've had to resort to manually inlining.

Robert

Posted via a free Usenet account from http://www.teranews.com

grouped using parens or brackets of some sort.

I've been out of the control automation world for some time now, but I was impressed with the Step-7 software on Siemens' controllers.

The combined multiple program paradigms and in some cases could switch back and forth views, IIRC.

for a lot of stuff about automation in general, start at

formatting link

You can probably find a Step7 manual on line if you dig from here

formatting link

They even have PC-based control (they're not the only ones).

Rufus

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required