Function to write to an FP0-A04I 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: 0 to 4000
Output
Unit status: TRUE when the power is on.
Channel status: TRUE if there is an error.
Digital value (INT) |
Analog value |
---|---|
0 |
4.0mA |
500 |
6.0mA |
1000 |
8.0mA |
1500 |
10.0mA |
2000 |
12.0mA |
2500 |
14.0mA |
3000 |
16.0mA |
3500 |
18.0mA |
4000 |
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
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_A04I!,,15,0,29,7,,?DiIOWordOffset?DiOutChannel0?DiOutChannel1?DiOutChannel2?DiOutChannel3?CbPowerIsOn?CbErrorChannel0?CbErrorChannel1?CbErrorChannel2?CbErrorChannel3);
B(B_VARIN,,2,13,1,15,3,);
B(B_VAROUT,,bPowerIsOn,29,1,31,3,);
B(B_VARIN,,iAnalog_Out_Ch0,13,2,15,4,);
B(B_VAROUT,,bErrorChannel0,29,2,31,4,);
B(B_VARIN,,iAnalog_Out_Ch1,13,3,15,5,);
B(B_VAROUT,,bErrorChannel1,29,3,31,5,);
B(B_VARIN,,iAnalog_Out_Ch2,13,4,15,6,);
B(B_VAROUT,,bErrorChannel2,29,4,31,6,);
B(B_VARIN,,iAnalog_Out_Ch3,13,5,15,7,);
B(B_VAROUT,,bErrorChannel3,29,5,31,7,);
L(1,0,1,7);
END_NETWORK_BODY
END_NET_WORK
END_BODY
Unit_AnalogOutput_FP0_A04I(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);