ABB 机器人 压包指令PackRawBytes 解包指令UnpackRawBytes

ABB  压包指 PackRawBytes   解包指令 UnpackRawBytes   

   PackRawBytes- 将数据导入 rawbytes 数据。
    使用方法
    PackRawBytes 用于将 num, dnum, byte,或者 string类型的数据,打包到  rawbytes 类型的变量中.
     基本举例  :


        VAR rawbytes raw_data;
        VAR num integer := 8;
        VAR dnum bigInt := 4294967295;
        VAR num float := 13.4;
        VAR byte data1 := 122;
        VAR byte byte1;
        VAR string string1:="abcdefg";
        PackDNHeader "10", "20 1D 24 01 30 64", raw_data;

       将 DeviceNet 头文件 打包到  raw_data.
       然后通过  PackRawBytes  打包要求的现场总线数据到 raw_data 中 。下面的例子展示了不同的数据如何被添加。
       Example 1
              PackRawBytes     integer,     raw_data,     (RawBytesLen(raw_data)+1)   \IntX :=DINT;
       在 raw_data 中,头文件之后的下四个字节将是 8.
      Example 2
             PackRawBytes bigInt, raw_data, (RawBytesLen(raw_data)+1) \IntX :=
UDINT;
The contents of the next 4 bytes after the header in raw_data will be 4294967295
decimal.
Example 3
PackRawBytes bigInt, raw_data, (RawBytesLen(raw_data)+1) \IntX :=
LINT;
The contents of the next 8 bytes after the header in raw_data will be 4294967295
decimal.
Example 4
PackRawBytes float, raw_data, RawBytesLen(raw_data)+1) \Float4;
The contents of the next 4 bytes in raw_data will be 13.4 decimal.
Example 5
PackRawBytes data1, raw_data, (RawBytesLen(raw_data)+1) \ASCII;
The contents of the next byte in raw_data will be 122, the ASCII code for "z".
Example 6
PackRawBytes string1, raw_data, (RawBytesLen(raw_data)+1) \ASCII;
The contents of next 7 bytes in raw_data will be "abcdefg", coded in ASCII.
Example 7
byte1 := StrToByte("1F" \Hex);


  • 2
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值