21.11.2013 Views

CANgate User's Manual - dataTaker

CANgate User's Manual - dataTaker

CANgate User's Manual - dataTaker

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The floating point conversion only supports values in the range -16777216 to 16777216. Values outside this range will<br />

be returned as 99999.9.<br />

If an integer conversion type is specified, the scale and offset parameters will be converted to integers.<br />

The format strings "%X\n" and "\n" do different things. The former will output the scaled data value as a<br />

hexadecimal number; the latter will output the raw data value as it appears in the CAN message (no byte reversal,<br />

scaling, etc.)<br />

To include a literal % or \ character, enter %% or \\ respectively.<br />

Defaults<br />

To summarise the rules regarding default formatting behaviour:<br />

<br />

<br />

<br />

<br />

Examples<br />

if FORMAT is present, with a formatString, and the format string contains a conversion specifier, then the data will be<br />

formatted according to the conversion specifier. (Numeric conversion specifiers will only work if the data size is 32 bits<br />

or less, if it is longer then the data will be returned in raw hexadecimal format.)<br />

if FORMAT is present, with a formatString, and the format string does not contain a conversion specifier, then the data<br />

will be returned in raw hexadecimal form (or ASCII string form for GPS slots), followed by the format string text.<br />

if FORMAT is present, without a formatString, then a default format string will be used: "%f\n" for CAN slots, or<br />

"%s\n" for GPS.<br />

if FORMAT is not present, then a default format string will be used: "\n" for CAN slots (ie. raw hexadecimal followed<br />

by CRLF), or "%s\n" for GPS.<br />

The following examples assume that the last matching CAN message had the data: 01234567AABBCCDD.<br />

RECV 1 0x100 1 2 – returns 0123 CR LF.<br />

RECV 1 0x100 1 2 FORMAT 100 – returns 29100.00 CR LF. (0123 hex, scaled by 100)<br />

RECV 1 0x100 1 2 FORMAT ";" – returns 0123;<br />

RECV 1 0x100 1 2 FORMAT "%d %%\n" – returns 291 % CR LF. (0123 hex)<br />

RECV 1 0x100 1 2 FORMAT N "x=%d Pa\n" – returns x=8961 Pa CR LF. (2301 hex)<br />

RECV 1 0x100 1 8 FORMAT "%d\n" – returns 01234567AABBCCDD CR LF. (no conversion if > 32 bits)<br />

RECV 1 0x100 1 2 FORMAT .5 10 "%9.3f\n" – returns<br />

155.500 CR LF. (2 leading spaces)<br />

RECV 1 0x100 1 2 FORMAT .5 10 "%09.3f\n" – returns 00155.500 CR LF. (2 leading zeroes)<br />

RECV 1 0x100 1 2 FORMAT .5 10 "%-9.3f\n" – returns 155.500<br />

RECV 1 0x100 1 2 FORMAT .5 10 "%f," – returns 155.50,<br />

CR LF. (2 trailing spaces)<br />

RECV 1 0x100 4.8 4.6 FORMAT "Z\t%d" – returns Z TAB 3 (byte 4 = 67 hex, bits 8:6 = 011 binary = 3)<br />

The following assume that the last received GPS string was: $GPGLL,1244.98,S,11102.09,E<br />

GPS "GPGLL" 2 FORMAT ">%3s%.4s

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

Saved successfully!

Ooh no, something went wrong!