12.07.2015 Views

RAPID reference manual - Technology

RAPID reference manual - Technology

RAPID reference manual - Technology

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

InstructionPackRawBytesFile and Serial Channel HandlingPackRawBytes - Pack data into rawbytes dataPackRawBytes is used to pack the contents of variables of type num, byte or string intoa ‘container’ of type rawbytes.ExampleVAR rawbytes raw_data;VAR num integer := 8;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;Pack the header for DeviceNet explicit message with service code and path stringaccording EDS-file into raw_data.Then pack requested field bus data in raw_data with PackRawBytes.The example below shows how different data can be added.PackRawBytes integer, raw_data, (RawBytesLen(raw_data) \IntX := DINT;The contents of the next 4 bytes after the header in raw_data will be 8 decimal.PackRawBytes float, raw_data, (RawBytesLen(raw_data)+1) \Float4;The contents of the next 4 bytes in raw_data will be 13.4 decimal.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”.PackRawBytes string1, raw_data, (RawBytesLen(raw_data)+1) \ASCII;The contents of next 7 bytes in raw_data will be “abcdefg”, coded in ASCII.byte1 := StrToByte(“1F” \Hex);PackRawBytes byte1, raw_data, (RawBytesLen(raw_data)+1) \Hex1;The contents of the next byte in raw_data will be “1F”, hexadecimal.<strong>RAPID</strong> <strong>reference</strong> <strong>manual</strong> - part 1a, Instructions A-R 317

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!