integer value = bits on

Doug,

That is not what I meant, although it was valuable information. What I was talking about is what Peter entered in his post #29. I was simply curious how the soure would be entered into the move instruction, in this case N9:[N7:0]. Thanks Peter for the example, and Doug for the help.
 
The # simply indicates that this is an 'indexed' address (rather than a direct address). It would be entered exactly as shown... #N9:[N7:0]. Here's a blurb from the Help file:
[attachment]
Note: Indexed addressing is not available in the ML1200/1500. Here's a clip from an old post of mine:

  • Though you can't use indexed addressing (i.e. #N7:50) with the ML1200 and 1500, you CAN use a register (let's use N7:50) to point to an offset (indirect addressing). For the value, you use brackets "[]" around the register containing the offset value. So, if the value of N7:50 is 41, and you use N7:[N7:50], this actually points to N7:41. Confused yet? It's kinda simple once you figure it out...
beerchug

-Eric

indexed.jpg
 
Eric:

As you know, I'm not famillar with the AB but heres a possable workaround if an instruction for indirect addressing is not available.

Pointers without the use of a pointer insturction:

A long time ago, before I wised up and read the ADC manual, I created a pointer by INC or DEC a memory location, to hold my pointer. I then used comparitave contacts drive an output to read the data in that actual data location.

V2000 is the pointer.



X0
---||---------|INC V2000|

X1
---||---------|DEC V2000|

WHAT EVER
----||---------------------------MLS (MCS)

---|V2000|=|K1|----------------|LD data 1|

---|V2000|=|K2|----------------|LD data 2|

---|V2000|=|K3|----------------|LD data 3|

AND SO ON....

--------------------------------MLR (MCR)
what ever
-----||--------------------|OUT -WHEREEVER|




P.S.
This only applies if this is what you guys are talking about...
(I have not read the entire thread)
 
Mike, I understand what you're taking about, but try not to confuse the 'AB only' guys with all that V2000, X1, INC, DEC, and LD stuff... ;)

beerchug

-Eric
 
I think you missed the "A long time ago, before I wised up and read the ADC manual" part, Peter... :D

beerchug

-Eric
 
This doesn't help much for an AB processor, or many of the others for that matter. If your programming tool supported all IEC 61131 languages then it could be accomplished simply with:

any_word:=REAL_TO_INT(EXPT(2,n)-1);

in structured text language.

I tested this in a WAGO controller and it works great!
 
Just because you can doesn't mean you should.

So

any_word:=REAL_TO_INT(EXPT(2,n)-1);

works. One should avoid exponenets and floating point whenever possible. Use

any_word:=SHL(1,n)-1;

instead. This can be many hundreds of times faster if the CPU does not have a hardware floating point unit.
 

Similar Topics

The analog array has 16 individual bits and each bit is an alarm. SCADA is having issues getting the BIT bool value. However they can get the...
Replies
9
Views
1,031
Hello, I need a little help. I’m looking for a way to program integer values to activate a bit for an alarm. for example... If any Integer[0] thru...
Replies
41
Views
7,908
Have beginner knowledge of digital controls, and intermediate/advanced knowledge of socket clients and listeners (written logging proxies, socket...
Replies
9
Views
3,770
Hi everyone :* I am using using unity pro v.13 i want to do the mathematical function of floor() which makes for example 1.2 to 1 and makes 2.9...
Replies
7
Views
3,106
Hi, Can someone help me explain in detail this integer Value. N7[4+((N151_0 AND -16)/16)].[N151_0 AND 15] Based on my understanding in the...
Replies
6
Views
2,598
Back
Top Bottom