Following are some miscellaneous notes that may help you with the driver for this PLC.
What is an MSP Driver?
An MSP driver is a small ladder logic program
that is added to the user program. All code is standard ladder logic. In the Aromat(NAiS)
FP0 it requires one line of logic in the main program and one to three subroutines. The
line of logic in the main program calls the MSP driver program, subroutine "1".
Subroutine "1" may be complete or call one or two other subroutines depending on
the version.
The user can copy the driver into their program by opening the driver file
and the target file simultaneously. Using Edit/Block Edit the desired rungs can be copied
from the driver program. Next the user will go to the target program, position the cursor
where desired and paste into the target program. Alternately the user could start with our
driver and build their program from it.
Drivers.
The following is a list of drivers in the MSP Driver
Library for the Aromat(NAiS) FP0 PLC. These drivers were prepared with the Aromat(NAiS)
FPsoft programming software, revision 1.06b. The single channel input and single channel
output drivers are available on the Driver Installation disks. All other drivers are
available on our web site. They contain rung comments and address descriptions that are
viewable in the programming package and on printouts.
DRIVER |
DESCRIPTION |
Msp_I |
1 Channel Input |
Msp_I_M |
2 Channel Input Multiplexed |
Msp_I_H |
1 Channel Input, High Speed Counter |
Msp_O |
1 Channel Output |
Msp_O_M |
2 Channel Output Multiplexed |
Msp_IO |
1 Channel Input, 1 Channel Output |
Msp_IO_M |
2 Channel Input Multiplexed,
2 Channel Output Multiplexed |
Different Models.
All drivers for the FP0 should work with very
little revision on other models. Aromat(NAiS)'s programming language and memory layout are
very similar in all models. The main differences are the memory map, I/O map, and how the
input filters are handled. Input filter times should be less than 1 msec. Memory locations
used in the drivers are available in all processors. Time based interrupts work the same
on the FP0, FP1 (24 I/O or higher) and FP-M. The FP3, FP5, and FP10 perform interrupts
differently than the micros.
Timing Parameters. These drivers are set up for the Delta
protocol. Following are some of the key timing parameters:
| Input |
|
| Protocol |
Delta |
| Scan Time |
10 msec (See Note 9) |
| Full Word Bits |
16 Bits |
| Delta Bits |
4 Bits |
| Delta Refresh Count |
16 Scan Refresh |
| ID Pulse Width |
1.2 Scans |
| Data Pulse Width |
3 Scans |
| Output |
|
| Protocol |
Delta |
| Scan Time |
10 msec (See Note 9) |
| Full Word Bits |
16 Bits |
| Delta Bits |
4 Bits |
| Delta Refresh Count |
16 Scan Refresh |
| ID Pulse Width |
3 Scans |
| Data Pulse Width |
3 Scans |
Quality Control File.
Included with the files for each driver is a
file of the same name with the ".sp" extension. This file contains the model and
serial numbers of all hardware and software used for testing. This file also contains the
setup parameters used for testing.
Scan Time.
The key to getting the driver to function properly is to
get the driver code executed and PLC I/O for the MSP updated at constant time intervals.
The FP0 PLCs have the ability to fix the scan of the PLC. Constant scan
time is set in the processor configuration package under "Options/PLC
Configuration" in the section "Act On Error & Time Out". The Constant
Scan Time must be set so that it matches the scan time in the MSP.
The constant scan time setpoint is really a minimum limit on scan time. If
program execution plus overhead is less than setpoint the processor will idle before
starting the next scan. I program execution plus overhead is greater than the setpoint the
next scan will start immediately. In the greater than case scan time floats and is no
longer deterministic.
As you develop your program watch the PLC Status Display. The PLC Status
Display is accessed under Monitor/Status Display in the menus. If the MAX Scan Time is
greater than the setpoint the setpoint should be increase to insure that it is the
controlling factor. Note that the numbers displayed for scan times are often 0.5 msec
larger than actual. Make sure that the scan time setpoints are the same in the FP0 and
MSP. To avoid having to continually change the scan time as the program is developed it
might be easier at the beginning of the project to set the scan time to some large number,
maybe 100 msec. Near completion set the scan time in the processor to 0 and read the value
in the MAX scan time. Finally, set the scan time value in the processor and MSP so they
are equal and slightly larger. The new setting must be a multiple of 5 msec.
A preferred method would be to use the Time-Initiated Interrupt. In the
FPO I found that this function did not work properly. The actual time interval was 1.8 to
2.6 msec longer than set. This error was not repeatable and resulted in cumulative errors
in execution time. If it works properly in other models it could be used with the IORF
(Partial I/O Update) instruction to execute the drive independent of the user program.
Scan Time Exceptions.
When possible the scan time is set at 10 msec.
This is the default setting of the MSP. On some older models it may have to be slowed
down. Those models with relay outputs must be slowed down when using MSP analog outputs.
The mechanical relays are slow when compared to solid state. We found a scan time of 50
msec worked reliably. Note that the Msp_IO_M driver effectively has 4 channels. For any of
the multiplexed drivers that are expanded to 4 or more channels on any model the scan time
should be watched closely and may have to be increased.
Programming Methods.
One of the key programming methods is the use
of memory locations that are accessed both as registers and bits. We used the R/WR memory
for this purpose. When accessed as a bit it is an R address and when accessed as a word it
is a WR address. In several cases we use a shift register as a counters. A seed is planted
in bit zero of the shift register word. To increment the counter by one the shift resistor
is shifted one bit. This allows the current value of counter to be checked by testing a
single bit in ladder, which is much more efficient than a whole register compare. These
programs have been extremely optimized for both minimum scan time and memory usage.
Programming Results.
Programming for Aromat(NAiS) processors yields
fairly compact and efficient code. The display and printouts of that code in the
programming software makes it very difficult to understand. Following are the limitations
that cause the problems.
a) Every function call causes a "Continuous Arrow" whether it
would fit on the line or not. Having to follow the arrow all the time is a serve
limitation on making a program understandable.
b) Rung comments are plagued with bugs especially when deleting and
inserting lines. I lost the comments several times and gave up trying to provide
meaningful comments. They have been use mostly to mark the sections of the program. They
will probably be lost or corrupted when you copy the driver to another program.
c) The I/O names are limited to 5 characters per line. When displaying on
the screen only the first two lines are shown. When making printouts all lines can be
shown.
The ladder logic has been refined and optimized to a very high degree. In
someways this may make the driver programs harder to read but it is felt that efficient
use of memory and execution time are the most important factors.
High Speed Counter (HSC).
The HSC driver uses less ladder logic
memory. Depending on the value transmitted it may be faster or much slower than the Delta
protocol. Unlike the Delta protocol the update time for the HSC protocol is not
deterministic.
The HSC driver uses "up" or "addition" mode counters
depending on the model. Up to four (4) input channels are possible on the FP0. On the FP-M
and FP1 only one channel is possible. The HSC driver is not usable on the FP3, FP5, and
FP10 series. The mode of the counter must be set in "Options\PLC
Configuration\Inputs". The included driver is setup for a single channel on counter
1. See the manuals for additional information on the HSC.
The scan time on the MSP must be set greater than the maximum scan time of
the PLC. We used 10 msec for test purposes even though the scan time of the PLC was less
than 1 msec. This allows some room for the user to add their program. On the FP0 the scan
time was fixed. With only the driver program in the FP0 the scan time was so fast that HSC
was not updated every scan. The scan time was fixed just to slow down its rate of
execution. If the user program has a minimum scan time of more than 2 msec. scan time
could float.
In order to send a value of zero (0) or negative values an offset is added
to the pulse count before transmission. The driver then subtracts this offset after
counting the received pulses. Note the subtraction that occurs in the second rung. The
value of the offset varies depending on the MSP model and scale factor in order to keep
the offset to a minimum. The following table shows the offset for the different ranges.
The constant in the second rung must be changed to match the configuration of the MSP.
MSP MODEL |
SCALE FACTOR |
OFFSET |
MSP-RTD |
X1 |
50 |
MSP-RTD |
X10 |
500 |
MSP-TC |
X1 |
50 |
MSP-TC |
X10 |
500 |
All other models |
|
1 |