Indirect address?

josesaucedo

Member
Join Date
Nov 2005
Location
Van Nuys, CA.
Posts
78
Hello everybody.
I've been working with some projects with a micrologix1000. Now I have one project tha I need to download into the Micro 1500. It's a project where I'm using a SEQUENCER, a TIMER and a MOVE instruction, but it does not accept the index address #N7:0 in the MOVE instruction. I've gone through my textbook to find more about it and I found that I have to write an indirect address which uses the POSITION value from the sequencer to transfer a value from file N7 to the timer preset each time the sequencer increments to a new step.
Can anybody gime more information about indirect address?

Thanks guys.
 
Hello folks!

It's been hard to me to understand the difference between direct address and indirect address, the only thing that I know so far is that the micrologix 1200 and 1500 do not accept direct address, only indirect address. I've been researching different ways and I just dont get it. I found a example on how to write an indirect address with a move instruction. If you stored a value of 3 in N10:0, then the source of the MOV istruction would be value in N7:3. Or if the value of N10:0 was 15, then the source of the MOV instruction would be the value of N7:15.
In my case, what happen when I have more than one value in N7. For instance, I store 0 in N7:0, 1600 in N7:1, 400 in N7:2, and 100 in N7:3. Any help will be well appreciated.
Thamks
 
I'm not understanding your question jose. You want to move N7:0 into another register with a mov statement? Just do it.
mov n7:0 t4:0.pre
No need to have the #. If you're looking to move a range of registers into another file or set of registers, use the cop instruction. That one does need the #, and it works in the micro 1500.
cop #n7:0 #n9:0 255
will copy the entire N7 file into the N9 file for whatever nefarious purposes you have in mind.

If this doesn't help, please try to explain what you are trying to do a little better.


-jeff
 
From an old thread here

-------------------------------------

If it helps you out, think of it like this:

A direct address is like a street address. Its always the same place. 2342 Washington Lane is a direct address. It can mean only one place.

An indirect address doesn't tell you the exact address number, but it tell you how many houses to go on the street to find it. This number can be changed.
Its the sixth house on Washington Lane or
Its the tenth house on Washington Lane

An indexed address would be when the house location is described in relation to a nearby known address. This can also be changed.
Its the second house after 2305 Washington Lane or
Its the one house before 2305 Wahsington Lane.

Now to the PLC:
B3:0/9 refers to only a single bit in memory. It cannot refer to any other.

B3:0/[N7:0] can refer to any bit in the word B3:0. If the number in N7:0 is a five, then it refers to bit five, or B3:0/5. But don't go sticking a 19 in N7:0 - you'll indirect past the end of the word. N10:[N7:0] would refer to a word in file N10. If you have a value of 5 in N7:0, then it refers to word five, N10:5.

If the value in S:24 is 5 then #N7:3 is an indexed address that refers to the address five words after N7:3, or N7:8. If S:24 is -1 then its the address one word before N7:3, or N7:2.

You can combine indirect and indexed addresses, as in its the third house past the sixth house on Washington Lane, but if you are a beginner I recommend you avoid that until you have a grip on the fundamentals first.
 
josesaucedo said:
It's been hard to me to understand the difference between direct address and indirect address, the only thing that I know so far is that the micrologix 1200 and 1500 do not accept direct address, only indirect address. I've been researching different ways and I just dont get it. I found a example on how to write an indirect address with a move instruction. If you stored a value of 3 in N10:0, then the source of the MOV istruction would be value in N7:3. Or if the value of N10:0 was 15, then the source of the MOV instruction would be the value of N7:15.
In my case, what happen when I have more than one value in N7. For instance, I store 0 in N7:0, 1600 in N7:1, 400 in N7:2, and 100 in N7:3. Any help will be well appreciated.
Thamks

Direct vs indirect is easy to understand. I suspect you are making it more difficult than it really is. Direct addressing is the simplest. N7:0 is a direct address, and all AB processors will accept that. In an indirect address, you replace the element of the address (which is the 0 in N7:0) with a pointer. As far as i know, all AB processors accept these as well. Those look kinda like N7:[N10:0]. In this case, the program knows its an indirect address because of the braces []. It will go to N10:0, and use whatever number is in there as the element of the address. So, if there is a 100 in N10:0, the program will use the value in N7:100 for that particular logical operation. If there is a 25000 in N10:0, I think the processor will fault because that would be an illegal element.

I think when you put a # in front of the address, that is called de-refrencing. I'm not sure what that means exactly, all i know is that its needed on some file instructions like cop, or fll. And again, as far as i know, all AB processors accept these as well, but only in the instruction types that need them.

Now, if I got any of this wrong, someone please chime in and correct me. I don't remember where i picked up that # is called de-refrencing, so that could be wrong, and I don't think I ever fully understood the purpose of it. So, I'd appreciate if anyone could explain it for me.



-jeff
 
OK amigos, this is what I'm trying to do.
I could program a traffic light to a micrologix 1000 that I have in home (to practice) and it works, but now I have to program it to the micrologix 1500 that I use at school. First: This is a traffic light program which I have to use a TON, SQO, and a MOV instruction.I stored the time for every position in N7, 0 to 5. When I programmed it to the micro 1000, I used an index address for the MOV instruction "Source: #N7:0", and now for the micro 1500 I have to use an indirect address for the MOV instruction. In this case I have a length of 6 in the SQO, which it means that it has 6 positions. Does it help to understand what I try to do or need more information?
Thanks.
 
Jose, perhaps if you post what you have for your program so far it will help. If I understand you right, whatever value you have in S:24 needs to be in your indirection register for the ML1500, but I'm not 100% sure I understand what you are doing.



Hakutsuru said:
I think when you put a # in front of the address, that is called de-refrencing.

Jeff, the correct term is indexed addressing. The entered address is a base address and the actual address used will be (base address)+S:24. Beware, many instructions modify the contents of S:24 so it may be necessary in some instances to initialize it. Refer to the instruction set reference manuals to know when.
 
Last edited:
Alaric said:
Jeff, the correct term is indexed addressing. The entered address is a base address and the actual address used will be (base address)+S:24. Beware, many instructions modify the contents of S:24 so it may be necessary in some instances to initialize it. Refer to the instruction set reference manuals to know when.


Wow. I've used indexed addresses before, but I'd never heard about the deal with the s:24 register. I guess I was just lucky, or maybe its because I actually never intended to use indexing, but on the file instructions it indexed the addresses for me automatically. So anyway, here's what I still can't wrap my mind around. Why would you use indexed addressing? In a mov statement it seems silly, where else can you use them? It seems like you could accomplish the same thing with indirect addressing and have better control over the pointer. Right?


-jeff
 
Hakutsuru said:
Wow. I've used indexed addresses before, but I'd never heard about the deal with the s:24 register. I guess I was just lucky, or maybe its because I actually never intended to use indexing, but on the file instructions it indexed the addresses for me automatically. So anyway, here's what I still can't wrap my mind around. Why would you use indexed addressing? In a mov statement it seems silly, where else can you use them? It seems like you could accomplish the same thing with indirect addressing and have better control over the pointer. Right?


-jeff
Jeff, when using an instruction such as COP you don't need to worry about the S:24 register contents. The instruction itself takes care of that. But if you use indexed addressing and also use a COP instruction or any other instruction that modifies S:24, then you need to be careful. Consider the following:

Add N7:0 N7:1 S:24 //S:24 equals N7:0+N7:1
Add #N9:0 N7:2 N7:3 //S:24 still equals N7:0+N7:1
COP #N10:0 #N10:5 5 //S:24 is reset after this insruction

Then note that in this case the value for S:24 must be calculated every time and written every time because the COP instruciton would have also modified S:24.
 
Last edited:

Similar Topics

Hi everyone, I hope you can help me. Im working with get the production parts of all hours-day using STL. My idea is to use an array [0..23] of...
Replies
9
Views
3,840
Hi, I have a DB in my program with all the alarms of a machine, but the machine is divided in stations. So I want to check if any station is with...
Replies
2
Views
2,080
I have an indirect PLC5 code conversion I can not figure out how to convert to CLX Anyone have a solution Thanks
Replies
11
Views
4,144
In an old PLC5 I see an output like this B37 -()- [N19:21] If I remember correctly that says to set the bit of word 37 thats equal to the value...
Replies
13
Views
6,939
Good day all. I have an alarm that has been triggered and I can't figure out what is triggering it. When I go to the alarm table it shows an...
Replies
4
Views
2,153
Back
Top Bottom