Function block to write to an FP0R-DA4 unit.
This function block writes digital data to the analog output channels of the analog unit. The digital values to be converted and output as analog values are specified at iOutChannel0 to iOutChannel3.
The analog output ranges are also set with this function block.
The voltage or current output must be set with the DIP switches.
Input
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 |
Set the digital value to be converted and output by the analog unit.
Set the voltage or current range for the analog output channel.
Output
Unit status: TRUE when the power is on.
TRUE when I/O configuration is completed and the unit is ready.
Channel status: TRUE if there is an error.
Switch 1 must be ON to use 14-bit mode. Switch 2 to 5 are used to select voltage or current output for each channel.
The DIP switch settings will become effective when the power is turned from OFF to ON.
Channel 0 |
Channel 1 |
Channel 2 |
Channel 3 |
|||||
---|---|---|---|---|---|---|---|---|
Voltage output |
Current output |
Voltage output |
Current output |
Voltage output |
Current output |
Voltage output |
Current output |
|
Voltage output |
Current output |
---|---|
-10V to +10V DC output |
-5V to +5V DC output |
0V to 5V DC output |
|||
---|---|---|---|---|---|
Digital value (INT) |
Analog value |
Digital value (INT) |
Analog value |
Digital value (INT) |
Analog value |
-8000 |
-10.0V |
-8000 |
-5.0V |
0 |
0.0V |
-4000 |
-5.0V |
-4000 |
-2.5V |
4000 |
1.25V |
0 |
0V |
0 |
0V |
8000 |
2.5V |
+4000 |
5.0V |
+4000 |
+2.5V |
12000 |
3.75V |
+8000 |
10.0V |
+8000 |
+5.0V |
16000 |
5.0V |
0V to 10V DC output |
0mA to 20mA 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 |
4000 |
12.0mA |
12000 |
7.5V |
9600 |
12.0mA |
4000 |
16.0mA |
16000 |
10.0V |
12800 |
16.0mA |
16000 |
20.0mA |
16000 |
20.0mA |
This command description provides basic hardware documentation only. For detailed technical information, consult the manual:
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_DA4: Unit_AnalogOutput_FP0R_DA4;
iAnalogOut0: INT:=0;
iAnalogOut1: INT:=0;
iAnalogOut2: INT:=0;
iAnalogOut3: INT:=0;
bPowerIsOn: BOOL:=FALSE;
bConfig_done: BOOL:=FALSE;
bErrorCh0: BOOL:=FALSE;
bErrorCh1: BOOL:=FALSE;
bErrorCh2: BOOL:=FALSE;
bErrorCh3: BOOL:=FALSE;
END_VAR
BODY
WORKSPACE
NETWORK_LIST_TYPE := NWTYPELD ;
END_WORKSPACE
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 12 ;
NETWORK_BODY
B(B_COMMENT,,FP0R-DA4,2,1,17,2,);
B(B_FB,Unit_AnalogOutput_FP0R_DA4!,Inst_FP0R_DA4,19,1,36,12,,?BiIOWordOffset?BiOutChannel0?BiOutChannel1?BiOutChannel2?BiOutChannel3?BwOutChannel0_Config?BwOutChannel1_Config?BwOutChannel2_Config?BwOutChannel3_Config?CbPowerIsOn?CbConfigIsDone?CbErrorChannel0?CbErrorChannel1?CbErrorChannel2?CbErrorChannel3);
B(B_VARIN,,4,17,2,19,4,);
B(B_VAROUT,,bPowerIsOn,36,2,38,4,);
B(B_VARIN,,iAnalogOut0,17,3,19,5,);
B(B_VAROUT,,bConfig_done,36,3,38,5,);
B(B_VARIN,,iAnalogOut1,17,4,19,6,);
B(B_VAROUT,,bErrorCh0,36,4,38,6,);
B(B_VARIN,,iAnalogOut2,17,5,19,7,);
B(B_VAROUT,,bErrorCh1,36,5,38,7,);
B(B_VARIN,,iAnalogOut3,17,6,19,8,);
B(B_VAROUT,,bErrorCh2,36,6,38,8,);
B(B_VARIN,,0,17,7,19,9,);
B(B_VAROUT,,bErrorCh3,36,7,38,9,);
B(B_VARIN,,0,17,8,19,10,);
B(B_VARIN,,0,17,9,19,11,);
B(B_VARIN,,0,17,10,19,12,);
L(1,0,1,12);
END_NETWORK_BODY
END_NET_WORK
END_BODY
Inst_FP0R_DA4(iIOWordOffset := 2,
iOutChannel0 := iAnalogOut0,
iOutChannel1 := iAnalogOut1,
iOutChannel2 := iAnalogOut2,
iOutChannel3 := iAnalogOut3,
wOutChannel0_Config := 0,
wOutChannel1_Config := 0,
wOutChannel2_Config := 0,
wOutChannel3_Config := 0,
bPowerIsOn => bPowerIsOn,
bConfigIsDone => bConfig_done,
bErrorChannel0 => bErrorCh0,
bErrorChannel1 => bErrorCh1,
bErrorChannel2 => bErrorCh2,
bErrorChannel3 => bErrorCh3);