发布于 2003-07-23 19:09:28
0楼
network1
network2 Initialization of the Average and the Running Sum
LD sm0.1
MOVD +0, VD154
MOVD +0, VD158
MOVD +0, VD162
network3 Compute the Difference between the New Value and the Average Value
LD Sm0.0
MOVW +0, VW154
MOVW AIW0, VW156
-I VW164, VW156
network4 If New Value and Average Value Differ Greatly, Save the Last Sample
LDW>= VW156, +320
OW<= VW156, -320
+I VW164, VW156
MOVW VW156, VW160
LPS
A V160.7
MOVW 16#FFFF, VW158
LPP
SLD VD158, 4
MOVW +0, VW156
network5 If the Result Is Negative, Sign Extend the Difference
LD V156.7
MOVW 16#FFFF, VW154
network6 Compute and Output the Average Value, or Process an Error Condition
LDN Mod_0_IO_3 // If an analog input module is
// present
AN Mod_0_IO_2
NOT
AN Mod_0_Present
A Mod_0_IO_Type
AB= Mod_0_Error, 0
+D VD154, VD158
MOVD VD158, VD162
SRD VD162, 4
MOVW VW164, VW166
NOT
= Q0.2
Forever