Avisaro Online Documentation - Wiki
Impressum Kontakt Sitemap

CANCSV$

Description

The CANCSV$ pseudo variable exists to view the last received CAN frame as comma-separated string. Such CSV strings provide a convenient way for logging CAN messages in the human-readable and exchangeable CSV format. CANCSV$ uses the last received CAN frame as input. Therefore, accessingCANCSV$ without a previous successfull call to GETCAN should be avoided. Internally, CANCSV$ generates CSV strings of variable length, depening on the number of data bytes. A CANCSV$ generated string is build up like this:

1. Millisecond timestamp.

2. Frame type: 11 for standard, 29 for extended

3. Message ID

4. RTR bit, 0 or 1

5. Number of data bytes, 0 to 8.

6. Zero or up to eight data bytes, only the commas for missing bytes

Thus, CSV strings generated by CANCSV$ always have 12 commas. An example might look like this:

144661,29,123,0,5,11,22,33,44,55,,,

144661 is the millisecond timestamp.
It's an extended frame.
The Message ID is 123.
There's no RTR bit.
There are 5 data bytes.
The data bytes are 11, 22, 33, 44 and 55.

Example

This little example reads all received CAN frames and prints them out as CSV strings:

dim a(28)
do
   getcan a
   if LASTERR = 0 then
      let c$ = CANCSV$
      print c$
   end if
loop

Remarks

Please see also the CSV$ and PUTCAN/GETCAN pages.