fishenguy

Using an integer is something I don't know how to do, yet. I need to see that in a simple example in ladder logic.

here's a very quick example ...

use_integer.JPG
 
Ron Beaufort said:
here's a very quick example ...

use_integer.JPG
I guess what I'm seeing is N7:0 can either be loaded with a whole number or I can MOV another bit of information from any true line of logic. When the line of logic comes true, the number stored in the source of the MOV instruction will go to the integer listed in the Dest. Am I right so far or is there more I need to understand about integers?
 
Yes, you are right about the loading of values into an integer data type. You can also use them as math results. You can add 2 seperate integer addresses and place them into a 3rd, add an integer with a constant value, place the result into a new integer, or use the same integer as the result for an accumulator, as in Ron's earlier posts.
 
Last edited:
Ok TD, It's beginning to make sense. I MOV values into an integer and I can use that integer on a line of logic with a COMP. command? Thanks
 
basics of integers ...

I think you've got it - but just in case ... sometimes the "algebra" analogy helps people understand ...

suppose we say that 3 + 5 = 8 ...

so far so good - but not very flexible ...

so suppose that we say Y + Z = X

and we store the value 3 in location Y ... and store the value 5 in location Z ... the answer value 8 will pop up in location X ... and now if the stored values are changed, the same "flexible" equation will give us a new answer in location X ...

big idea: in algebra the "letters" are used as "placeholders" or "variables" that can hold any number ...

now let's write the same "algebraic" equation in ladder logic ...

N7:1 + N7:2 = N7:0 ...

and if we store the value 3 in location N7:1 ... and store the value 5 in location N7:2 ... then the answer value 8 will pop up in location N7:0 ...

big idea: in ladder logic the "integers" are used as "placeholders" or "variables" that can hold any number ... well, almost any number ... it has to be a whole number (no fractions or decimal points allowed) and in most systems the value has to range somewhere between 32,767 and -32,768 ...

in simplest terms: think of the integer locations as "boxes" that can hold ANY number - as long as the number complies with the basic rules that I listed above ...
 
Ok, now how do I get the value of N7:1 and N7:2 into N7:0? My guess would be to write a line of logic with two MOV instructions on it and nothing else. The first instruction would have N7:1 as source A with Dest.N7:0. The second MOV instruction would have source A as N7:2 with Dest. N7:0. Is this close to being right(altho I know there is no "close", It's either right or wrong)?
 
Back
Top Bottom