![RoboteQ CANBus Series Скачать руководство пользователя страница 13](http://html1.mh-extra.com/html/roboteq/canbus-series/canbus-series_users-reference-manual_1471291013.webp)
CANBus Networking Manual
13
Using RawCAN Mode
Reading Raw Received Frames
After a frame has been moved to the read buffer, the header, bytecount and data can be
read with the
?CAN
query. The query can be sent from the serial/USB port, or from a Mi-
croBasic script using the getvalue(_CAN, n) function. The query usage is as follows:
When the query is sent from serial or USB, without arguments, the controller replies by
outputting all elements of the frame separated by colons.
Syntax:
?CAN [ee]
Reply:
CAN
=header:bytecount:data0:data1: .... :data7
Where:
ee
= frame element
1
= header
2
= bytecount
3 to 10
= data0 to data7
Examples:
Q:
?CAN
R:
CAN=5:4:11:12:13:14:0:0:0:0
Q:
?CAN 3
R:
CAN=11
Notes:
Read the header to detect that a new frame has arrived. If header is dif-
ferent than 0, then a new frame has arrived and you may read the data.
After reading the header, its value will be 0 if read again, unless a new
frame has arrived.
New CAN frames will not be received by the controller until a ?CAN
query is sent to read the header or any other element.
Once the header is read, proceed to read the other elements of the
received frame without delay to avoid data to be overwritten by a new
arriving frame.
Transmitting Raw Frames
RawCAN Frames can easily be assembled and transmitted using the CAN Send Com-
mand !CS. This command can be used to enter the header, bytecount, and data, one
element at a time. The frame is sent immediately after the bytecount is entered, and so it
should be entered last.
Syntax:
!CS ee nn
Where:
ee
= frame element
1
= header
2
= bytecount
3 to 10
= data0 to data7
nn
= value
Examples:
!CS 1 5
Enter 5 in header
!CS 3 2
Enter 2 in Data 0
!CS 4 3
Enter 3 in Data 1
!CS 2 2
Enter 2 in bytecount. Send CAN data frame