You are on page 1of 12

Analog value treatment Contents

Analog value treatment


Contents
Analog inputs, basic unit............................................ 2
Programming examples ......................................... 3
Analog timers......................................................... 4
Analog output, basic unit ........................................... 5
Analog modules ......................................................... 6
Analog inputs......................................................... 6
Analog outputs....................................................... 9

11.08.93, 396.0432 System manual, page 8.1


Analog inputs, basic unit Analog value treatment

Analog inputs, basic unit


The SELECONTROL® PMC 21 and PMC 22 are equipped with 8 analog inputs (or 4
in case of option Z) having an 8-bit resolution (0 ... 255).
The values obtained are automatically written into the data registers D 15.00 ... D 15.14
from which they can be read out by the user-program.
The values are stored in binary form in the data registers.
The values from the data registers D 15.08 ... D 15.14 and 1 data register from the block
D 15.00 ... D 15.06 are converted per cycle.
When the SELECONTROL® PMC 20 is started, the old values are still in the data
registers D 15.00...D 15.14. It is only after four program cycles have been run through
that correct measurement values are to be found in data register D 15.06.
This situation has to be taken into account in the program, e.g. by introducing delay
periods.
The potentiometer blocks SELECONTROL® ATP 20 can be used to set up the
values 0 ... 255 directly in the SELECONTROL® PMC 20 for analog timer purposes.

Note: The SELECONTROL® ATP 20 are described


in chapter "Hardware description".

System manual, page 8.2 11.08.93, 396.0432


Analog value treatment Analog inputs, basic unit

Programming examples
Example 1
An input voltage of 0 ... +10V is to be deposited in the data register D 15.56 in terms of
the units 0 ... 255.

Line No. Operation Operand Remark


0000 L M 40.00 If marker log. 1
0001 FTW D 15.00 Read data register (Channel 0)
0002 BID Code conversion (binary to decimal)
0003 STW D 15.56 Write to data register
0004 EP End of program

Example 2
The input voltage of 0 ... +10V is to appear in data register D 15.60 in volts.

Line No. Operation Operand Remark


0000 L M 40.00 If marker log. 1
0001 FTW D 15.00 Read data register (Channel 0)
0002 BID Code conversion (binary to decimal)
0003 DIV K 00025 Divide by constant
(255 units : 25 = 10V approx.)
0004 STW D 15.60 Write to data register
0005 EP End of program

11.08.93, 396.0432 System manual, page 8.3


Analog inputs, basic unit Analog value treatment

Example 3
Switch-on delay with analog timing. The analog set value of 0 ... 255 is stored in data
register D 15.00.

Line No. Operation Operand Remark


0000 L I 00.00 If input
0001 FTW D 15.00 Read set value
0002 BID Binary/decimal conversion
0003 TF D 15.60 Decrement 0.1s-clock
0004 A D 15.60 AND data register value 0000
0005 = O 01.00 Then output
0006 EP End of program

Analog timers
It is possible to set various times through the use of the analog inputs. Instead of
utilising a data registers or a constant, the analog input can be used as an operand in
which the value present at the analog input is taken as the preset value for the timer.

System manual, page 8.4 11.08.93, 396.0432


Analog value treatment Analog output, basic unit

Analog output, basic unit


The analog output channel has an 8-bit resolution (0 ... 255). The value to be output is
written to the data register D 15.16 by the user-program.
The values must be written to the data register D 15.16 in binary form.
The data registers contain undefined values when the SELECONTROL® PMC 20 is
started. Correct measurement values are available only after the first conversion time
has elapsed. This condition must be taken into account in the program, e.g. by
introducing delay times.

Program example
A voltage of 0 ... +10V is to be produced at the output. Values in the range 0 ... 255 are
to be set at channel 0 of the analog input (data register D 15.00) using the potentiometer
block type ATP 20.

Line No. Operation Operand Remark


0000 L I 00.00 If input
0001 FTW D 15.00 Read data register (Channel 0)
002 STW D 15.16 Write to data register (Analog output)
0003 EP End of program

11.08.93, 396.0432 System manual, page 8.5


Analog modules Analog value treatment

Analog modules
Analog inputs
The extension modules convert analog process-signals (0 ... +10V, 0 ... +20mA, Pt 100,
0 ... 0.5V) into digital values for the CPU. During the I/O-phase these digital values are
copied into the internal RAM-memory of the CPU (4 channels per I/O-phase).
Access for processing in the program is effected via the R-register (word).
The values in the R-register have to be written in binary form.
When the SELECONTROL® PMC is started, the old values are still in the R-register.
Correct measurement values are available only after the first conversion time has
elapsed.
This situation has to be taken into account in the program, e.g. by introducing delay
periods.

Access commands and addresses of the modules 1 ... 4:


Channel 0 FTW R xx.00
Channel 1 FTW R xx.02
Channel 2 FTW R xx.04
Channel 3 FTW R xx.06

The entire address range is described in the chapter entitled "Programming".


The ADC converts the input into 12-bit data. A 16-bit word register is assigned to each
channel.

System manual, page 8.6 11.08.93, 396.0432


Analog value treatment Analog modules

R-Register ( 16 bits ):

0 0 0 0 MSB X X X X X X X X X X LSB

LSB: Least Significant Bit


MSB: Most Significant Bit

The analog input is converted into "offset binary" code:

Smallest measurement: 0000 (twelve times "0") ±0.3% tolerance


Largest measurement: 0FFF (twelve times "1" = 4095 decimal) ±0.3% tolerance
The most significant four bits of the word register are always "0".

The values are calculated as follows:

Range Register content Input signal


0 ... 10V 4095 10(V) * Inc
Inc= 10 (V) * AIN AIN=
4095

0 ... 20mA 4095 20(mA) * Inc


Inc= 20 (mA) * AIN AIN=
4095

0 ... 500mV 4095 500(mV) * Inc


Inc= 500 (mV) * AIN AIN=
4095

Pt 100 Inc= (T x 0,385 + 100) * 16.38 1585,72


T= - 259.74
1000

Inc = converted measuring value in increments


AIN = analog input signal
T = Temperature in °C

11.08.93, 396.0432 System manual, page 8.7


Analog modules Analog value treatment

The formulas for Pt 100 calculations are based on the linearisation of the Pt 100
characteristic curve over the temperature range between 0 and 100°C. Temperatures can
hence also be calculated that lie slightly outside this range.
Note: Take the possible measurement inaccuracies into account that might occur
through this linearisation. If the deviation is seen to be too great then the Pt
100 will have to be newly linearised on the basis of the information supplied
by the manufacturer concerned.

Programming example
The analog signal of channel 0, plug-in-board 04.00 is to be written as a decimal value
into data register D 00.00. Additionally, the output 01.00 should be activated if the
largest measurement value is reached.

Line No. Operation Operand Remark


0000 L M 40.00 If marker log. 1
0001 FTW R 04.00 Read R-register
0002 BID Binary-decimal-conversion
0003 STW D 00.00 Write in data register
0004 GTE K 04095 If maximal value
0005 = O 05.00 Then output
0006 EP End of program

The input parameters are adjusted using the code switcher which is described in the
section entitled "Hardware description".

Unit-size per bit:


Analog value Unit-size per bit
0 ... +10V 2.44mV
0 ... +500mV 122.1µV

0 ... +20mA 4.88µA

System manual, page 8.8 11.08.93, 396.0432


Analog value treatment Analog modules

Analog outputs
The extension modules convert digital values from the CPU into the analog signals
0 ... +10V, ±10V or 0 ... +20mA.
Access for processing in the program is effected via the R-register (word).
The values have to be written in binary form into the R-register.
When the SELECONTROL® PMC is started, the old values are still in R-register.
Correct measurement values are available only after the first conversion time has
elapsed. This situation has to be taken into account in the program, e.g. by introducing
delay periods.

Access commands and addresses of the modules 1 ... 4:


Channel 0 STW R xx.00
Channel 1 STW R xx.02
Channel 2 STW R xx.04
Channel 3 STW R xx.06

The entire address range is described in the section entitled "Programming".


The DAC converts a 12 bit-binary-value into an analog signal.
Range: 0000 ... 0FFF (hexadecimal)
The following conversions relate to the decimal system.
A calculated decimal value therefore has to be converted to a binary value before it can
be fed to an analog output module by an STW R XX.XX instruction.

The DEB (decimal/binary) operation carries out the conversion.

Digital Analog output quantity Analog output quantity


value D 0 ... +10V 0 ... +20mA -10 ... +10V
000010 0.0V 0.0mA -10.0V
204710 +5.0V +10.0mA +0.0V
409510 +10.0V +20.0mA +10.0V

11.08.93, 396.0432 System manual, page 8.9


Analog modules Analog value treatment

The values are calculated as follows:

Range Register content Output signal


0 ... +10V 4095 Inc * 10(V)
Inc= 10 (V) * AOUT AOUT=
4095
± 10V 4095
AOUT=
Inc * 20(V)
- 10V
Inc= 20(V) * (AOUT + 10V)
4095
0 ... +20mA 4095 Inc * 20(mA)
Inc= 20(mA) * AOUT AOUT=
4095

Inc = numerical value in increments


AOUT = analog output signal

System manual, page 8.10 11.08.93, 396.0432


Analog value treatment Analog modules

Example
When the input 00.00 is not set, a value of +3V should be generated by channel 1 of the
analog output module in slot 3 and channel 2 of the same module should generate a
value of +4mA.
Ranges: Channel 1: 0 ... +10V
Channel 2: 0 ... +20mA
Channel 1: D = 409.5 x U = 122810
Channel 2: D = 204.75 x I = 204.75 x 4 = 81910

Program
Line No. Operation Operand Remark
0000 LN I 00.00 If not input
0001 FTW K 01228 Read constant
0002 DEB Conversion dec. > binary
0003 STW R 05.02 Write channel 1
0004 FTW K 00819 Read constant
0005 DEB Conversion dec. > binary
0006 STW R 05.04 Write channel 2

The input parameters are adjusted via code switchers which are described in the section
entitled "Hardware description".

Unit size per bit:


Analog value Unit size per bit
0 ... 10V 2.44mV
±10V 4.88mV
0 ... 20mA 4.88µA

11.08.93, 396.0432 System manual, page 8.11


Analog modules Analog value treatment

System manual, page 8.12 11.08.93, 396.0432

You might also like