L 1 and L#1 (S7)

The first, "L 1", is an instruction: Load the 16-bit integer constant with value 1 in to accumulator 1.

The second, "L#1", is a 32-bit integer constant with value 1.

More info can be found in the helpfiles if you search for "Elementary Data Types".

Kind regards,
 
for 1

L 60000
T MW100
// will not work


L#60000
T MD100
// will work


L 1 or L#1..., same to me

manmeetvirdi said:
Hi there
Whats the difference between
L 1
and
L#1
??
 
If you enter
Code:
L 60000

the editor will accept it and automatically convert it to the correct form.
Code:
L L#60000

entering
Code:
L#60000

will not work.

The real significant difference between these instructions comes when you need to enter negative numbers:

Code:
L -1

and
Code:
L L#-1

results in completely different values being loaded into the accumulator.
 
:)

Thanks for the correction, didn't test what I was saying. Better check before I speak.

L#60000 will not work, Load L#60000 does, okay. Why L L#60000 ? I cannot test this, I'm not at work.

In the 8 years that I program, I never used L#


I allways convert with ITD, DTR, do the calculations I need an reconvert it to Integers. I never do something with Double Integers, I know DINT can be processed faster then Reals, but I don't care about that.


L D[AR2 said:
If you enter
Code:
L 60000

the editor will accept it and automatically convert it to the correct form.
Code:
L L#60000

entering
Code:
L#60000

will not work.

The real significant difference between these instructions comes when you need to enter negative numbers:

Code:
L -1

and
Code:
L L#-1

results in completely different values being loaded into the accumulator.
 
Last edited:
I never do something with Double Integers, I know DINT can be processed faster then Reals, but I don't care about that.

It's not just about speed!

One (good) reason to use DINTs is that so long as you're working within their limits, the results are usually more accurate than REALs. With REALs you're limited to the seven digits of the exponent.
 
...

I never had troubles with calculations

even for syncronisation of drives I do it with reals...


RMA said:
Oops, that should, of course, be seven significant digits of the mantissa!
 
hmmm

RMA told me a long time ago this:

By the way, depending on the values that you are working with, don't forget that you may be able to get (substantially) better resolution by working with DINTs instead of REALs, since your resolution with REALs is limited to six (or is it seven?) significant digits. The trade-off is that you have to pay close attention to the order in which you do the calculation so as to avoid over- or under-flow. You also need to check for these errors.

So watching out of the order with DINT, or troubles... as long as I don't have such large numbers, I will not use DINT I think...


Banker said:
Try in the PLC 1,000,000.00 + 0.1

Banker
 
Back
Top Bottom