Function to write to an FP0-A04V unit.
This function 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.
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.
Values: -2000 to +2000
Output
Unit status: TRUE when the power is on.
Channel status: TRUE if there is an error.
Digital value (INT) |
Analog value |
---|---|
-2000 |
-10.0V |
-1500 |
-7.5V |
-1000 |
-5.0V |
-500 |
-2.5V |
0 |
0.0V |
+500 |
+2.5V |
+1000 |
+5.0V |
+1500 |
+7.5V |
+2000 |
+10.0V |
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
iAnalog_Out_Ch0: INT:=0;
iAnalog_Out_Ch1: INT:=0;
iAnalog_Out_Ch2: INT:=0;
iAnalog_Out_Ch3: INT:=0;
bPowerIsOn: BOOL:=FALSE;
bErrorChannel0: BOOL:=FALSE;
bErrorChannel1: BOOL:=FALSE;
bErrorChannel2: BOOL:=FALSE;
bErrorChannel3: BOOL:=FALSE;
END_VAR
The digital values entered at iOutChannel0–iOutChannel3 are written to the analog unit and converted into analog values. The analog data is output at the corresponding output channels.
Use ExpansionUnitNumberToIOWordOffset_FP0 or ExpansionUnitNumberToIOWordOffset_FPX_FP0 to calculate the word offset of the analog unit connected to the CPU.
BODY
WORKSPACE
NETWORK_LIST_TYPE := NWTYPELD ;
END_WORKSPACE
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 7 ;
NETWORK_BODY
B(B_F,Unit_AnalogOutput_FP0_A04V!,,18,0,32,7,,?DiIOWordOffset?DiOutChannel0?DiOutChannel1?DiOutChannel2?DiOutChannel3?CbPowerIsOn?CbErrorChannel0?CbErrorChannel1?CbErrorChannel2?CbErrorChannel3);
B(B_VARIN,,2,16,1,18,3,);
B(B_VAROUT,,bPowerIsOn,32,1,34,3,);
B(B_VARIN,,iAnalog_Out_Ch0,16,2,18,4,);
B(B_VAROUT,,bErrorChannel0,32,2,34,4,);
B(B_VARIN,,iAnalog_Out_Ch1,16,3,18,5,);
B(B_VAROUT,,bErrorChannel1,32,3,34,5,);
B(B_VARIN,,iAnalog_Out_Ch2,16,4,18,6,);
B(B_VAROUT,,bErrorChannel2,32,4,34,6,);
B(B_VARIN,,iAnalog_Out_Ch3,16,5,18,7,);
B(B_VAROUT,,bErrorChannel3,32,5,34,7,);
L(1,0,1,7);
END_NETWORK_BODY
END_NET_WORK
END_BODY
Unit_AnalogOutput_FP0_A04V(iIOWordOffset := 2,
iOutChannel0 := iAnalog_Out_Ch0,
iOutChannel1 := iAnalog_Out_Ch1,
iOutChannel2 := iAnalog_Out_Ch2,
iOutChannel3 := iAnalog_Out_Ch3,
bPowerIsOn => bPowerIsOn,
bErrorChannel0 => bErrorChannel0,
bErrorChannel1 => bErrorChannel1,
bErrorChannel2 => bErrorChannel2,
bErrorChannel3 => bErrorChannel3);