您的当前位置:首页正文

FM350-2程序说明

2021-07-01 来源:易榕旅网


OB82 FC2/ FC3/ FC4/FC5/FC300/DB2/UDT1/0B1 NETWORK1 都要拷贝到原程序中。

在DB2.DBW12中有一个FM350模块地址的设置。要与S7硬件配置中FM350的地

址一样硬件配置中地址为I:272-287 Q:272-287。DB2.DBW12=W#16#110=272.

程序说明

OB1 network1

CALL \"CiShan\" //调用FC300程序块

cnt2_app :=W#16#2 //背景数据块号 DB2

quantity :=MW4 //预装载值,为MW4赋值,当前为零,也可以用W#16#0

load :=M0.2 //装载计数器值,计数器应用时此点为1

Gate0_3 :=M0.0 //打开计数器0-3通道的软件门

Gate4_5 :=M0.1 //打开计数器4-5通道的软件门

act_val :=M0.3 //开始读当前计数值的触发位

channel :=M0.4 //0为计数器通道0-3计数 1为为计数器通道4-7计数,应置1

rd_err :=M2.2 //读操作的出错提示

wr_err :=M2.1 //写操作的出错提示

load_done :=M2.0 //装载计数器操作的状态指示

state_oflw:=M2.3 //通道4测量值上限溢出状态指示

state_uflw:=M2.4 //通道4测量值下限溢出状态指示

FC300 程序说明

network1

L #cnt2_app T #cnt2_db OPN DB [#cnt2_db]

CALL \"CNT2_CTR\" DB_NO:=#cnt2_db

A DBX 36.7 JCN END A DBX 38.4 //Application fill unit

//Open counter data block

//Control the FM 350-2 调用FC2

//FM 350-2 parameters assigned?

//No, process no application

//Lower limit exceeded?

= #state_uflw

A DBX 39.4 //Upper limit exceeded?

= #state_oflw

A #Gate0_3 = DBX 23.0 = DBX 23.1 = DBX 23.2 = DBX 23.3 A #Gate0_3 A DBX 43.0 = DBX 21.0 A #Gate0_3 AN DBX 42.0 //Start the fill unit?

//Yes, SW_GATE0 open

//Yes, SW_GATE1 open

//Yes, SW_GATE2 open

//Yes, SW_GATE3 open

//Start the fill unit?

//Yes, CTRL_DQ0 = STAT_GATE0

//and trigger fill valve

//Start the fill unit?

//Yes, invert STAT_DQ0

= DBX 21.1 //and trigger motor for transport

= DBX 22.1 //with CTRL_DQ1 and SET_DQ1

A #Gate4_5 //Start the frequency measurement?

= DBX 23.4 = DBX 23.5 // = DBX 23.6 用通道6将前面注释符去掉

// = DBX 23.7 用通道7将前面注释符去掉

network2

SET SAVE

OPN DB [#cnt2_db] A DBX 1.0 //Yes, SW_GATE4 open

//Yes, SW_GATE5 open

//Yes, SW_GATE6 open 想要使 //Yes, SW_GATE7 open 想要使//Set BR for error evaluation

//Open counter data block

//Load comparator in progress?

JC WRDO //Yes

A DBX 42.1 //New loading only during transport

JCN WREN

A #load FP M 10.0 序其它地方应用冲突

JCN WREN L #quantity T DBD 116

L 42 T DBB 0 WRDO: CALL \"CNT2_WR\" comparator for FM 350-2

DB_NO :=#cnt2_db

//Load new quantity?

//Positive edge to #load 注意不能和程 //No

//Quantity in counter data block

//job_no 30 for

//Load comparator count channel 0

//Load counter and

RET_VAL:=MW6 //注意不能和程序其它地方应用冲突

WREN: AN BR //Error: job_no unknown, retval_wr with error or data

error

= #wr_err

AN #load R DBX 1.1 A DBX 1.1

= #load_done

network 3

SET SAVE

OPN DB [#cnt2_db] A DBX 3.0 //Create write job ended

//Deleted when loading triggered

//Set BR for error evaluation

//Open counter data block

//Read actual values in progress?

JC RDDO //Yes

AN #act_val //Reading actual values?

JC RDEN //No

L 100 AN #channel JC JOB

L 101 JOB: T DBB 2 0

RDDO: CALL \"CNT2_RD\" for FM 350-2

DB_NO :=#cnt2_db

RET_VAL:=MW8 RDEN: AN BR retval_rd with error

//job_no 100 for count channel 0 to 3

//for count channel 4 to 7?

//job_no 101 for count channel 4 to 7

//Load comparator count channel //Load counter and comparator //注意不能和程序其它地方应用冲突

//Error: job_no unknown or

= #rd_err

END: BE

因篇幅问题不能全部显示,请点此查看更多更全内容