发表于:2006/3/23 20:46:00
#0楼
谁能帮我看看,下面的s7程序是关于ASI通讯的子程序
L #OB82_MDL_ADDR //Address of the interrupting module
T "ASI Data Buffer".laddr
SET
= #t_req
loop: CALL "RD_REC" //SFC 59
REQ :=#t_req
IOID :=B#16#54 //Always
LADDR :="ASI Data Buffer".laddr
RECNUM :=B#16#1 //DS1 = diagnostic information
RET_VAL:="ASI Data Buffer".retval
BUSY :=#t_busy
RECORD :=P#DB59.DBX10.0 BYTE 11 //DS1 is saved from byte 10 onwards
CLR
= #t_req
A #t_busy
JC loop
BE
CALL "ASi Driver" //ASi_CP3422 FUNCTION
ACT :=TRUE
STARTUP:=FALSE //ACTIVATE ONCE
LADDR :=W#16#100 //CP MODULE ADDRESS - 256 IN HEX
SEND :=P#DB13.DBX4.0 BYTE 56 //SEND BUFFER
RECV :=P#DB13.DBX62.0 BYTE 56 //RECEIVE BUFFER
DONE :=M35.0 //CALL COMPLETED BIT
ERROR :=M35.1 //CALL STATUS CODE
STATUS :=MD66
L W#16#B01 //set auto-programming on
T DB13.DBW 4
CALL "ASi Driver"
ACT :=TRUE
STARTUP:=FALSE
LADDR :=W#16#100
SEND :=P#DB13.DBX4.0 BYTE 2
RECV :=P#DB13.DBX62.0 BYTE 14
DONE :=M35.0
ERROR :=M35.1
STATUS :=MD66
顺便问一下,怎样编程能使ASI总线系统中有一个模块坏了,换上未编地址的新模块系统能够给它自动编址啊
L #OB82_MDL_ADDR //Address of the interrupting module
T "ASI Data Buffer".laddr
SET
= #t_req
loop: CALL "RD_REC" //SFC 59
REQ :=#t_req
IOID :=B#16#54 //Always
LADDR :="ASI Data Buffer".laddr
RECNUM :=B#16#1 //DS1 = diagnostic information
RET_VAL:="ASI Data Buffer".retval
BUSY :=#t_busy
RECORD :=P#DB59.DBX10.0 BYTE 11 //DS1 is saved from byte 10 onwards
CLR
= #t_req
A #t_busy
JC loop
BE
CALL "ASi Driver" //ASi_CP3422 FUNCTION
ACT :=TRUE
STARTUP:=FALSE //ACTIVATE ONCE
LADDR :=W#16#100 //CP MODULE ADDRESS - 256 IN HEX
SEND :=P#DB13.DBX4.0 BYTE 56 //SEND BUFFER
RECV :=P#DB13.DBX62.0 BYTE 56 //RECEIVE BUFFER
DONE :=M35.0 //CALL COMPLETED BIT
ERROR :=M35.1 //CALL STATUS CODE
STATUS :=MD66
L W#16#B01 //set auto-programming on
T DB13.DBW 4
CALL "ASi Driver"
ACT :=TRUE
STARTUP:=FALSE
LADDR :=W#16#100
SEND :=P#DB13.DBX4.0 BYTE 2
RECV :=P#DB13.DBX62.0 BYTE 14
DONE :=M35.0
ERROR :=M35.1
STATUS :=MD66
顺便问一下,怎样编程能使ASI总线系统中有一个模块坏了,换上未编地址的新模块系统能够给它自动编址啊