Using a KRC4 controller, I am trying to cast information "strings" and retrieve them using a MSG command in AB PLC. I have a previouse machine that used Motoman code using the SET command to send them across. I am trying to convert the motoman SET to the kuka language. I believe this is the correct commands in KRL needed to do this but not 100% sure. I would be sending 9 different Attributes with a 25 character max for each one. Below is not the code I have thus far, its just a example of the CAST TO and SWRITE
INT tmpInt
DECL STATE_T Stat
INT Offset
INT i
INT nHandle
; Header
INT CmdID
INT CmdLen
; Command structure
INT ARID, ErrCode, Slot, SubSlot,Index, Transaction, DataLen
; User data
INT UserData
CHAR Buffer[4096]
CHAR TmpStr[150]
;-----------------
;-- COpen (...) --
COPEN (:LD_EXT_OBJ1, nHandle)
Wait for (nHandle>0)
loop
SWRITE(TMPSTR[],STAT,Offset,"CmdId=%d CmdLen=%d TNum=%d ARID=%d Slot=%d SubSlot=%d Index=%d DataLen=%d", CmdID, CmdLen, Transaction, ARID, Slot, SubSlot, Index, DataLen)
; --- Prepare Read Response
ErrCode=4
DataLen= 4
CmdLen = DataLen + 28
UserData=4
Offset=0
CAST_TO(Buffer[],Offset,CmdID)
CAST_TO(Buffer[],Offset,CmdLen)
CAST_TO(Buffer[],Offset,Transaction)
CAST_TO(Buffer[],Offset,ARID)
; CAST_TO(Buffer[],Offset,Slot)
; CAST_TO(Buffer[],Offset,SubSlot)
; CAST_TO(Buffer[],Offset,Index)
; CAST_TO(Buffer[],Offset,DataLen)
; CAST_TO(Buffer[],Offset,UserData)
; CAST_TO(Buffer[],Offset,ErrCode)
CWrite (nHandle,Stat,WMode,"%1.40r",Buffer[])