DATA HANDLING Some situations arise where a group of bits have to be handled. (ex) a sensor supplies an analogue signal which is converted to, say, an 8-bit word before becoming an input to a PLC. The operations that may be carries out with a PLC on data words normally include: 1.Moving data. 2.Comparison of magnitudes of data, (i.e.)greater then, equal to or less than. 3.Arithmetic operations such as addition and subtraction. 4.Conversions between binary coded decimal (BCD), binary and octal.
DATA REGISTERS Data instructions also require memory addresses. The locations in the PLC memory allocated for data are termed as data registers. Each data register can store a binary word of usually, 8 or 16 bits. Addresses are given as D0,D1,D2 and so on. A 8-bit word means that a quantity is specified to a precision of 1 in 256, a 16-bit a precision of 1 in Each instruction has to specify 1.the form of the operation 2.the source of the data used in terms of its data register 3.the destination data register of the data.
DATA MOVEMENT For data movement, the instruction will contain 1.Move data instruction 2.The source address of the data 3.The destination address of the data The following is the ladder rung to transfer data from D1 to D2. StepInstructionNotation 0LDX300 1MOV 2D1 3D2
DATA COMPARISON COMPARISONSYMBOLCODE Less than<LES Equal to=EQU Less than or equal to<=LEQ Greater than>GRT Greater than or equal to>=GEQ Not equal to<>NEQ The comparison instruction consists of: 1.Comparison instruction 2.The source address of the data 3.Destination address StepInstructionNotation 0LDX300 1> 2D1 3D2 (ex) to see if D1 is greater than D2
SAMPLE APPLICATION OF DATA COMPARISON Comparison might be used when signals from two sensors are to be compared by the PLC before action is taken. (ex) an alarm might be required to be sounded if a sensor indicates a temperature above 80 o c and remain sounding until temperature falls below 70 o c
ARITHMETIC OPERATIONS The instruction to add or subtract consists of: 1.The instruction. 2.The register containing the address of the value to be added or subtracted. 3.The address of the value to which the addition or from which the subtraction is to be made. 4.The register where the result is to be stored. It may be used to alter the value of some sensor input value, perhaps a correction or offset term or alter the preset values of timers or counters. The following shows the form used for the ladder symbol for addition with OMRON.
CODE CONVERSIONS All internal operations in the CPU of a PLC are carried out using binary numbers. So when input is a decimal, conversion to binary required. Also when a decimal output is required, conversion from Binary to decimal is needed. (ex) following is the rung employed in conversion from BCD to binary.
ANALOG INPUT/OUTPUT Many sensors generate analog signals and many actuators require analog signals. Thus, some PLCs have A-D converter fitted to input channels and D-A converter fitted to output channels. (ex) speed control of a motor so that its speed moves up to its steady value at a steady rate. The program is as shown below:
Contd… A PLC equipped with analog input channels can be used to carry out a continuous control function, (i.e) PID control. To carry out proportional control on an analog input the following set of operations can be used: 1.Convert the sensor output to a digital signal. 2.Compare the converted actual sensor output with the required sensor value (i.e) the set point and obtain the difference(error). 3.Multiply the error by the proportional constant K p. 4.Move this result to the D-A converter output and use the result as the correction signal to the converter.
SAMPLE APPLCATION OF ANALOG I/O Temperature controller. The input could be from a thermocouple, which after amplification is fed through an A-D converter into the PLC. The PLC is programmed to give an output proportional to the error between the input from the sensor and the required temperature. The output word is then fed through a D-A converter to the actuator, a heater, in order to reduce the error. (program in next slide).
TEMPERATURE CONTROL
SELECTION OF A PLC Criteria to be considered are as follows: 1.What i/o capacity is required, (i.e) the number of i/o, capability of expansion for future needs. 2. What types of i/o are required, (i.e) isolation, onboard power supply for i/o, signal conditioning. 3. What size of memory is required? This is linked to the number of i/o and the complexity of program used. 4. What speed and power is required for the CPU? This is linked to the number of types of instruction that can be handled by a PLC. As the number of types increases, a faster CPU is required. Likewise, the greater the number of i/o to be handled the faster the CPU required.