Mitsubishi Index Registers

Tim

Member
Join Date
May 2002
Location
Indiana
Posts
291
Hi all,

I'm having a little trouble understanding how an index register works. One of my big problems is that I've never needed this command and so I don't have any experience with it. I'm trying to learn some more of the "advanced" commands that Mitsubishi PLC's have, so if I ever run across them, I would know how they worked. I know of one system at work that uses index registers at work, it’s our paint line.
Index registers are my first stopping point. I can usually figure out a command by reading the manual and trying it on a test station, but this one really has got me. Below I've put the explanation of an index register that came out of the A series manual. If anyone has a situation where an index register would be of use, I would appreciate it if you could lead me in that direction. I have a test station to simulate any ideas, “its the best way I can learn". I have to put my thoughts into actions to get it to stick banghead into my brain. If I haven’t supplied enough info, let me know.

Thank You,
Happy Holidays
Tim Surber


Index registers (Z, V)
Index registers are used to designate indirectly the devices (X, Y, M, L, S, B, F, T, C, D, W, R, K, H, and P) which are used with basic and application instructions.
This indirect designation of devices is disabled when those instructions which use bit devices (X, Y, M, L, S, B, F, T, and C) in units of each device for contacts, coils, etc. are used.

Each index register consists of 16 bits which is the unit of data read and write. Two index registers (Z, V) are provided.
Index register Z, when used with a 32-bit instruction, holds the lower 16 bits and V holds the higher 16 bits.

A 32-bit instruction cannot be used to designate V.
 
Tim said:
I'm trying to learn some more of the "advanced" commands that Mitsubishi PLC's have

Excellent!

Below I've put the explanation of an index register that came out of the A series manual. If anyone has a situation where an index register would be of use, I would appreciate it if you could lead me in that direction. I have a test station to simulate any ideas, “its the best way I can learn". I have to put my thoughts into actions to get it to stick banghead into my brain. If I haven’t supplied enough info, let me know.


I have an FX. Your description of A index registers is similar to FX registers so here it goes.

The there are three ways index registers are used to access data:

1. to access data in an array.
2. to access data in a structure.
3. to pass parameters to subroutines.

I will explain the array application first and leave the others for a latter post.

Say for instance your want to tally french fries ( frits ) by length. The french are measure by some device that proves the length in 1/16th of an inch increments and the longest fries should be no longer than 6 inches. Do store this information one need to count each length and since there are 16 16ths * 6 inches there are 96 lengths that must be counted. Lets assign those lengths to memory locations D100-D195.

Now to increment the tally by length one would

Code:
       MOV   LENGTH,Z
       ADD   1,D100Z,D100Z

I am assume LENGTH is a D??? register someplace.

If the length of a fry is 2 and a half inches or 40/16 inches then LENGTH = 40. This number is loaded into the Z register. The D100Z now means D100+Z or D100+40 or D140. The location D140 now gets incremented by one. If the next fry is 3 inches long the LENGTH = 48 ( 3*16 ) and 1 gets added to D100Z or D100+48 or D148.

I hope this is clear. I tried to come up with an example that is simple, but could not easily be done any other way.

Ask again and I will explain #2 or #3 which ever you request.

BTW, knowing the distribution of fry lengths ( histogram ) is important. If the fries get to small they must start adding larger potatos. If the fry are two big then smaller, more plentiful, potatos can be added. We cut strips(uncooked fries), not pickles, with precision.
 
V registers

Hi Tim,

I also found it difficult getting my head around V Registers, But i was lucky enough to have the help of a great programmer who posts here often. The best way to grasp this problem is to write a little program and monitor it. Here is the example i was given.

A timer that is indirectly addressed by a D register, say D0.
In this program, at the beginning MOV 5 different values into D10, D11,D12,D13,D14. ( Use M8002 to move the figures into those addresses at power up )

Now setup the timer to time out and reset itself.
T0 D0
On the `done bit' of timer T0 Mov D10V D0
And also on the done bit of T0 INC V

This will move the value of D10, D11 etc in order into the timer each time around, altering the time value of T0 with each reset.

You have to be careful with V and not let its value run away. You have to CMP it with the maximum value you require, other wise it will keep INC incrementing and will read the wrong D register.

EG CMP V K4 M2. When this value is met , use M3 to MOV K0 V

If you get this program right the time T0 will time out with your preset value starting at D10 then D11 etc. The CMP will reset V to 0 and the program should cycle forever.

Give it a try, i'm sure it will help you grasp the V registers

Regards

Lightning UK
 
Last edited:
Peter and lightning, Thank You Thank you!!!
Great information by both of you. I knew I just needed a little nudge to get going in the right direction.

Lightning, I'm going to try your example and Peter [2. to access data in a structure.] when you get time.

Thanks again to both of you.
Happy holidays,
Tim
 
Lightning,

Ok, here is what I got so far. I am testing the code on a AOJ2H cpu "dinosaur", so I couldn't use the compare statement as you suggested, its actually the same thing but works a little different.
Anyways, I tested the code and don't believe I have it correct, but I'm getting there.

First, D0 is changing values when T0 times out. It starts out at 5 then moves to 10,15,20,25 when T0 times up. That so far, has been a learning experience. What I cannot do for some reason is to get the new preset value from D10 to D14 to T0. I'm obviously missing something. Your thoughts would be appreciated.

Thank You
Tim

 
M9039
--| |------------------|---------[MOVP K5 D10]---
RUN FLAG |---------[MOVP K10 D11]---
|---------[MOVP K15 D12]---
|---------[MOVP K20 D13]---
|---------[MOVP K25 D14]---

X1 T0
--| |--------|\|-----------------------(TO K30)---
TOGGLE
SWITCH

T0
--| |-----------|----------------[MOVP D10V D0]---
|
|----------------[INCP V]---------

--[= K5 V]---------------------[MOV K0 V]-------

 
The object of the lesson was to make T0 time for different lengths through indirect addressing and index registers.

The T0 K30 should be T0 D0 (K30 is a set time of 3 secs) If you indirectly address the timer setting by using D0, as D0 changes, the time setting will change.
 
ahhh... Thank you Goody!
I see what I did.
A lesson learned thanks to all of you.

BTW, You UK guys seem to know your Mitsubishi plc's pretty well. Are Mitsubishi plc's leading the way over there?

Tim Surber
 
Hi Tim

I'm pleased to see you have had ago at the timer code.

As Goody as already said T0 should be controlled by D0

The last line also needs more work, Have another go and post here, I will glady help you with your V reg problems

regards

Lightning uk
 
Lightning,
This line right?
--[= K5 V]---------------------[MOV K0 V]-------
I'm not sure what your talking about. It seems to work fine. I tried to use your CMP V K4 M2, but D10 to D14 are 5 indexing points, "I never got my K30 value to T0 by using K4". Also, as I stated the A series to my knowledge, does'nt have the same compare statement as you have choosen with the FX plc. I would prefer to use an FX, but they are still a little new. I don't think I could talk my work out of one, not yet at least. Let me know if I'm missing something.

Oh and BTW this is not a school project. I only wish I would have gone to or could afford school. I had to learn PLC's the hard way. I got an Electricians job and a very smart individual introduce me to them. Now, five years later, I'm addicted to them and work with them everyday along with robots, "my other passion". Love the line of work!! "Especially Mitsubishi Plc's"

Thanks
Tim beerchug
 
Hi Tim


I've never seen the Mits A series code. But there must be a way to compare a value

This is how it is done with the FX

-[ X0 ]--------[ / T0 ]------------[ CMP V K5 M2 ]

-[ M3 ]---------------------------[ MOV KO V ]

Regards

Lightning
 
Lightning,
Below is a little info on comparison operations used in the A series.
It also uses the: <,>,< >,=,<=,etc. etc.
I'm familiar with FX, "its what I prefer to use".
Thanks
Tim



A series
Comparison Operation Instructions
(1) The comparison operation instructions make numerical magnitude comparisons(such as =, >, and <) between two pieces of data. They are handled as a contact,and turn on when their preceding condition holds.
(2) The application of comparison operation instruction is the same as that of the contact instruction for the corresponding sequence instruction as indicated below:
• LD, LDI: LD =, LDD =
• AND, ANI: AND =, ANDD =
• OR, ORI: OR =, ORD =
 

Similar Topics

Hello, I was wondering if there is a way to increas the index registers? Right now there is Z0 to Z6 and I need [2] more. Is this possible to...
Replies
3
Views
2,445
G
Hi. I'm need some help... There is description of my problem: I'm trying to set outputs from Y300 to Y310 using Z0 as Index. ... MOVP K5...
Replies
2
Views
4,745
I'm struggling to get an FR-E800SCE to work on CC-Link IE TSN. I'm sure the issue is with the drive, when I plug in the network cable I get no...
Replies
1
Views
77
Hi , Where i can find Mitsubishi PLC Card end of line & replacement model details. i am looking for Q02CPU replacement model. Please advice. thanks
Replies
2
Views
107
Hi guys, Im trying to set the real time clock in my Mitsubishi FX1N, but it shows this error ES: 01800001 I have good communication with...
Replies
3
Views
123
Back
Top Bottom