Avisaro Online Documentation - Wiki
Impressum Kontakt Sitemap

CANINFO

Description

The CANINFO function is a convenient function to extract information from the most recent GETCAN call. After GETCAN put a CAN message into an array, CANINFO can be called to read parts of that array, which would otherwise be a hard job. CANINFO needs a single numeric argument that tells him what to do. Here is a list of all CANINFO arguments:

1 Get the Message ID. CANINFO will give the message ID.

2 Get the frame type. CANINFO returns 0 for standard and 1 for extended frames.

3 Get the RTR bit. CANINFO returns 1 if the RTR bit is set, otherwise 0.

4 Get the number of data bytes. CANINFO will return a number beween 0 and 8 inclusive.

5 Get the RTC second timestamp. CANINFO will give the value of the RTC field.

6 Get the millisecond timestamp. CANINFO will return the value of the millisecond timestamp field.

7 Get the arbitrary header value. CANINFO will then return what's stored in the header field.

Example

This example never-ending scans the CAN bus and prints all IDs of incoming messages:

dim a(28)
do
   getcan a
   if LASTERR = 0 then
      print "message received from: ";
      print caninfo(1)
   end if
loop

Remarks

Never call CANINFO before a frame was read in with GETCAN. Doing so can cause unpredictable behaviour. See also the GETCAN page.