English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I played with assembly language in the early 1990. Recently I started working with a Programmable Logic Controller (PLC) and felt a sense of Deja vu. My question is: Is RLL (ladder logic) a type of assembly language. More specifically, does each RLL instruction map directly to a specific machine language instruction, or is it more like a compiled language?

2007-12-07 11:32:07 · 2 answers · asked by Joel 2 in Computers & Internet Programming & Design

Thank you Mark, but your answer seems to contradict your evidence. Certainly a PC can quickly compile a simple program before uploading to the PLC, but does a hand-held programmer do this?! Also, your sample code looks very assembly like...load specific memory location, compare, branch, etc. (my software also allows me to see my program in a mnemonic view.)

Therefore, I see no evidence to contradict my assertion that ladder logic is indeed a form of assembly language, and that programming software or hand-held programmers simply translate each command into a native machine instruction.

2007-12-10 06:39:40 · update #1

2 answers

In my experience the ladder logic code is compiled and down loaded to the PLC. The PLC is nothing more than a robust micro controller so at some level the code you wrote becomes machine code.

Assembly code uses mnemonics inplace of the binary machine code.

PLC ladder logic diagrams are a graphic way of programming. There is a mnemonic way to program a PLC as well. Before laptops were cheap and easily available PLC code was written using a hand held programmer. A coding list would be written and transfered into teh PLC via the hand held programmer. A simple coding list would look like:

Line No Instruction Operand
0000...........LD................0000 (LD = Load)
0001...........AND.............0001 (input #1 not binary)
0002...........OR................1000 (memory location 1000)
0003...........AND.............0002 (Input #2)
0004...........OUT..............1000 (update memory 1000)
0005..........LD...................1000
0006..........OUT................0500 (Output #500, wire to a pump etc)
0007 ..........END
0008 ........ENDH

This is a simple two rung ladder converted into mnemonics for use with a handheld programmer

2007-12-07 14:03:50 · answer #1 · answered by MarkG 7 · 0 0

Assembler covers all of a number of low-level programming languages. Different processor architectures have different ISAs and therefore different versions of Assembler. In the modern world, most home PCs have the x86 or x64 architecture (32-bit Intel chips and 64-bit Intel chips, respectively), but there are some others out there, particularly in embedded and mobile devices. There are also some versions of Assembler for use in emulators. The important trait of Assembler is that every line of Assembler code translates into exactly one machine code instruction (or the equivalent in an emulation environment). Assembler is basically as low-level as programming gets as far as programmers are concerned, since the only things lower down are machine code itself (which nobody does serious programming in anymore, since Assembler is so much easier) and, below that, the logical structure of the processor (which is in the realm of hardware architecture) and the physical implementation (which is electrical engineering). Trying to write any large program in Assembler is kind of like trying to make a sand castle by positioning sand grains with a pair of tweezers; so it comes as no surprise that typical programmers do 99+% of their actual programming in higher-level languages like C++, Java, PHP or whatever. But when you need to have a supreme amount of control over exactly what is happening in the processor (generally in order to wring out some extra speed or dictate what the machine code will look like), that's when you turn to Assembler. Hackers have to use Assembler a lot because taking advantage of a security hole often involves manipulating memory and program flow in 'dangerous' ways that higher-level languages try to hide from you. Incidentally, the difficulty of using Assembler hasn't stopped some people from undertaking surprisingly large projects using it. The original Rollercoaster Tycoon was written (by a single person) almost entirely in Assembler, which is the main reason why it could maintain such a highly detailed simulation at a reasonable speed on the slow hardware available at that time.

2016-04-08 00:32:40 · answer #2 · answered by Anonymous · 0 0

fedest.com, questions and answers