I'm glad you liked it. I was hopping to get some time and write something
like tutorial. As time goes by I'm startimg to think to pass this task to
my clones one day
Anyway, here are few more hints:
Always make sure to get actual user manual for any Mitsubishi piece of
hardware you use. Some things are not straight forward (Japanese do
have different way of thinking or looking at things...). Be sure to read at least
chapter that apply to your project or you will be sorry later on! (read down for
some of the things you shoud watch for...). Also there are some differences
between components that need to be considered and this applies to CPUs:
Different families (A, Q, FX...) have different status devices (first scan, always on, etc.).
Different families have different I/O addressing (hexadecimal, octal), instructions etc.
Make sure to investigate BEFORE writing program if your Mitsubishi PLC will
be part of network and what type of network. If you have to share data between
different nodes you must be carefull with memory overlaping. For example
if you use CC-Link you have to make sure that addresses of shared memory
and remote I/Os of different systems do not overlap. If you do messaging
or write directly to memory of other system, you can write where ever you
want to (make sure it is not used for someting else).
In order to use any card on rack based system, you MUST specify mapped
I/O range for each card. This goes in increments of 16, 32, 48 or 64 points.
Some people put 32 point for every card (48 and 64 are supposedly rare,
or at least I've never used one). Begin of the mapped I/O range is called
BASE ADDRESS. For example you have 6 cards (16, 32, 16, 16, 32 and 16
points):
card1 uses 00-0Fh so base address is 0h
card2 uses 10-2Fh so base address is 10h
card3 uses 30-3Fh so base address is 30h
card4 uses 40-4Fh so base address is 40h
card5 uses 50-6Fh so base address is 50h
card6 uses 70-7Fh so base address is 70h
All cards except digital inputs and outputs are SPECIAL CARDS.
Typically they use 32points (just to initialize and enable card and to provide
staus like card faulted etc.). All other communication is done by accessing
internal memory of the card. Part of the special cards memory that can be accessed
by PLC CPU is called BUFFER.
You can read or write buffer (some places can be accessed for reading only).
So if you have say analog input card, you would have to write couple integers
into buffer of that card to configure it, enable channels you want to use and
then read from certain buffer location analog values you need.
This concept applies to ALL special card (analog output, servo controller,
CC Link, communication cards such as RS232/422, MNET, Ethernet etc.).
There are several ways to read and write buffer. Most common way to do so
(or most compatible with different PLC families) is using TO and FROM
instructions (most PLCs support only TO and FROM instructions!).
As with all other instructions, these two also have their "Pulse" cousins TOP and FROMP.
Anyway, general format is
---| |-------------[FROM A S D L]
FROM - Instruction name
A - base address
S - source (buffer register number to start reading from)
D - destination (PLC register where data will be written to)
L - length of transfer (number of 16-bit words)
Note: When entering base address, omit last digit (If the base address is 1CF0h, use
only "1CF").
For example to read 7 words from buffer locations 30,31,32,33,34,35 and 36
from card with base address 7C0h and place result into D file registers
D82-D88 use someting like:
---| |----------------[FROM h7C k30 D82 k7]
It is just a block transfer...
And of course you can choose to use parameters in decimal or hex format (Hxxx or Kxxx).
One thing to note is that this type of transfers is quite slow and it should be used with
care if scan time is critical. Since same overhead is used for each TO or FROM instruction
it is much more efficient to read 7 words using one instruction than reading 7 words one by one.
Actually you can calculate exact timing for any instruction (just read the manual to get the
latency times and then calculate using length of block you want to reansfer).
Final note:
If you are used to AB PLCs you will be shocked to find out that settings or parameters
you entered for your precios machine have disappeared after PLC was powered down.
Well, Japanese do not backup whole memory so once you power up, content of the
bits or registers is gone. If you use FX PLCs, read the manual. Some of the registers are
lost and some are latched (content retained). On bigger PLCs you can specify what range
to be latched (it's in the parameters).
Regards,