Tech Note
MSP to PLC Direct by Koyo DL105
Revision:4.10
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 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.
DRIVERDL105DL205DESCRIPTION
Msp_I1 Channel Input
Msp_I_M2 Channel Input Multiplexed
Msp_I_H1 Channel Input High-Speed Counter
Msp_O1 Channel Output
Msp_O_M2 Channel Output Multiplexed
Msp_IO1 Channel Input, 1 Channel Output
Msp_IO_M2 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.
- Block Diagram. The following block diagrams show the flow of execution and the data resources used by the different drivers. Note that single channel drivers use the memory in the driver logic. The multiplexed drivers use a separate block of storage register for each channel. The data in the storage block is moved into and out of the memory used by the driver logic.
Note:The DATA is an 8-digit BCD value. It is a double word occupying two consecutive memory locations.
Single Input
Single Output
Multiplexed Input
Multiplexed Output
- 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 MODELSCALE FACTOROFFSET
MSP-RTDX1 50
MSP-RTDX10 500
MSP-TCX1 50
MSP-TCX10 500
All other models 1
- Sink/Source Inputs. All DC inputs in DL105 and DL205 families can be used for either sink or source. We have used them only for sink. See the next note on Sink inputs for a schematic and more details.
- Sink Inputs. Each input is basically a resistor with one end of each resistor tied to individual terminals. The other ends are tied together to a terminal marked "Com". This pull down resistance sinks voltage and current to common VDC.
The output on the MSP is designed to be used as either sink or source. The MSP contains a sinking gate and pull-up resistor. Sink inputs can be wired directly to the MSP.
Make sure that the PLC input module and MSP input get their 24 VDC from the same source. Following is a schematic of a typical input. "X?" may be any valid input. In the single channel drivers for the DL105 the input is X0 but may be changed if desired. In the multiplexed drivers for the DL105 Channel 0 and 1 are X0 and X1 respectively but may be changed if desired.
- Source Inputs. Each input is basically a resistor with one end of each resistor tied to individual terminals. The other ends are tied together to a terminal that is tied to COM. This pull up resistance sources voltage and current from +VDC.
The output on the MSP is designed to be used as either sink or source. The MSP contains a sinking gate and pull-up resistor. Source inputs can be wired directly to the MSP.
Using the input as source would increase the level of the signal and make it more immune to noise but it would double the current required when the signal is pulled to zero volts.
Make sure that the PLC input module and MSP input get their 24 VDC from the same source. Following is a schematic of a typical input. "X?" may be any valid input.
Note: The true/false sense for a sourcing input is opposite that of a sinking input. In ladder logic the hardware input into the driver must be negated to provide the proper logic sense.
- Relay Outputs. Relay outputs can be used as either sink or source. We recommend using them only for source since it eliminates the need of a pull up resistor. See the next note on Sourcing outputs for a schematic and more details. If using mechanical relay outputs you will have to slow the output driver down in order to debug it and not destroy the relay. I suggest using a scan time of 50 msec for the MSP analog output modules.
- Output on Demand. In order to conserve the life of the relay output we suggest you add some extra logic that allows control of when the output is transmitted. If required please review the Omron or GE drives for the method.
- Input/Output Scan Time Ratio. For those drivers using both inputs and relay outputs we suggest using logic that runs the output a factor of 5 times or more slower than the input. This allows the input to run at a scan time of 10 msec and the output to run a scan time of 50 msec. This is necessary only when relay outputs must be used. If required please review the Omron or GE drives for the method.
- Source Outputs. Each output is basically a transistor or gate with one end of each transistor tied to individual terminals. The other ends are tied together to a terminal that is usually labeled COM. This pull up contact sources voltage and current from +VDC.
The input on the MSP is sink; it is basically a resistor tied to -VDC or common. Source outputs can be wired directly to the MSP.
Make sure that the PLC output module and MSP output get their 24 VDC from the same source. Following is a schematic of a typical output. "Y?" may be any valid output.
Note: The true/false sense for sinking outputs is opposite that of the sourcing outputs. In ladder logic the hardware output from the driver must be negated before going to the hardware output to provide the proper logic sense.
- Sink Outputs. All solid state DC outputs on the DL105 family are sink. On the DL205 family sink outputs are the most commonly used. Each output is basically a transistor or gate with one end of each transistor tied to individual terminals. The other ends are tied together to a terminal that is usually labeled COM VDC. This pull down transistor sinks voltage and current to COM VDC.
The input on the MSP is sink; it is basically a resistor tied to -VDC or common. Since both PLC output and MSP are sink a pull up resistor must be used. Sink outputs can be wired directly to the MSP with a pull-up resistor.
Make sure that the PLC output module and MSP output get their 24 VDC from the same source. Following is a schematic of a typical output. "Y?" may be any valid output. In the single channel drivers the output is Y0 but may be changed if desired. In the multiplexed drivers Channel 0 and 1 are Y0 and Y1 respectively but may be changed if desired.
PLC Direct by Koyo
Memory Usage Summary
DL105
Driver / Channels / MemoryInput / Output / Used / Available DL105 / Used % DL105 / For First Point / For Second Point
Msp_I / 1 / 143 / 2048 / 7%
DL205
Driver / Channels / MemoryInput / Output / Used / Available DL240 / Used % DL240 / Available DL250 / Used % DL250 / For First Point / For Second Point
Msp_I / 1 / 143 / 2560 / 6% / 7680 / 2%
Msp_I_M / 2 / 2560 / 0% / 7680 / 0% / 0
Msp_IO / 1 / 1 / 283 / 2560 / 11% / 7680 / 4%
Msp_IO_M / 2 / 2 / 2560 / 0% / 7680 / 0%
Msp_O / 1 / 151 / 2560 / 6% / 7680 / 2%
Msp_O_M / 2 / 2560 / 0% / 7680 / 0% / 0
June 24, 1998Tech Note: MSP to PLC Direct by Koyo DL105Page 1 of 10