OS:CAPL里IP和MAC赋值都可用以下这种方式直接写。
The specification of IPv4 addresses as DWORD corresponds to a Little Endian representation.
作为DWORD的IPv4地址规范对应于Little Endian表示。
You must represent an address a.b.c.d as number 0x0d0c0b0a.
您必须将地址a.b.c.d表示为数字0x0d0c0b0a。
Example The number representation of 192.168.2.1 corresponds to 0x0102a8c0.
Note If no quantity is specified in the formatting in CAPL function Write, the leading zero is ignored resulting in 0x201A8C0. Take this into account when back-calculating to the hex character count in order to avoid false pairing. 如果在CAPL Write函数的格式化中没有指定数量,则忽略前导零,结果为0x201A8C0。在反向计算十六进制字符计数时要考虑到这一点,以避免错误配对。
The formatting for an 8-digit hexadecimal representation in Write corresponds to: %.8x or 0x%.8x. Write中8位十六进制表示的格式对应于:%.8x或0x%.8x.
|
Alternatively you can use CAPL function SwapDWord to enable writing an IPv4 address in readable form.
或者,您可以使用CAPL函数SwapDWord来启用以可读形式写入IPv4地址。
dword addr = SwapDWord(0xc0a80102);
Byte arrays that are filled in readable order are used for IPv6 addresses.
以可读顺序填充的字节数组用于IPv6地址。
Example Representation of the IPv6 address 2001:DB8:85A3:8D3:1319:8A2E:370:7344 in the form of a byte array: { 0x20, 0x01, 0x0d, 0xb8, 0x85, 0xa3, 0x08, 0xd3, 0x13, 0x19, 0x8a, 0x2e, 0x03, 0x70, 0x73, 0x44 } |