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 PLC Direct it
requires a set of lines of logic at the beginning of the main program to setup a timed
interrupt. The interrupt subroutine may be the complete driver or in some versions it may
call one or two other subroutines.
The user can copy the driver into their program by opening the driver
file. The desired rungs can be highlighted and copied from the driver program. Next the
user will open the target program, position the cursor where desired and paste into the
target program. Alternately the user could start with our driver and paste their rungs
into it or build their program from it.
Drivers.
The following is a list of drivers in the MSP Driver
Library for the PLC Direct by Koyo PLCs. These drivers were prepared with PLC Direct's
DirectSoft programming software, revision 2.3. 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, address comments, and nicknames
that are viewable in the programming package and on printouts.
DRIVER |
DL105 |
DL205 |
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 |
Output Drivers.
Currently output drivers for the DL105 are not
available. The PLC Direct by Koyo DL105 immediate output instruction when used in a time
interrupt contains a bug that makes this driver unreliable. Older firmware revisions of
the DL205 contain the same bug. This bug causes every 20 to 50 transmissions of the output
value to be corrupt which can cause small bumps in the analog output. If your application
can tolerate these excursions then the driver can be made available on special request.
Different Models.
a) PLC Direct's programming language and memory layouts is similar in all
models.
b) In general, language and memory in the lower model numbers are subsets
of the higher model numbers. The DL105 represents a reasonable lowest common denominator.
Single channel drivers and the driver subroutines are written to work in the DL105 and
should work with very little revision in all models.
c) The exceptions to item "b" are the DL330 and DL340 CPUs.
These represent the oldest models in the product line. They lack many instructions and
features. It would be difficult to convert the driver to fully function in the models. A
reduced version of the driver without delta calculations would be possible. In a DL305
system we recommend using only the DL350 CPU
d) Models with relay outputs can be used but care must be taken to
conserve relay life. See the sections on outputs regarding these modules.
Multiplexed Drivers.
Multiplexed drivers are not possible in the
DL105 or the DL205's 230 CPU. These processors instruction sets do not contain any type of
scan controls like go to label or subroutine calls that allow code to be executed more
than once per scan or interrupt. When more than one channel is required in the DL105 or
230 CPU the driver program must be copied and the second copy re-addressed. In the DL205
family the model 240 and 250 CPUs provide the necessary instructions and multiplexed
drivers are be possible.
Memory Usage.
The attached table shows the memory usage for the
different drivers available for PLC Direct DL105 PLCs.
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 11) |
| 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 11) |
| 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 DL105 and DL205 execute the driver code in a time interrupt. The time
interrupt uses the High-Speed Interrupt mode (Mode 40) of the HSIO circuit. Execution of
the interrupt is set up in the first line of logic in the main program. The high-speed
interrupt mode is selected by setting in the lower of V7633 to the mode number 40 (BCD).
The scan time of the timed interrupt is in the upper 3 digits of the BCD value in V7634.
These three digits are in msec. The least significant digit must be equal to 4. Example
for 10 msec scan enter 104, for 15 msec scan enter 154. Interrupt processing must be
enabled with the ENI instruction. The driver program begins at the INT 0 instruction.
Inputs are updated in the beginning of the time interrupt subroutine and outputs are set
at the end by using immediate I/O instructions.
Software input filters are set in V7635 for X0 and X1, V7636 for X2 and
V7637 for X3. The filter time in msec is contained in the first two digits of the BCD
value in these registers. The last two digits of the BCD value in the register are always
"06". If these inputs are used for the MSP there filter time should be set for
the minimum, "00". Therefore the registers for input filters used by the MSP
should be set to 0006 (BCD). Inputs X4 and above have only hardware filters that are built
into the input modules.
See the user manual on the DL105 for more information on how the HSIO
circuit functions and the time interrupt works. From testing we have found that the DL205
time interrupt works identical to the DL105. PLC Direct support confirms that Mode 40 of
the HSIO in the DL205 works the same whether or not the counter interface module is
present. Do not use the manual on the DL205 for information about the time interrupt. Much
of the information in the DL205 manuals dated 6/97 and earlier is incorrect and
misleading.
On the DL105 best results can be obtained by using inputs X0 to X3. These
inputs are higher speed than X4 and above. Higher numbered inputs are usable just not
preferred. On the DL205 the inputs on the counter interface module are the fastest and are
preferred. The DL205's DC input modules have much longer filters and testing has shown
them to work acceptably. In extreme cases if unstable operation is observed it may be
necessary to slow the interrupt scan rate down for these modules.
Scan Time Exceptions.
For the single channel drivers (Msp_I, Msp_O)
the scan time is set at 10 msec. This is the default setting of the MSP. For two channel
drivers (Msp_I_M, Msp_O_M, Msp_IO) the scan time is set to 20 msec. For 4 channel drivers
(Msp_IO_M) the scan time is set to 30 msec. The scan time of the interrupt was adjusted to
allowed adequate time between execution to allow logic in the normal scan to execute at a
reasonable speed. 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.
On some older models it may have to be slowed down more. Those models with
relay outputs must be slowed down when using MSP analog outputs. The mechanical relays are
slow when compared to solid state and we us a scan time of 50 msec.
Programming Results.
Programming for PLC Direct processors yields
fairly complex code. The lack of binary math and double word integers in the DL105 causes
the most problems. Having to keep track of what is in the accumulator and using special
relays for the results of compares adds to the complexity of the code. Also adding to the
complexity for multi-channel drivers in some models is the lack of go to label or
subroutine calls (See Note 5). The DL205 which has binary math could yield a less complex
driver but the MSP is needed the most on the DL105 and it sets the standard.
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.
DV-1000 Data Access Unit.
The program contains several rungs to
setup the DV-1000. If available this unit can be used to aid in trouble shooting. These
rungs may be deleted if desired.
High Speed Counter (HSC).
This 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 the single channel High-Speed Counter mode of the
HSIO. In the DL105 family only one (1) channel is possible. See manuals for additional
information on the HSIO.
In all other families a special modules is required for the high-speed
counter. For the DL305 and DL405 families the cost would probably make this approach
uneconomical. In the DL205 family the high-speed counter module is fairly inexpensive. On
the DL240 and DL250 two (2) channels are possible.
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.
Beware of unstable operation at low frequencies and high scan rates. With
only the driver program in the DL105 the scan time was so fast that HSC was not updated
every scan when the frequency was less than 5 kHz. When the user adds their program and
the minimum scan time exceeds 2 msec. the frequency can be reduced if required
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 fourth 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 |