2

What does the "@" sign means in ladder programming? Documentation explains the @ specifies an indirect DM address in binary mode ... offset an memory area: what does that mean actually?

Consider the following image from the documentation:

enter image description here

How can the content of a the address (a 16 bits or decimal 32767) becomes the word address? For example, if adress CIO 0 has content of 000000001000000: adding the @ sign the CIO 0 changes to 000000001000000? What exactly is moving in the above instruction?

J...
  • 30,968
  • 6
  • 66
  • 143
KMC
  • 19,548
  • 58
  • 164
  • 253

2 Answers2

3

This works for DM (Data Memory) only. There are many memory areas of an Omron PLC. CIO is usually used for input/output bits only. W (work) is used to store working memory bits (think RAM), H (hold) is used to store bits whose values must be retained if power is lost (think Hard Drive, bit data). DM and EM are used primarily for holding WORD data, also stored if power is lost. There are no hard and fast rules about this, of course - in a lot of circumstances you can use CIO bits in place of W bits, for example, if you want to, but each has certain unique features that differentiate them and make them more suitable for certain purposes.

In this case the @ symbol works like a pointer. If I used the instruction [MOV #1 D300] I would move the hex data [x0001] to memory location D300. To be clear, #1 (the second argument) is a hexadecimal (symbol #) constant of value x0001. If, as in the above example, D300 contained the value [x0100] (=256 decimal) and if I used the instruction [MOV #1 @D300] I would not move the value [x0001] to D300 but I would move it to the address contained in D300 - in this case D256.

Note that the @ symbol is used for pointers in binary/hex format. If D300 = [x0100] then a MOV instruction to @D300 will move data to D256 (hex 0100). You can also use the * modifier to do [MOV #1 *D300] and this will treat the 0100 stored in D300 as a BCD value - in other words, instead of pointing to D256 it will point to D100!

Using pointers allows you to not have to modify your MOV instruction, for example, if you want to direct a value to a series of different places in different conditions. If you wanted to redirect the memory movement to a different address you would just update the address value stored in D300.

Note that the @ symbol can mean other things with mnemonics - @LD, for example, means a differential UP contact!

J...
  • 30,968
  • 6
  • 66
  • 143
  • +1 Clear! Did you really manage to understand the english in the documentation, or are there tutorials available online? Question from your answer: *modifier gives a BCD pointer, but doesn't a BCD of 0100 = decimal 4, hence point to D004 instead of D100? – KMC Feb 20 '12 at 02:52
  • No, this is x0100 - hexadecimal, not binary. Hex 0100 = binary (0000 0001 0000 0000), which as BCD is 0100 (one hundred). Each word can hold (x0000-xFFFF). If you throw away the hex digits it can hold (x0000-x9999) - a loss of information for a readability convenience. The PLC can interpret a hex number as a decimal number (ie:BCD) this way so long as you don't use A-F. – J... Feb 20 '12 at 11:36
  • And, no I didn't really follow any tutorials, but I already knew PLC programming when starting with Omron. Maybe something like the DL450 manual would be more clear on concepts - it's not for Omron, but most of the ideas are the same : http://www.automationdirect.com/static/manuals/d4user/d4user.pdf -- see chapter 5 – J... Feb 20 '12 at 11:41
  • ^ keep in mind that there are some things which an Omron PLC will let you do which a DL450 won't - multiple outputs per rung, logic after splits, etc. It may just help out with basics. – J... Feb 20 '12 at 11:43
  • "@" treats content as Binary: hence 0100 points to D256 (because 0100 binary = 256 decimal). And * treats content as BCD, hence 0100 in BCD convert to 4 in decimal so points to D004 (because 0100 BCD = 4 decimal) no? Why did * treat the content as hex, then convert to binary and taken as BCD? confused. – KMC Feb 21 '12 at 03:02
  • A word is four hex digits. A hex digit can be 0-F. Each hex digit represents four binary digits. @ treats content as HEX : hence x0100 points to D256 because HEX 0100 (ie : x0100) equals 256 decimal. HEX 0100 (ie: x0100) is just 100 BCD (not four!). BCD = HEX. The data are the same, the only difference is how you interpret them. If I write x0010 (HEX) it means sixteen. If I call that data BCD it means ten. BCD is HEX - you just don't use the values A-F and consider the four hex digits to be decimal digits. – J... Feb 21 '12 at 10:11
  • Maybe I should use an example without ones and zeroes to make the point. Consider the hex value [x013A] -> this is equal to decimal value 314. This value cannot be BCD. Now consider the hex value [x0249] -> this is equal to decimal 585. If, however, you are using this value as a BCD number it is equal to just 249 - plain and simple. In binary [x0249] = 0000 0010 0100 1001. Sixteen binary bits - one word - four hex digits. Follow? – J... Feb 21 '12 at 10:15
  • referencing [this SO post](http://stackoverflow.com/questions/4494664/binary-coded-decimal-bcd-to-hexadecimal-conversion) and using [online BCD-Hex converter](http://www.miniwebtool.com/bcd-to-hex-converter/), BCD != Hex and both indicate BCD 0100 = 4 (Hex) = 4 (Decimal). – KMC Feb 21 '12 at 10:20
  • BINARY BCD [b0100] = 4. HEX BCD [x0100] = BINARY BCD [0000 0001 0000 0000] = 100 decimal. Binary is not hex. See the above example. You are confusing things. – J... Feb 21 '12 at 10:28
  • You're not thinking - put away the converter and think about it. – J... Feb 21 '12 at 10:55
  • I was thinking for days: the * pointer is of type BCD, the pointer points to an memory address of content 0100 and read 0100 as a BCD type. BCD is a binary-coded-decimal that has 4 bits to represent 0-9 in decimal. So 0100 should move to D4, instead of D100. Same for @ which I understand, but applying the same logic for *, it gives me 4. – KMC Feb 21 '12 at 10:59
  • no, no, no - the memory location has SIXTEEN BITS. Each hex digit is FOUR BINARY DIGITS. 4 x 4 = 16... – J... Feb 21 '12 at 11:10
1

The @ sign in a function in Omron PLC means it operates only on a leading edge. For example, With the older PLCs @INC or with the newer PLCs @++ means increment a channel by 1 on a leading edge. The ++ function in the newer PLCs is binary while the INC function in the older PLCs is BCD.