## Understanding the Differences between SET and OUT Functions for PLC Outputs

**Scenario**

You will be tasked to gather information from a number of sources to answer the various questions posed. You will be required to use technical language throughout and where appropriate cleary show the methods employed. You will also be required to undertake a number of problem solving scenarios and devise, write and test ladder logic codings.

**Task 1**

Explain the difference between OUT and SET (for an Output) and why, when you use SET, you also need to use RESET.

**Task 2**

Describe how a microprocessor, such as might found in a PLC, converts an analogue input signal into a digital value. In your answer cover the following points:

- Why is the conversion from analogue into digital required?

- Describe the principles of the conversion method used.

- What is the “resolution” of an A/D Converter?

- How is this related to the word length used by a processor?

**Task 3**

Describe what the following functions do in the Mitsubishi FX (1,2,3) series of PLCs.

i) Add

ii) Sub

iii) Mul

iv) Div

v) ZRST

vi) CMP

vii) ZCP

**Task 4**

Describe the uses of:

i) D (Data) registers, including externally adjustable registers.

ii) Special diagnostic auxiliary relays M8000, M8002, M8033 and M8034.

The basic function of both the SET and OUT functions is to change the state of their target object to ON or “1”. The differences between SET and OUT can be summarized in two points. The first is the objects to which these functions can be applied and the second is the duration of effects of these functions. While restricting our scope to using these functions on only Outputs, we can ignore the first point and discuss the second point only.

First, let us discuss the SET function. When the SET function is used in conjunction with an Output, it permanently changes the state of that Output to ON or “1”. As an example, consider the following simple piece of code:

LD X0

SET Y0

This code implies that if the Input X0 is energised or switched ON, the Output Y0 will be permanently switched ON as well. Thus, after the first program scan ends, even if the Input X0 is not ON during subsequent program scans, the Output Y0 will remain ON.

Next, let us discuss the OUT function. When the OUT function is used in conjunction with an Output, it changes the state of that Output to ON or “1” only for the duration of that program scan. If we consider the above piece of code again, then if during one program scan, Input X0 is on, then Output Y0 will also be turned on. However, if during the subsequent program scans Input X0 is OFF, then Y0 will follow the state of X0 and be switched OFF.

## How Microprocessors Convert Analog Signals to Digital Values

This distinction is also the reason why the RESET function must be used along with the usage of the SET function in almost all cases. The RESET function changes the state of an OUTPUT to OFF permanently, acting as the functional inverse of the SET function. Thus, the SET and RESET functions form a complimentary pair of functions that are used together in order to program a complete range of functionality for any given scenario.

A PLC is a digital control device. It was designed to replace relays and fixed logic circuits as a freely programmable controller. Therefore, the very basis of its design is the usage of digital Inputs in order to generate digital Outputs. Microprocessors are found in the Central Processing Unit (CPU) of PLCs and perform almost all of the core tasks of the PLC. Microprocessors were developed on the premise of using digital signals to perform calculations as it is significantly easier and more efficient to use them as compared to analog signals. This is on account of two properties, namely “quantized” and “discrete”, which set apart digital signals from analog signals.

Almost all stimuli existing in the real world are analog signals, thus there is a need for microprocessors to employ “Analog-to-Digital Converters” or A/D Converters. The basic principles for converting analog signals to digital signals are Discretization and Quantization. Two associated terms for this process are Sampling Frequency and Sampling Precision, also called the Resolution.

An analog signal is basically a signal which is continuous along the time axis as well as in its amplitude. During Discretization, the value of an analog signal is measured at fixed intervals of time in order to obtain a signal which is discrete along the time axis. The Sampling Frequency determines the time interval at which a sample of the analog signal is taken. Thus, a 5 seconds long analog signal sampled at a frequency of 100 Hz will produce 500 samples. The remaining values which are not measured are called “Sampling Loss”. Next, the amplitude of this sampled signal is divided into as many distinct values as is the Resolution of the A/D converter. Thus, a sampled signal with an amplitude ranging from, say, 0V to 5V, when passed through an A/D Converter of Resolution 10 will be divided into a digital signal with each value on the y-axis (i.e. amplitude) corresponding to a multiple of 0.5V. This Resolution may also be expressed in terms of number of bits, n, where the number of discrete divisions on the y-axis is equal to 2n. Thus, a 4-bit A/D converter will produce a digital signal having an amplitude from 0 to 15 (16 values) and a precision of 1/16. The exact voltage values may be scaled to the maximum limit tolerable by the converter.

## Mitsubishi FX PLC Function Descriptions for ADD, SUB, MUL, DIV, ZRST, CMP, and ZCP

The exact word length used by a processor is directly dependent on the bus length used by the processor. A bus is a sequence of wires or connections running in parallel, so that each connection carries a stream of bits. Thus, a bus of length 8 can transmit 8 bits of data simultaneously. Similarly, an A/D Converter of a resolution ‘n’ will require a bus a corresponding size to efficiently transmit the digitized signals. Hence, the word length of processors will rarely, if ever, be lower than the Resolution of their A/D converters.

i) ADD: Arithmetic Function used to perform algebraic addition of the data in two source devices and store the result in a destination device. The source devices may be any constants or registers but the destination cannot be a constant. Function usage:

ADD [S1] [S2] [D]

Where [S1] and [S2] are source devices and [D] is a destination device. If the resultant value overflows or underflows, the flags M8022 or M8021 respectively are set and the result is stored in [D] along with the sign of the result.

ii) SUB: Arithmetic Function used to perform algebraic subtraction of the data in one source device from the other source device and store the result in the destination device. The source devices may be constants or registers but the destination device cannot be a constant. Function usage:

SUB [S1] [S2] [D]

Where [S1] and [S2] are source devices and [D] is a destination device. The data in S2 is subtracted from the data in S1. If the resultant value overflows or underflows, the flags M8022 or M8021 respectively are set and the result is stored in [D] along with the sign of the result.

iii) MUL: Arithmetic Function used to perform multiplication of the data from two source devices and store the result in a destination device. The source devices may be constants or registers but the destination device cannot be a constant. Function usage:

MUL [S1] [S2] [D]

Where [S1] and [S2] are source devices and [D] is a destination device. If using 16-bit mode, the function multiplies two 16-bit values and produces a 32-bit value. Else, if using 32-bit mode, the function multiplies two 32-bit values and produces a 64-bit value. This value is then stored using the destination device specified as the least of the two or four registers used for storage corresponding to storing a 32-bit or 64-bit value. In case of overflow, the higher order bits are lost.

## Uses for D Registers and Special Diagnostic Auxiliary Relays M8000, M8002, M8033, and M8034

iv) DIV: Arithmetic Function used to divide the value in one source device by the value in another source device and store the result in a destination device. The source devices may be constants or registers but the destination device cannot be a constant. Function usage:

DIV [S1] [S2] [D]

Where [S1] and [S2] are source devices and [D] is a destination device. S1 is divided by S2. If using 16-bit mode, the function multiplies two 16-bit values and produces two 16-bit values. Else, if using 32-bit mode, the function multiplies two 32-bit values and produces two 32-bit values. These are the quotient and remainder, which are then stored using the destination device specified as the least of the two or four registers used for storage corresponding to storing a 32-bit or 64-bit value. In case S2 is zero, an operation error is executed and the DIV is not executed.

v) ZRST: Zone Reset is a Data Operation function which is used to reset an entire range of devices. Thus, it can be used to reset (set to 0) all counter, all high-speed counters, all timers, all registers, etc. or even a subset of these devices. The only limitation is that only one type of devices can be specified in a single Zone Reset function call. For example, the range of devices cannot include all timers and counters, or all standard counters and high-speed counters. Function Usage:

ZRST [D1] [D2]

Where D1 is the first device and D2 is the last device in the range of devices to be reset. If D1 > D2 then only D1 will be reset.

vi) CMP: Compare Function used to perform an algebraic comparison of the values of two Source devices and store the result (less than, equal to or greater than) in three consecutive bit registers, the first of which is the destination device specified. Function Usage:

CMP [S1] [S2] [D]

Where S1 and S2 are the source devices whose values are to be compared and D is the destination device.

vii) ZCP: Compare Function used to compare a single source device’s value against a range of values and the results are stored in a destination device in the same manner as a standard compare function. Function Usage:

ZCP [S1] [S2] [S3] [D]

Where S3 is the source device which is to be compared and S1-S2 is the range against which it is compared. D is the destination device.

i) D (Data) Registers: Data registers, as indicated by the name, are storage devices used for holding 16 or 32 bit values. These values may be numeric data or bit patterns. General Use registers can hold data temporarily, i.e. for one program scan unless the M8033 relay is ON. Battery Backed/Latched registers always retain data over multiple program scans unless it is overwritten. Special Diagnostic registers are used to indicate specific states of the PLC and used for debugging purposes, and also retain their values over program scans. They are reset when the power is first turned ON.

Externally adjustable registers contain a value of 0 to 255 which is controlled using pots provided on the PLC itself.

ii) Special Diagnostic Auxiliary Relays M8000, M8002, M8033 and M8034: These diagnostic relays serve to indicate fixed pre-determined statuses or setting/resetting them causes the PLC to drive specific coils.

The M8000 indicates that the PLC is currently running i.e. it is ON during runs.

The M8002 registers a pulse at the moment when power is turned ON to the PLC.

The M8033, when SET, causes all output statuses to be retained after the operation of the PLC is stopped.

The M8034, when SET, disables all outputs.

**Cite This Work**

To export a reference to this article please select a referencing stye below:

My Assignment Help. (2016). *PLC Fundamentals: Output Functions, Analog-to-Digital Conversion, And Mitsubishi FX Function Descriptions*. Retrieved from https://myassignmenthelp.com/free-samples/programmable-logic-controller-fx1s.

"PLC Fundamentals: Output Functions, Analog-to-Digital Conversion, And Mitsubishi FX Function Descriptions." My Assignment Help, 2016, https://myassignmenthelp.com/free-samples/programmable-logic-controller-fx1s.

My Assignment Help (2016) *PLC Fundamentals: Output Functions, Analog-to-Digital Conversion, And Mitsubishi FX Function Descriptions* [Online]. Available from: https://myassignmenthelp.com/free-samples/programmable-logic-controller-fx1s

[Accessed 26 February 2024].

My Assignment Help. 'PLC Fundamentals: Output Functions, Analog-to-Digital Conversion, And Mitsubishi FX Function Descriptions' (My Assignment Help, 2016) <https://myassignmenthelp.com/free-samples/programmable-logic-controller-fx1s> accessed 26 February 2024.

My Assignment Help. PLC Fundamentals: Output Functions, Analog-to-Digital Conversion, And Mitsubishi FX Function Descriptions [Internet]. My Assignment Help. 2016 [cited 26 February 2024]. Available from: https://myassignmenthelp.com/free-samples/programmable-logic-controller-fx1s.