Monday 27 October 2014

PLC Numerical Systems

Numerical systems

 INTRODUCTION
 D.1 Decimal numerical system
 D.2 Binary numerical system
 D.3 Hexadecimal numerical system

People were always difficult to except the fact that something is different from themselves or their way of thinking. It is probably one of the reasons why numerical systems other than decimal are hard to understand. Still, whether we like it or not, reality is quite different. Decimal system used in everyday life is by far less used than binary code, which is the working basis for millions of computers across the world.

Each numerical system rests upon its basis. With decimal numerical system, this basis is 10, with binary it is 2, while with hexadecimal it equals 16. Value of each digit depends on it’s position in the number, represented in certain numerical system. Sum of values of each digit is the value of the number. Binary and hexadecimal systems are especially interesting for this course. Besides these two, decimal system will be detailed, too, for the sake of comparison. Although there is nothing new to tell about decimal system, we will give it a look for its relations with other numerical systems.
Decimal numerical system is defined with its basis 10 and decimal positioning from right to left, and it consists of digits 0,1,2,3,4,5,6,7,8,9. This means that the rightmost digit is multiplied by 1 in total sum, next digit to it is multiplied by 10, next one by 100, etc.

Example:
Operations of addition, subtraction, division and multiplication in decimal numerical system are well known, so we will not detail these.
 
D.2 Binary numerical system
Binary numerical system is quite different from the decimal that we got used to in common life. Its basis is 2 and each digit can have one of two values, “1” or “0”. Binary numerical system is used for computers and microcontrollers, because it is much easier for processing than decimal. Usually, binary number consists of 8, 16 or 32 binary digits. Origins of this division are irrelevant for this course, so we will just take it for granted.

Example:
10011011 - binary number with 8 digits

To understand the logic of binary numbers, let us have an example. Let’s assume that we have a cabinet with four drawers and that we should tell someone to bring us something from one of these. Nothing simpler, we could say “in the lower row on the left” and it would be quite sufficient. However, if it must be done without this kind of orientation, left, right, up, down and the likes, then we have a problem. There is a plenty of solutions for the situation, but we should look for the best and the most efficient! Let us mark the columns with A and rows with B. If A=1, we assume the upper row of drawers, and if A=0 we assume the lower. Similar with columns, B=1 is the left column and B=0 is the right column (following picture). Now, it is easier to explain which drawer we think of, just use one of the four combinations 00, 01, 10 or 11. This “naming” of each drawer is nothing more than binary nomenclature of numbers, that is, converting decimal numbers into binary system. In short, labels “first, second, third and fourth” are substituted with “00, 01, 10 and 11”.
We still need to understand the logic of binary numerical system, i.e. how to get the decimal value of a number out of the sequence consisting of ones and zeros. This procedure is called conversion of binary number to decimal value.
As it can be seen, conversion of binary number to decimal value is done by totaling the sum on the right. Depending on the position in the binary number, digits carry different “weight” multiplied by themselves, and totaling them all gives us an understandable decimal number.
Let’s further assume that there are marbles in each of the drawers, 2 in the first, 4 in the second, 7 in the third and 3 in the fourth. Let the person opening the drawers also use the binary system. Under these conditions, question would be “How many marbles are there in 01?”, and the answer would be “There are 100 marbles in 01!” Notice that both question and answer are clear, although we did not use common terminology. Further, notice that two digits are sufficient for decimal numbers from 0 to 3, and that all values greater than 3 require additional binary digits. Thus, for 0 ~ 7 range, three digits are sufficient, four digits cover the range 0 ~ 15, etc. Simply put, the greatest decimal number that can be represented with n binary digits is 2 raised to power n, decreased by one.
Example:
24-1 = 16 - 1 = 15

So, 4 binary digits cover decimal values from 0 to 15, including the values “0” and “15”, which is 16 different values. 
Arithmetical operations that exist in decimal numerical system also apply in binary system. In this chapter, we will cover only addition and subtraction, for simplicity sake.

Basic rules that apply to binary addition are:
Addition works similar to decimal numerical system - we add the digits of the same weight. If both digits added are zero, the result remains zero, while “0” and “1” total “1”. Two ones give zero, but one is carried to the left position.
We can do the check by converting these numbers to decimal system and adding them. Value of the first number is 10, value of the second is 9 and 19 as result, which means that operation was done correctly. Problem occurs when the result is greater than can be represented with given number of binary digits. There are various solutions, one of them being expanding the number of binary digits like in the example below.
 
Subtraction works on the same principles as addition does. Two zeros give zero in result, as do two ones, while subtraction of one from zero requires borrowing one from the higher position in binary number. Example:
Conversion of numbers to decimal system gives as values 10 and 9, with the result of subtraction of 1, which is correct.

Hexadecimal numerical system has number 16 for basis. Therefore, there are 16 different digits used in this system. These are “0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F”. Letters A, B, C, D, E and F represent values 10, 11, 12, 13, 14, 15 and are used for the sake of easier notation. As with binary numerical system, we can apply the same formula here for determining the greatest decimal number that can be represented with a given number of hexadecimal digits.


Example:
162 - 1 = 256 - 1 = 255

Usually, hexadecimal numbers have prefix “$” or “0x” to emphasize the fact that hexadecimal system is used. Thus, number A37E should be represented with $A37E or 0xA37E. No calculations are needed for converting the hexadecimal number to binary system - it is simple substituting of hexadecimal digits with binary ones. Since maximum value of hexadecimal digit is 15, 4 binary digits are required per one hexadecimal.
 
Example:
Check, i.e. converting both numbers to decimal system, gives us value 228 which is correct.

In order to calculate decimal equivalent of hexadecimal number, each digit of number should be multiplied by 16 raised to power equal to the position in the number and then added altogether.
Addition works similar to two previous numerical systems.
Example:
It is required to add the appropriate digits of a number, and if their sum equals 16, that position takes value “0”. Values exceeding 16 should be added to the sum of digits on higher position. First number converted equals 14891, while other is 43457. Their sum is 58348, that is $E3EC converted to decimal numerical system. Subtraction works identically to previously mentioned systems.

Example:
Conversion gives us numbers 11590 and 5970, and the result of subtractions is 5620, that is $15F4 converted to decimal numerical system.
Conclusion
Binary numerical system remains the most commonly used, decimal system the most intelligible, while hexadecimal is somewhere in between. It’s simple conversion to binary system makes it, besides binary and decimal, the most important numerical system to us.

PLC Diagnostics

PLC diagnostics
 INTRODUCTION
 C.1 Diagnostic functions of PLC
 C.2 Non-fatal errors
 C.3 Fatal errors
 C.4 User defined errors
 C.5 Failure alarm - FAL(06)
 C.6 Severe Failure alarm - FALS(07)
 C.7 MESSAGE - MSG(46)
 C.8 Syntax errors
 C.9 Algorithm for finding errors in the program

Introduction
The whole work of PLC controller can be represented with a diagram shown on the following page. After turning on the power, PLC is first initialized (clearing IR, SR i AR areas, presetting system timers and checking I/O lines), and if no errors were detected, monitoring process, program execution, calling the I/O lines and serving the peripheral devices starts to occur in cycles.
C.1 Diagnostic functions of PLC
PLC controller features additional functions that make locating errors easier. Errors can be divided into two categories according to severity :

1. Fatal errors are severe and they prevent PLC controller from operating until their cause is located and solved.
2. Non-fatal errors are those that do not prevent PLC controller from operating. After detecting one or more non-fatal errors, program execution will continue. Nevertheless, it is necessary to correct these errors as soon as possible.
C.2 Non-fatal errors
When one of these errors takes place, indicators POWER and RUN will be on, and the indicator ERR/ALM will blink. Upon locating non-fatal error, manual for the given PLC controller should be consulted and the flags checked in order to understand the cause of a problem and correct the error.
C.3 Fatal erros
When any of the fatal errors take place, PLC controller stops operating and all outputs are shut down. PLC controller cannot be put back to work until the controller is turned off and then turned back on, or until it is switched to PROGRAM mode via peripheral device and the fatal error corrected. With these errors, indicators ERR/ALM are on, while the RUN indicator remains off. It is necessary to check the error flag in the manual of the given PLC in order to locate the cause of the problem and to correct the error.
There are three instructions for user to define his own errors or messages. FAL(06) causes non-fatal error, FAL(07) causes fatal error, while MSG(46) sends a message to program console or to the host computer connected to the PLC controller.
 
C.5 Failure alarm - FAL(06)
Instruction FAL(06) generates the code of non-fatal error that took place to provide the information on the possible cause of the problem for the programmer. Upon execution of the instruction FAL(06) following events take place:

1. Indicator ERR/ALM will blink, while PLC continues to work.
2. Two-digits BCD number of instruction FAL (01 do 99) is written from SR253000 to SR25307.

Same number must not be assigned to both FAL and FALS instructions. To delete the code of an error, error should be corrected and FAL 00 instruction executed.
C.6 Severe failure alarm - FALS(07)
Instruction FALS(07) generates the code of fatal error that took place. In this case the following happens:

1. Program stops and all outputs are shut down.
2. Indicator ERR/ALM is turned on.
3. Two-digit BCD number (01 do 99) of instruction FALS is written from SR 253000 to SR25307.
4. If memory card with RTC is used, part of the memory where the presence of error is recorded will also contain numbers of FALS instruction and exact time when error took place.

Numbers of FALS instruction can be assigned to certain states. Same number must not be assigned to both FAL and FALS instructions. To delete FALS error, PLC controller must be in PROGRAM mode, cause of error solved and then error code deleted.
C.7 Message - MSG (46)
MSG(46) is used for printing messages on program console display. Message cannot exceed 16 characters, and it appears when specified condition is fulfilled.
C.8 Syntax errors
During the program check with operation Program Check, syntax errors are detected. There are three levels of program check at user’s disposal. By selecting the level, types of errors to be checked for are selected. The following table shows types of errors, corresponding messages that appear on display and explains all of syntax errors. Zero level check searches for errors of A, B and C type. First level check searches for errors of A and B type, while the second searches only for errors of type A.

TypeMessageMeaning and the appropriate action
A?????Program is damaged by creating non-existing function in the code. Re-enter your program.
CIRCUIT ERRNumber of logical blocks doesn't match the instructions of logical blocks. Check the program.
OPERAND ERREntered constant is not in allowed range. Change the constant so that it fits in the proper range.
NO END INSTRProgram is missing the instruction END(01). Add END(01) to the last address of the program.
LOCN ERRInstruction is in the wrong place of the program. Check what the instruction demands and correct the mistake.
JME UNDEFDInstruction JME(04) is missing the instruction JMP(05). Correct the number of jump and add the correct JME(04) instruction.
DUPLSame number of jump or subroutine is used twice in the program. Correct the program so that each number is used only once. 
SBN UNDEFDInstruction SBS(091) is programmed for non-existing subroutine. Correct the number of subroutine or create the missing one.
STEP ERRSTEP(08) with the number of section and STEP(08) without the number of section are used illegally. Check the demands of instruction STEP(08) and correct the mistake. 
BIL-ILC-ERRIL(02) and ILC(03) are not used in pair. Check if every instruction IL(02) has its corresponding ILC(03). This message will also appear in case that multiple IL(02) instructions were used with single ILC(03) instruction. Check if that's exactly what you wanted...
JMP=JME ERRJMP(04) and JME(05) are not used in pair. Before proceeding, check if the program is written exactly the way you wanted.
SEN-RET ERRIf the address of instruction SBN(92) is displayed, there are two different subroutines with the same number. Change one of the numbers or delete one of the subroutines in question. If the address of instruction RET(93) is displayed, RET(93) wasn't used appropriately. Check the demands of this instruction and correct the mistake.
CCOIL DUPLSame bit is controlled by more than one instruction (for example, OUT, OUT NOT, DIFU(13), KEEP(11), SFT(10)...). Although certain instructions allow this, you should check the demands of specific instructions, make sure that the program is correct or rearrange the program so that each bit is controlled by single instruction.
JMP UNDEFDJME(05) is used without JMP(04) with the same number of jump. Add the instruction JMP(04) with the same number or delete JME(05) that is not used.
SBS UNDEFDThere is a subroutine that is not called by SBS(91). Add subroutine call to an appropriate place in the program or delete the subroutine.
C.9 Algorithm for finding errors in the program


Sunday 26 October 2014

PLC Detailed memory map of PLC controller

 INTRODUCTION

 B.1 General explanation of memory areas
 B.2 IR memory area
 B.3 SR memory area
 B.4 AR memory area
 B.5 PC memory area

Introduction
Purpose of this appendix is to explain certain memory areas in detail. As the following tables cover whole memory, there are options left unused in this book. They should be skipped during the first reading, and used later according to needs.
B.1 General explanation of memory areas
Memory of PLC controller consists of several areas, some of these having predefined functions.

Data areaWord(s)Bit(s)Function
IR areainput areaIR 000 - IR 009 (10 words)IR 00000 - IR 00915 (160 bits)These bits may be assigned to an external I/O connection. Some of these have direct output on screw terminal (for example, IR000.00 - IR000.05 and IR010.00 - IR010.03 with CPM1A model)
output areaIR 010 - IR 019 (10 words)IR 01000 - IR 01915 (160 bits)
working areaIR 200 - IR 231 (32 words)IR 20000 - IR 23115 (512 bits)Working bits that can be used freely in the program. They are commonly used as swap bits
SR areaSR 232 - SR 255 (24 words)SR23200 - SR25515 (384 bits)Special functions, such as flags and control bits
TR area---TR 0 - TR 7 (8 bits)Temporary storage of ON/OFF states when jump takes place
HR areaHR 00 - HR 19 (20 words)HR0000 - HR1915 (320 bits)Data storage; these keep their states when power is off
AR areaAR 00 - AR 15 (16 words)AR0000 - AR1515 (256 bits)Special functions, such as flags and control bits
LR areaLR 00 - LR 15 (16 words)LR0000 - LR1515 (256 bits)1:1 connection with another PC
Timer/counter areaTC 000 - TC 127 (timer/counter numbers)Same numbers are used for both timers and counters
DM areaRead/writeDM 0000 - DM 0999 and DM 1022 - DM 1023 (1002 words)---Data of DM area may be accessed only in word form. Words keep their contents after the power is off
Error writingDM 1000 - DM 1021 (22 words)---Part of the memory for storing the time and code of error that occurred. When not used for this purpose, they can be used as regular DM words for reading and writing. They cannot be changed from within the program
Read onlyDM 6144 - DM 6599 (456 words)---
PC setupDM 6600 - DM 6655 (56 words)---
Storing various parameters for controlling the PC
Note:
1. IR and LR bits, when not used to their purpose, may be used as working bits.
2. Contents of HR area, LR area, counter and DM area for reading/writing is stored within backup condenser. On 25C, condenser keeps the memory contents for up to 20 days.
3. When accessing the current value of PV, TC numbers used for data have the form of word. When accessing the Completing flags, they are used as data bits. 4. Data from DM6144 to DM6655 must not be changed from within the program, but can be changed by peripheral device.
B.2. SR memory area
IR area doesn’t have predefined memory locations, but is meant for general use in the program. Of all the locations this memory area consists of, only those directly connected to PLC controller input/output lines are of interest for this appendix.

IR area can be divided into 3 parts:

1. Input area is located from word IR000 to IR009, totaling 160 bits. Most important of these are in the word IR000 because they are directly connected to screw terminal of PLC controller. Input IR000.01 is directly connected to screw terminal marked with 01 on the casing of the PLC controller.

2. Output area is located from word IR010 to IR019, totaling 160 bits. Most important of these are in the word IR010 because they are directly connected to screw terminal of PLC controller. Output IR000.00 is directly connected to screw terminal marked with 00 on the casing of the PLC controller.

3. Working area is located from word IR200 to IR231 totaling 512 bits for general use.

As IR memory area does not have predefined memory locations, more detailed explanations are not necessary.

B.3. IR memory area
Unlike IR area, SR area does have predefined memory locations. These bits are usually tied to the PLC controller work or contain current and set values of different functions. Purpose of specific memory locations of SR area is explained in the following table:

WordsBitsFunction
SR 232 - SR 23500 - 15Input area for macro functions. Contains input operands for MCRO(99) (may be used for working bits, when MCRO(99) is not used)
SR 236 - SR 23900 - 15Output area for macro functions. Contains output operands for MCRO(99) (may be used for working bits, when MCRO(99) is not used)
SR 24000 - 15Contains set value SV, when input interrupt 0 is used in counter mode (4 hexadecimal digits) (may be used for working bits, when input interrupt 0 is not used in counter mode)
SR 24100 - 15Contains set value SV, when input interrupt 1 is used in counter mode (4 hexadecimal digits) (may be used for working bits, when input interrupt 1 is not used in counter mode)
SR 24200 - 15Contains set value SV, when input interrupt 2 is used in counter mode (4 hexadecimal digits) (may be used for working bits, when input interrupt 2 is not used in counter mode)
SR 24300 - 15Contains set value SV, when input interrupt 3 is used in counter mode (4 hexadecimal digits) (may be used for working bits, when input interrupt 3 is not used in counter mode)
SR 24400 - 15Contains current value (PV-1), when input interrupt 0 is used in counter mode (4 hexadecimal digits)
SR 24500 - 15Contains current value (PV-1), when input interrupt 1 is used in counter mode (4 hexadecimal digits)
SR 24600 - 15Contains current value (PV-1), when input interrupt 2 is used in counter mode (4 hexadecimal digits)
SR 24700 - 15Contains current value (PV-1), when input interrupt 3 is used in counter mode (4 hexadecimal digits)
SR 248, SR 24900 - 15Contains current value PV of the high-speed counter (may be used for working bits, when high-speed counter is not used)
SR 25000 - 15Analog setting of value 0. Keeps 4 digit BCD value (0000 - 0200) set via analog potentiometer on the PLC controller casing.
SR 25100 - 15Analog setting of value 1. Keeps 4 digit BCD value (0000 - 0200) set via analog potentiometer on the PLC controller casing.
SR 25200Reset of the high-speed counter
 01 - 07Not used
 08Peripheral port. Switches on for the reset of the peripheral port (this doesn't apply to a case when peripheral device is connected). Bit automatically changes state to OFF after the reset
 09Not used
 10PLC Setup Reset Bit. When on, it initializes PC setup (DM6600-DM6655). It automatically goes to OFF after the reset. This applies only if the PC is in PROGRAM mode
 11Forced Status Hold Bit. OFF: bits used in the operation of forced set/reset are cleared when changing from PROGRAM to MONITOR mode. ON: bits used in the operation of forced set/reset keep their states when changing from PROGRAM to MONITOR mode.
 12 I/O Hold bit. OFF: IR and LR bits are reset when starting or ending an operation. ON: IR and LR bits keep their states when starting or ending an operation.
 13Not used
 14Error Log Reset Bit. Bit state OFF clears the record of error taking place. Bit automatically goes off after the operation
 15Not used
SR 25300 - 07FAL error code. Location contains error code (2 digit number). FAL number is stored at this location upon executing FAL(06) or FAL(07) instructions. Location contents are reset upon executing FAL 00 instruction or by clearing an error from peripheral device
 08Not used
 09Cycle Time Overrun Flag. Bit goes to ON when program length doesn't allow cycle of input/output scanning to be executed in a specified time period
 10 - 12Not used
 13Flag always on
 14Flag always off
 15First Cycle Flag. Goes ON during the first cycle at the beginning of the operation
SR 254001 min clock impulse (30s on, 30s off)
 010.02s clock impulse (0.01s on, 0.01s off)
 02Negative (N) flag
 03 - 05Not used
 06Differential Monitor Flag
 07STEP(8) execution flag
 08 - 15Not used
SR 255000.1s clock impulse (0.05s on, 0.05s off)
 010.2s clock impulse (0.1s on, 0.1s off)
 021.0s clock impulse (0.5s on, 0.5s off)
 03Instruction Execution Error (ER) Flag. Changes state to ON if error occurs during instruction execution
 04Carry (CY) flag
 05"Greater than" (GR) flag
 06"Equals" (EQ) flag
 07"Less than" (LE) flag
 08 - 15Not used

B.4. AR memory area
Purpose of this memory area is to provide information on PLC controller state, malfunctions and some system data. Memory locations of this area keep their states after the power has been shut down.

Word(s)Bit(s)Function
AR00 and AR0100 - 15Not used
AR0200Status flag of the first I/O unit for expanding I/O lines (I/O units status flag)
 01Status flag of the second I/O unit for expanding I/O lines (I/O units status flag)
 02Status flag of the third I/O unit for expanding I/O lines (I/O units status flag)
 03 - 07Not used
 12 - 15Number of connected I/O units
AR03 - AR0700 - 15Not used
AR0800 - 07Not used
 08 - 11Peripheral device error code
 12Flag of peripheral device error
 13Peripheral Device Transmission Enabled Flag
 14 - 15Not used
AR0900 - 15Not used
AR1000 - 15Power-off counter. Contains 4-digit BCD value
AR1100 - 07High-speed Counter Range Comparison Flags
 08 - 14Not used
 15Pulse Output Status. ON: stopped; OFF: Impulse at output
AR1200 - 15Not used
AR1300Power-up PC Setup Error Flag. Goes ON when error occurs in area DM 6600 - DM 6614
 01Start-up PC Setup Error Flag. Goes ON when error occurs in area DM 6615 - DM 6644
 02RUN PC Setup Error Flag. Goes ON when error occurs in area DM 6645 - DM 6655
 03 - 04Not used
 05Long Cycle Time Flag. Goes ON if real cycle length exceeds length set in DM 6619
 06 - 07Not used
 08Memory Area Specification Error Flag. Goes ON when non-existing address is specified in the program
 09Flash Memory Error Flag
 10Read-only DM Error Flag. Goes ON when checksum error occurs in DM 6144 - DM 6599 range
 11PC Setup Error Flag. Goes ON when checksum error occurs in PC Setup area
 12Program Error Flag. Goes ON when checksum error occurs in program memory (UM) or inappropriate instruction is executed
 13Expansion Instruction Error Flag
 14 - 15Not used
AR1400 - 15Maximum Cycle Time. 4 BCD digits. Cleared at the beginning of the operation
AR1500 - 15Current Cycle Time. 4 BCD digits. Not cleared when the operation ends
 Note:
1. IR and LR bits when not used for their function may be used as working bits.
2. Contents of HR area, LR area, counter, and DM area for reading/writing are kept by battery of central processing unit. In case that the battery is removed or malfunction occurs, this data will be lost.
3. When accessing the current value of PV, TC numbers used for data have form of word. When accessing Completing flags, they are used as data bits.
4. Data stored from DM6144 to DM6655 cannot be changed from within the program, but can be changed by peripheral device.
5. Program and data from DM 6144 to DM 6655 are stored in the flash memory.
 
B.5. PC memory area
PLC setup area can be roughly divided into 4 categories:

1. Settings related to basic operations of PLC controller and I/O processes
2. Settings related to cycle duration
3. Settings related to interrupts
4. Settings related to communication.

Word(s)Bit(s)Function
Settings are active only upon resetting the PLC and sending data from PC to PLC
DM 660000 - 07Startup Mode. Active only if bits 08 - 15 are set to 02. 00: PROGRAM; 01: MONITOR; 02: RUN
 08 - 15Startup mode designation. 00: programming console switch; 01: proceeds in the mode last used before turning off the power; 02: settings in 00 - 07
DM 660100 - 07Not used (set to 0)
 08 - 11IOM Hold Bit (SR 25212). 0: Reset; 1: Keeps the state
 12 - 15Forced Status Hold Bit (SR 25211). 0: Reset; 1: Keeps the state
DM 660200 - 03Writing to program memory protection. 00: OFF; 01: ON (except for DM 6602)
 04 - 07Programming console display language. 00: English; 01: Japanese
 08 - 11Not used
DM 660300 - 15Not used
DM 660400 - 0700: in case of battery malfunction, error will not be generated; 01: in case of battery malfunction, error will be generated
 08 - 15Not used
DM 6605 - DM 661400 - 15Not used
Cycle Time Settings (DM 6615 - DM 6619) take effect after the transfer to PC area, next time you start working
DM 6615 - DM 661600 - 15Not used
DM 661700 - 07Servicing time for peripheral port. Active when bits 08 - 15 are set to 01. It is expressed in percentage of cycle time duration (00 to 99 (BCD))
 08 - 15Peripheral port servicing setting enable. 00: 5% of cycle duration; 01: time defined in first half of the word
DM 661800 - 07Cycle monitor time. Settings are identical to those of the second half of the previous word
 08 - 15Cycle monitor enable (Setting in 00 to 07 x unit; 99 5 max). 00:120ms (settings in bits 00-07 are disabled) ; 01: setting unit 10ms; 02: setting unit 100ms; 03: setting unit 1s
DM 661900 - 15Cycle time. 0000: variable (no minimum); 0001: up to 9999 (BCD). Minimal time is expressed in ms
Interrupt Processing (DM 6620 - DM 6639) take effect after the transfer to PC area, next time you start working
DM 662000 - 03Input constant for IR  00000 - IR 00002. 0: 0.8ms; 1: 1ms; 2: 2ms; 3: 4ms; 4: 8ms; 5: 16ms; 6: 32ms; 7: 64ms; 8: 128ms 
 04 - 07Input constant for IR  00003 and IR 00004. Settings are same as with bits 00-03
 08 - 11Input constant for IR  00005 and IR 00006. Settings are same as with bits 00-03
 12 - 15Input constant for IR  00007 and IR 00011. Settings are same as with bits 00-03
DM 662100 - 07Input constant for IR  001. 0: 0.8ms; 1: 1ms; 2: 2ms; 3: 4ms; 4: 8ms; 5: 16ms; 6: 32ms; 7: 64ms; 8: 128ms
 08 - 15Input constant for IR  002. Settings are same as with IR 001
DM 662200 - 07Input constant for IR  003. Settings are same as with IR 001
 08 - 15Input constant for IR  004. Settings are same as with IR 001
DM 662300 - 07Input constant for IR  005. Settings are same as with IR 001
 08 - 15Input constant for IR  006. Settings are same as with IR 001
DM 662400 - 07Input constant for IR  007. Settings are same as with IR 001
DM 662500 - 07Input constant for IR  008. Settings are same as with IR 001
 08 - 15Input constant for IR  009. Settings are same as with IR 001
DM 6626 - DM 662700 - 15Not used
DM 662800 - 03Interrupt enabled on IR 00000. (0: regular input; 1: interrupt input; 2: fast-reaction input)
 04 - 07Interrupt enabled on IR 00001. (0: regular input; 1: interrupt input; 2: fast-reaction input)
 08 - 11Interrupt enabled on IR 00002. (0: regular input; 1: interrupt input; 2: fast-reaction input)
 12 - 15Interrupt enabled on IR 00003. (0: regular input; 1: interrupt input; 2: fast-reaction input)
High-speed counter settings (DM 6640-DM 6644) take effect after the transfer to PC area, next time you start working
DM 6640 - DM 664100 - 15Not used
DM 664200 - 03High-speed counter mode. 0: counting up/down; 4: incremental mode
 04 - 07High-speed counter reset mode. 0: Z phase and software reset; 1: software reset only 
 08 - 15High-speed counter enable. 0: high-speed counter not used; 1: high-speed counter used with settings 00-07
DM 6643 - DM 664400 - 15Not used
 Peripheral port settings take effect after the transfer to PC area
DM 6645 - DM 664900 - 15Not used
DM 665000 - 07Port settings. 00: standard (1 start bit, even parity, 2 stop bits, 9600bps); 01: Settings in DM 6651 (settings other than this cause error and turn on AR 1302)
 08 - 11Area for 1:1 connection with a PC via peripheral port. 0: LR00-LR15
 12 - 15Modes of communication. 0: Host link; 2: one-to-one PC link (slave); 3: one-to-one PC link (master); 4: NT link (settings other than this cause error and turn on AR 1302)
DM 665100 - 07Baud rate. 00: 1200 bps; 01: 2400 bps; 02: 4800 bps; 03: 9600 bps; 04: 19200 bps
 08 - 15Frame format (Start bits/Data bits/Stop bits/Parity).      00:1/7/1/even; 01:1/7/1/odd; 02:1/7/1/none; 03:1/7/2/even; 04:1/7/2/odd; 05:1/7/2/none; 06:1/7/1/even; 07:1/7/1/odd; 08:1/7/1/none; 09:1/7/2/even; 10:1/7/2/odd; 11:1/7/2/none          (settings other than this cause error and turn on AR 1302)   
DM 665200 - 15Host Link Transmission Delay (0000 - 9999ms)                      (settings other than this cause error and turn on AR 1302)
DM 665300 - 07Host Link (00 - 31 BCD)                                                        (settings other than this cause error and turn on AR 1302)
 08 - 15Not used
DM 665400 - 15Not used
Error log settings (DM 6655) take effect after the transfer to PLC controller
DM 665500 - 03Style. 0: move after 7 records; 1: keep only first 7 (no moving);   2-F: no records
 04 - 07Not used
 08 - 11Cycle Time monitor Enable. 0: detect long cycles as non-fatal errors; 1: do not detect long cycles
 12 - 15Not used

Saturday 25 October 2014

PLC Expanding the number of input/output lines

APPENDIX A   Expanding the number of input/output lines
 INTRODUCTION
 A.1 Differences and similarities
 A.2 Marking the PLC controller
 A.3 Specific case

Introduction

This appendix is an answer to the question “What if more input or output lines are needed ?”. Model detailed in the book carries the mark CPM1A-10CDR-A and is taken as an optimal for it’s price and features. Alternative models with greater number of lines include CPM1A-20CDR-A, CPM1A-30CDR-A or CPM1A-40CDR-A. The last two can be expanded with three additional modules with 20 extra I/O lines each, totaling 100 I/O lines as a maximum (if this is still insufficient, maybe it is time for you to start using some of more powerful PLC controllers).
If not even the most powerful model of CPM1A family satisfies your needs, then extra modules with 20 I/O lines are added. This form of connection reaches 100 input/outputs, which is a significant number in industrial proportions.

A.1. Differences and similarities

Taking the other model of PLC controller from CPM1A class basically doesn’t change a thing! Everything said for one model also applies to the other. Only thing that changes is the number of screw terminal and the number of bits in IR area connected to that screw terminal. If model with 10 I/O lines (model described in the book) has 6 inputs on addresses IR0000 - IR0005, then the 20 I/O lines model will have 12 inputs on addresses IR0000 - IR0011. Expanding itself should not be a problem. After taking off the cover on the right side, there is a connector which is then connected to the expansion module via flat cable. Still, it requires skill when assigning inputs and outputs because expansion increases the cost of the project. All the models and expansions of CPM1A class carry additional marks defining them more precisely.

Description      
Input points
Output points
Power Supply
Model Number
10 I/O points      
6 points
4 point Relay Output
100 to240 VAC, 50/60 Hz
CPM1A-10CDR-A

24 VDC
CPM1A-10CDR-D
Transistor NPN
24 VDC
CPM1A-l0CDT-D
Transistor PNP
24 VDC
CPM1A-10CDT1-D
20 I/O points

12 points
8 points
100 to 240 VAC, 50/60 Hz
CPMlA-20CDR-A
24 VDC
CPM1A-20CDR-D
Transistor NPN
24 VDC
CPM1A-20CDT-D
Transistor PNP
24 VDC
CPMlA-20CDT1-D
30 I/O points
18 points               
12 points
100 to 240 VAC, 50/60 Hz
CPM1A-30CDR-A
24 VDC
CPM1A-30CDR-D
Transistor NPN
24 VDC
CPM1A-30CDT-D
Transistor PNP
24 VDC
CPM1A-30CDT1-D
40 I/O points

24 points               
16 points
100 to 240 VAC, 50/60 Hz
CPM1A-40CDR-A
24 VDC
CPM1A-40CDR-D
Transistor NPN
24 VDC
CPM1A-40CDT-D
Transistor PNP
24 VDC
CPM1A-40CDT1-D

Notice that PLC controllers with 10 and 20 I/O lines do not have an expansion port. Generally speaking, if there is the slightest possibility for expansion in the project, PLC controller with 30 or 40 I/O lines should be used.

A.2. Marking the PLC controller

Marking the controller and the expansion module undergoes three criteria. The first is voltage, the second is the type of input/output and the third is number of I/O lines. The picture below is self-explanatory.

A.3. Specific case
If two 20 I/O lines expansion modules and one analog module are added to 30 I/O lines model, assigned inputs/outputs will have the addresses from the following table.

UnitAssigned input bitsAssigned output bits
1Central processing unit (CPM2A-30CDX-X)IR 00000-IR 00011 and IR 00100-IR 00105IR 01000-IR 01007 and IR 01100-IR 01103
2Unit for I/O expansion (CPM1A-20EDxxx)IR 00200-IR 02011IR 01200-IR 01207
3Analog I/O unit (CPM1A-MAD01)IR 00300-IR 03015 and IR 00400-IR 00415IR 01300-IR 01315
4Unit for I/O expansion (CPM1A-EDxxx)IR 00500-IR 00511IR 01400-IR 01415