回复:求助(解释该程序段,特别是W#16#1002的含义)

xkqxwhz

  • 帖子

    1178
  • 精华

    10
  • 被关注

    40

论坛等级:奇侠

注册时间:2009-03-26

普通 普通 如何晋级?

发布于 2013-11-16 16:59:52

11楼

这是ANY类型的结构,我也正在学,最近做了一台设备,程序是老外给的模板,他的数据转换和处理全是这种结构编的,程序读起来太费劲了,跟帖学习中!

//Generate Pointer to Drive Outputs
OPN #iDriveIntfcDB
L DBNO
T #tDriveIntfcDBNum
LAR1 P##tOutputsPointer

L B#16#10 // 10 hex = S7 Data Type
T LB [AR1,P#0.0] // Transfer to Source pointer byte 0

L B#16#2 // 2 hex = byte data type
T LB [AR1,P#1.0] // Transfer to Source pointer byte 1

L 24 // How many bytes to move
T LW [AR1,P#2.0] // Transfer to Source pointer bytes 2-3

L #tDriveIntfcDBNum // Load DB Number
T LW [AR1,P#4.0] // Transfer to Source pointer bytes 4-5

L 172 // Load start address of data
SLD 3 // Shift data in AR1 3 bits to the left
T LD [AR1,P#6.0] // Trasfer to Source Pointer bytes 6-9

L B#16#84 // 84 hex = DB memory area
T LB [AR1,P#6.0] // Transfer to Source pointer byte 6

//Transfer Outputs From Drive Interface DB To Local Copy
CALL SFC 20
SRCBLK :=#tOutputsPointer
RET_VAL:=#tRet
DSTBLK :=#tDriveIntfc.Output


//Generate Pointer to Drive Inputs In Drive Interface DB
LAR1 P##tInputsPointer

L B#16#10 // 10 hex = S7 Data Type
T LB [AR1,P#0.0] // Transfer to Source pointer byte 0

L B#16#2 // 2 hex = byte data type
T LB [AR1,P#1.0] // Transfer to Source pointer byte 1

L 14 // How many bytes to move
T LW [AR1,P#2.0] // Transfer to Source pointer bytes 2-3

L #tDriveIntfcDBNum // Load DB Number
T LW [AR1,P#4.0] // Transfer to Source pointer bytes 4-5

L 212 // Load start address of data
SLD 3 // Shift data in AR1 3 bits to the left
T LD [AR1,P#6.0] // Trasfer to Source Pointer bytes 6-9

L B#16#84 // 84 hex = DB memory area
T LB [AR1,P#6.0] // Transfer to Source pointer byte 6

//Transfer StaMDB Data to Local UDT Structure
CALL SFC 20
SRCBLK :=#tInputsPointer
RET_VAL:=#tRet
DSTBLK :=#tDriveIntfc.Inputs
评论
编辑推荐: 关闭

请填写推广理由:

本版热门话题

SIMATIC S7-300/400

共有54616条技术帖

相关推荐

热门标签

相关帖子推荐

guzhang

恭喜,你发布的帖子

评为精华帖!

快扫描右侧二维码晒一晒吧!

再发帖或跟帖交流2条,就能晋升VIP啦!开启更多专属权限!

  • 分享

  • 只看
    楼主

top
您收到0封站内信:
×
×
信息提示
很抱歉!您所访问的页面不存在,或网址发生了变化,请稍后再试。