Unit_AnalogInOut_FP0R_A21

Function block to write to and read from an FP0R-A21 unit.

This function block writes digital data to the analog output channel of the analog unit and reads converted digital data from its analog input channels. The digital values to be converted and output as analog values are specified at iOutChannel0. The converted digital values from the analog unit are stored per channel in the output variables iInChannel0 and iInChannel1.

The analog output and input ranges are also set with this function block.

The voltage or current output must be set with the DIP switches.

Parameters

Input

iIOWordOffset (INT)

Set the offset of the first WX/WY address of the analog unit according to its installation position.

For analog expansion units connected directly to the CPU (without adapter): Use ExpansionUnitToIOWordOffset_FP0 or make the following settings: 2 (WX2/WY2) for unit number 1, 4 (WX4/WY4) for unit number 2, 6 (WX6/WY6) for unit number 3

For analog expansion units connected to the CPU via an adapter: Use ExpansionUnitToIOWordOffset_FPX_FP0 or select the offset from the table.

Unit position relative to the adapter

Adapter position relative to the CPU

1st unit

2nd unit

3rd unit

4th unit

5th unit

6th unit

7th unit

8th unit

1st unit

30

40

50

60

70

80

90

100

2nd unit

32

42

52

62

72

82

92

102

3rd unit

34

44

54

64

74

84

94

104

iOutChannel0 (INT)

Set the digital value to be converted and output by the analog unit.

Values:
  • For -10 to +10V, -5 to +5V: -8000 to +8000
  • For 0 to 10V, 0 to 5 V, 0 to 20mA, 4 to 20mA: 0 to 16000
iOutChannel0_Config (INT)

Set the voltage or current range for the analog output channel.

Values:
  • 0: -10 to +10V, 0 to 20mA
  • 1: -5 to +5V, 4 to 20mA
  • 2: 0 to 10V
  • 3: 0 to 5V
iInChannel0_Config, iInChannel1_Config (INT)

Set the voltage or current range for the analog input channel.

Values:
  • 0: -10 to +10V
  • 1: -5 to +5V
  • 2: 0 to 10V
  • 3: 0 to 5V, 0 to 20mA (depending on wiring method)

Output

bConfigIsDone (BOOL)

TRUE when I/O configuration is completed and the unit is ready.

iInChannel0, iInChannel1 (INT)

Returns the converted digital data from the analog unit by channel.

Values:
  • For -10 to +10V, -5 to +5V: -8000 to +8000
  • For 0 to 10V, 0 to 5 V, 0 to 20mA, 4 to 20mA: 0 to 16000

DIP switch settings

DIP switches 1 and 2 must be ON to use 14-bit mode. DIP switch 3 is used to set voltage or current output, and DIP switch 5 is used to turn averaging on or off. DIP switch 4 is not used and can be either ON or OFF.

The DIP switch settings will become effective when the power is turned from OFF to ON.

Voltage or current output:
 

Voltage output

Current output

Input averaging:

No averaging: Conversion data is set for the specified input contact point area for each A/D conversion, on each channel.

Averaging: On each channel, for each A/D conversion, the maximum and minimum values from the data of the last ten times are excluded, the data from the other eight times is averaged and the result is set.

 

No averaging

Averaging

Input wiring

Voltage input

Current input

Connect the input instrument between the IN/V and IN/COM terminals.

Connect the IN/V and IN/I terminals. Connect the input instrument between the bridge and the IN/COM terminal.

Output wiring

Voltage output

Current output

Connect the output instrument between the OUT/V and OUT/COM terminals.

Connect the output instrument between the OUT/I and OUT/COM terminals.

Conversion characteristics

-10V to +10V DC input or output

-5V to +5V DC input or output

0V to 5V DC input or output

Digital value (INT)

Analog value

Digital value (INT)

Analog value

Digital value (INT)

Analog value

-8000

-10V

-8000

-5V

0

0.0V

-4000

-5V

-4000

-2.5V

4000

1.25V

0

0V

0

0V

8000

2.5V

+4000

+5V

+4000

+2.5V

12000

3.75V

+8000

+10V

+8000

+5V

16000

5.0V

0V to 10V DC input or output

0mA to 20mA input or output

4mA to 20mA output

Digital value (INT)

Analog value

Digital value (INT)

Analog value

Digital value (INT)

Analog value

0

0.0V

0

0.0mA

0

4.0mA

4000

2.5V

3200

4.0mA

4000

8.0mA

8000

5.0V

6400

8.0mA

8000

12.0mA

12000

7.5V

9600

12.0mA

12000

16.0mA

16000

10.0V

12800

16.0mA

16000

20.0mA

 

16000

20.0mA

 
Tip

This command description provides basic hardware documentation only. For detailed technical information, consult the manual:

FP0R Analog I/O Unit User's Manual

Example

POU header

All input and output variables used for programming this function have been declared in the POU header. The same POU header is used for all programming languages.

VAR
	Inst_FP0R_A21: Unit_AnalogInOut_FP0R_A21;
	iAnalogOut0: INT:=0;
	bIO_Config_done: BOOL:=FALSE;
	iAnalogIn0: INT:=0;
	iAnalogIn1: INT:=0;
END_VAR

LD body

BODY
    WORKSPACE
        NETWORK_LIST_TYPE := NWTYPELD ;
    END_WORKSPACE
    NET_WORK
        NETWORK_TYPE := NWTYPELD ;
        NETWORK_LABEL :=  ;
        NETWORK_TITLE :=  ;
        NETWORK_HEIGHT := 8 ;
        NETWORK_BODY
B(B_COMMENT,,FP0R-A21,2,1,17,2,);
B(B_FB,Unit_AnalogInOut_FP0R_A21!,Inst_FP0R_A21,19,1,34,8,,?BiIOWordOffset?BiOutChannel0?BiOutChannel0_Config?BiInChannel0_Config?BiInChannel1_Config?CbConfigIsDone?CiInChannel0?CiInChannel1);
B(B_VARIN,,2,17,2,19,4,);
B(B_VAROUT,,bIO_Config_done,34,2,36,4,);
B(B_VARIN,,iAnalogOut0,17,3,19,5,);
B(B_VAROUT,,iAnalogIn0,34,3,36,5,);
B(B_VARIN,,3,17,4,19,6,);
B(B_VAROUT,,iAnalogIn1,34,4,36,6,);
B(B_VARIN,,0,17,5,19,7,);
B(B_VARIN,,0,17,6,19,8,);
L(1,0,1,8);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

ST body

Inst_FP0R_A21(iIOWordOffset := 2,
	iOutChannel0 := iAnalogOut0,
	iOutChannel0_Config := 3,
	iInChannel0_Config := 0,
	iInChannel1_Config := 0,
	bConfigIsDone => bIO_Config_done,
	iInChannel0 => iAnalogIn0,
	iInChannel1 => iAnalogIn1);

Modified on: 2024-06-20Feedback on this pagePanasonic hotline