This documentation is out of date.

The new version of the documentation is here: https://cannylogic.com/docs

Difference between revisions of "CANNY 7, CAN Driver"

From CANNY Wiki
Jump to: navigation, search
[unchecked revision][checked revision]
(Driver's registers)
(Driver's registers)
 
(9 intermediate revisions by 4 users not shown)
Line 1: Line 1:
=== General Description ===
+
== General Description ==
  
 
Two dedicated external outputs of CANNY 7 controller, located on the 4-pin connector: CAN-H and CAN-L, provided for connection to digital information '''[https://en.wikipedia.org/wiki/CAN_bus CAN-bus]'''.
 
Two dedicated external outputs of CANNY 7 controller, located on the 4-pin connector: CAN-H and CAN-L, provided for connection to digital information '''[https://en.wikipedia.org/wiki/CAN_bus CAN-bus]'''.
  
=== Driver's registers ===
+
== Driver's registers ==
  
 
Below is a description of valid values for registers controlling CAN-bus driver operation.
 
Below is a description of valid values for registers controlling CAN-bus driver operation.
Line 21: Line 21:
 
{|border="0" align="left"
 
{|border="0" align="left"
 
|- valign="top"
 
|- valign="top"
|width="70px" style="padding-left:0.5em;"|1...8
+
|width="70px" style="padding-left:0.5em;"|1...N
 
|style="padding-left:0.5em;"|=
 
|style="padding-left:0.5em;"|=
 
|style="padding-left:0.5em;"|driver activation and CAN-messages transmit/receive speed setting (defined by a special constant of constants directory);
 
|style="padding-left:0.5em;"|driver activation and CAN-messages transmit/receive speed setting (defined by a special constant of constants directory);
Line 27: Line 27:
 
|width="70px" style="padding-left:0.5em;"|0
 
|width="70px" style="padding-left:0.5em;"|0
 
|style="padding-left:0.5em;"|=
 
|style="padding-left:0.5em;"|=
|style="padding-left:0.5em;"driver disabled.
+
|style="padding-left:0.5em;"|driver disabled.
 
|}
 
|}
 
|- valign="top"
 
|- valign="top"
Line 42: Line 42:
 
{|border="0" align="left"
 
{|border="0" align="left"
 
|- valign="top"
 
|- valign="top"
|width="70px" style="padding-left:0.5em;"|0...65535
+
|width="70px" style="padding-left:0.5em;"|0...0xFFFF
 
|style="padding-left:0.5em;"|=
 
|style="padding-left:0.5em;"|=
 
|style="padding-left:0.5em;"|set filter value for lower part of CAN-message identifier(bits 0...10 identifier standard format or bits 0...15 expanded identifier format);
 
|style="padding-left:0.5em;"|set filter value for lower part of CAN-message identifier(bits 0...10 identifier standard format or bits 0...15 expanded identifier format);
Line 59: Line 59:
 
{|border="0" align="left"
 
{|border="0" align="left"
 
|- valign="top"
 
|- valign="top"
|width="70px" style="padding-left:0.5em;"|0...32767
+
|width="70px" style="padding-left:0.5em;"|0...0x1FFF
 
|style="padding-left:0.5em;"|=
 
|style="padding-left:0.5em;"|=
 
|style="padding-left:0.5em;"|set filter value for higher part of CAN-message identifier (bits 16...28 expanded identifier format);
 
|style="padding-left:0.5em;"|set filter value for higher part of CAN-message identifier (bits 16...28 expanded identifier format);
Line 72: Line 72:
 
{|border="0" align="left"
 
{|border="0" align="left"
 
|- valign="top"
 
|- valign="top"
|width="70px" style="padding-left:0.5em;"|1
+
|width="70px" style="padding-left:0.5em;"|≥ 1
 
|style="padding-left:0.5em;"|=
 
|style="padding-left:0.5em;"|=
 
|style="padding-left:0.5em;"|CAN messages passive reception mode enabled (listen only);
 
|style="padding-left:0.5em;"|CAN messages passive reception mode enabled (listen only);
Line 89: Line 89:
 
{|border="0" align="left"
 
{|border="0" align="left"
 
|- valign="top"
 
|- valign="top"
|width="70px" style="padding-left:0.5em;"|1
+
|width="70px" style="padding-left:0.5em;"|≥ 1
 
|style="padding-left:0.5em;"|=
 
|style="padding-left:0.5em;"|=
 
|style="padding-left:0.5em;"|CAN received messages filtering mode enabled;
 
|style="padding-left:0.5em;"|CAN received messages filtering mode enabled;
Line 95: Line 95:
 
|width="70px" style="padding-left:0.5em;"|0
 
|width="70px" style="padding-left:0.5em;"|0
 
|style="padding-left:0.5em;"|=
 
|style="padding-left:0.5em;"|=
|style="padding-left:0.5em;"|CAN received messages filtering mode disabled.
+
|style="padding-left:0.5em;"|CAN received messages filtering mode disabled;
 +
|}
 +
|- valign="top"
 +
|
 +
{|border="0" align="left"
 +
|- valign="top"
 +
|style="padding-left:0.5em;"|CAN Transmitting Cancel On Error Register
 +
|}
 +
|
 +
{|border="0" align="left"
 +
|- valign="top"
 +
|width="70px" style="padding-left:0.5em;"|≥ 1
 +
|style="padding-left:0.5em;"|=
 +
|style="padding-left:0.5em;"|CAN transmitting cancel on error is enabled;
 +
|- valign="top"
 +
|width="70px" style="padding-left:0.5em;"|0
 +
|style="padding-left:0.5em;"|=
 +
|style="padding-left:0.5em;"|CAN transmitting cancel on error is disabled.
 
|}
 
|}
 
|}
 
|}
Line 117: Line 134:
 
|- valign="top"
 
|- valign="top"
 
|Data transmission/reception speed, Kbit/s
 
|Data transmission/reception speed, Kbit/s
|10; 33; 50; 83; 100; 125; 250; 500; 1000
+
|10; 20; 33.3; 50; 83.3; 95.2; 100; 125; 250; 500; 800; 1000
 
|}
 
|}
  
Line 131: Line 148:
 
{|border="0" align="left"
 
{|border="0" align="left"
 
|- valign="top"
 
|- valign="top"
|style="padding-left:0.5em;"|CAN driver absence activity register
+
|style="padding-left:0.5em;"|CAN Idle Register
 
|}
 
|}
 
|valign="top"|
 
|valign="top"|
Line 165: Line 182:
 
{|border="0" align="left"
 
{|border="0" align="left"
 
|- valign="top"
 
|- valign="top"
|style="padding-left:0.5em;"|CAN Receive Error Register
+
|style="padding-left:0.5em;"|CAN Error Register
 
|}
 
|}
 
|
 
|
Line 182: Line 199:
 
{|border="0" align="left"
 
{|border="0" align="left"
 
|- valign="top"
 
|- valign="top"
|style="padding-left:0.5em;"|CAN data buffer readiness register
+
|style="padding-left:0.5em;"|CAN Ready To Send Register
 
|}
 
|}
 
|
 
|
Line 189: Line 206:
 
|width="70px" style="padding-left:0.5em;"|1
 
|width="70px" style="padding-left:0.5em;"|1
 
|style="padding-left:0.5em;"|=
 
|style="padding-left:0.5em;"|=
|style="padding-left:0.5em;"|CAN driver data buffer is empty and ready to receive new messages;
+
|style="padding-left:0.5em;"|CAN driver data transmit buffer is empty and ready to send new messages;
 
|- valign="top"
 
|- valign="top"
 
|width="70px" style="padding-left:0.5em;"|0
 
|width="70px" style="padding-left:0.5em;"|0
 
|style="padding-left:0.5em;"|=
 
|style="padding-left:0.5em;"|=
|style="padding-left:0.5em;"|CAN driver data buffer is not ready.
+
|style="padding-left:0.5em;"|CAN driver data transmit buffer is not ready.
 
|}
 
|}
 
|}
 
|}
Line 213: Line 230:
 
|width="70px" style="padding-left:0.5em;"|1
 
|width="70px" style="padding-left:0.5em;"|1
 
|style="padding-left:0.5em;"|=
 
|style="padding-left:0.5em;"|=
|style="padding-left:0.5em;"|в буфере приема драйвера CAN находится полученное сообщение, данное значение появляется в регистре на один цикл выполнения диаграммы сообщая об актуальности данных, находящихся в буфере приема;
+
|style="padding-left:0.5em;"|CAN driver receive buffer has received message, this value appears in the register for one cycle of diagram execution, stating the relevance of data stored in the receive buffer;
 
|- valign="top"
 
|- valign="top"
 
|width="70px" style="padding-left:0.5em;"|0
 
|width="70px" style="padding-left:0.5em;"|0
 
|style="padding-left:0.5em;"|=
 
|style="padding-left:0.5em;"|=
|style="padding-left:0.5em;"|в буфере приема драйвера CAN нет актуальных данных.
+
|style="padding-left:0.5em;"|there is no data in the CAN driver receive buffer.
 
|}
 
|}
 
|- valign="top"
 
|- valign="top"
Line 228: Line 245:
 
{|border="0" align="left"
 
{|border="0" align="left"
 
|- valign="top"
 
|- valign="top"
|width="70px" style="padding-left:0.5em;"|0...65535
+
|width="70px" style="padding-left:0.5em;"|0...0xFFFF
 
|style="padding-left:0.5em;"|=
 
|style="padding-left:0.5em;"|=
|style="padding-left:0.5em;"|значение младшей части идентификатора полученного CAN-сообщения.
+
|style="padding-left:0.5em;"|the value of the lower part of the identifier received CAN-message.
 
|}
 
|}
 
|- valign="top"
 
|- valign="top"
Line 241: Line 258:
 
{|border="0" align="left"
 
{|border="0" align="left"
 
|- valign="top"
 
|- valign="top"
|width="70px" style="padding-left:0.5em;"|0...32767
+
|width="70px" style="padding-left:0.5em;"|0...0x1FFF
 
|style="padding-left:0.5em;"|=
 
|style="padding-left:0.5em;"|=
|style="padding-left:0.5em;"|значение старшей части идентификатора полученного CAN-сообщения.
+
|style="padding-left:0.5em;"|the value of the higher part of the identifier received CAN-message.
 
|}
 
|}
 
|- valign="top"
 
|- valign="top"
Line 254: Line 271:
 
{|border="0" align="left"
 
{|border="0" align="left"
 
|- valign="top"
 
|- valign="top"
|width="70px" style="padding-left:0.5em;"|0...ER + 8
+
|width="70px" style="padding-left:0.5em;"|0...'''0xXX'''08
 
|style="padding-left:0.5em;"|=
 
|style="padding-left:0.5em;"|=
|style="padding-left:0.5em;"|значение, равное количеству байт данных в принятом сообщении, признаки EXT и RTR (см. примечание).
+
|style="padding-left:0.5em;"|a value equal to the number of bytes of data in the received message, where '''0хXX''' is: 0x00 (for standard format), 0x40 (for standard format with RTR), 0x80 (for extended format) or 0xC0 (for extended format with RTR). For more information, see note.
 
|}
 
|}
 
|- valign="top"
 
|- valign="top"
Line 271: Line 288:
 
{|border="0" align="left"
 
{|border="0" align="left"
 
|- valign="top"
 
|- valign="top"
|width="70px" style="padding-left:0.5em;"|0...65535
+
|width="70px" style="padding-left:0.5em;"|0...0xFFFF
 
|style="padding-left:0.5em;"|=
 
|style="padding-left:0.5em;"|=
|style="padding-left:0.5em;"|значения соответствующих байт данных принятого сообщения CAN, по два байта на регистр.
+
|style="padding-left:0.5em;"|values of the corresponding data bytes received in CAN message, two bytes per register.
 
|}
 
|}
 
|}
 
|}
  
 
{|
 
{|
|valign="top" style="padding-left:0.5em;"|''Примечание:''
+
|valign="top" style="padding-left:0.5em;"|''Note:''
|valign="top" style="padding-left:0.5em;"|''Регистр принятого сообщения CAN ERL, помимо числа байт в принятом сообщении 0...8 в младших битах, содержит в своих старших битах информацию о специальных признаках сообщения: бит 15 - признак EXT и бит 14 признак RTR.  Где EXT = 1 при приеме сообщения в расширенном формате,  EXT = 0 при стандартном формате сообщения; RTR = 1 при приеме удаленного запроса данных, EXT = 0 при приеме обычного сообщения.''
+
|valign="top" style="padding-left:0.5em;"|''CAN Received Data Register ERL, in addition to the number of bytes in the received message 0 ... 8 least significant bits, contains in its most significant bits information about special message attributes: bit 15 - EXT flag & bit 14 - RTR flagWhere EXT = 1, when receive a message in the extended format,  EXT = 0 for a standard message format; RTR = 1 when receiving remote data request, RTR = 0 when receiving normal message.''
 
|}
 
|}
  
Регистры передачи сообщений CAN используются для размещения в буфере передачи драйвера данных, подлежащих отправке.
+
CAN transmit registers are used to accommodate data in the transmission buffer to be sent.
 
{|border="1" style="border-collapse:collapse;" align="left" width="100%"
 
{|border="1" style="border-collapse:collapse;" align="left" width="100%"
 
|- align="center" valign="top"
 
|- align="center" valign="top"
!width="250px"|Адрес
+
!width="250px"|Address
!Ожидаемые значения
+
!Expected values
 
|- valign="top"
 
|- valign="top"
 
|
 
|
Line 296: Line 313:
 
{|border="0" align="left"
 
{|border="0" align="left"
 
|- valign="top"
 
|- valign="top"
|width="70px" style="padding-left:0.5em;"|1
+
|width="70px" style="padding-left:0.5em;"|≥ 1
 
|style="padding-left:0.5em;"|=
 
|style="padding-left:0.5em;"|=
|style="padding-left:0.5em;"|загрузить данные из регистров передачи в буфер передачи драйвера CAN;
+
|style="padding-left:0.5em;"|load data from the transfer registers in to CAN driver send buffer;
 
|- valign="top"
 
|- valign="top"
 
|width="70px" style="padding-left:0.5em;"|0
 
|width="70px" style="padding-left:0.5em;"|0
 
|style="padding-left:0.5em;"|=
 
|style="padding-left:0.5em;"|=
|style="padding-left:0.5em;"|не загружать данные в буфер передачи драйвера CAN.
+
|style="padding-left:0.5em;"|do not load data to CAN driver transmission buffer.
 
|}
 
|}
 
|- valign="top"
 
|- valign="top"
Line 313: Line 330:
 
{|border="0" align="left"
 
{|border="0" align="left"
 
|- valign="top"
 
|- valign="top"
|width="70px" style="padding-left:0.5em;"|0...65535
+
|width="70px" style="padding-left:0.5em;"|0...0xFFFF
 
|style="padding-left:0.5em;"|=
 
|style="padding-left:0.5em;"|=
|style="padding-left:0.5em;"|значение младшей части идентификатора передаваемого CAN-сообщения.
+
|style="padding-left:0.5em;"|the value of the lower part of the identifier transmitting CAN-message.
 
|}
 
|}
 
|- valign="top"
 
|- valign="top"
Line 326: Line 343:
 
{|border="0" align="left"
 
{|border="0" align="left"
 
|- valign="top"
 
|- valign="top"
|width="70px" style="padding-left:0.5em;"|0...32767
+
|width="70px" style="padding-left:0.5em;"|0...0x1FFF
 
|style="padding-left:0.5em;"|=
 
|style="padding-left:0.5em;"|=
|style="padding-left:0.5em;"|значение старшей части идентификатора передаваемого CAN-сообщения.
+
|style="padding-left:0.5em;"|the value of the higher part of the identifier transmitting CAN-message.
 
|}
 
|}
 
|- valign="top"
 
|- valign="top"
Line 339: Line 356:
 
{|border="0" align="left"
 
{|border="0" align="left"
 
|- valign="top"
 
|- valign="top"
|width="70px" style="padding-left:0.5em;"|0...ER + 8
+
|width="70px" style="padding-left:0.5em;"|0...'''0xXX'''08
 
|style="padding-left:0.5em;"|=
 
|style="padding-left:0.5em;"|=
|style="padding-left:0.5em;"|значение, равное количеству байт данных в передаваемом сообщении, признаки EXT и RTR (см. примечание).
+
|style="padding-left:0.5em;"|the value equal to the number of bytes of data in the transmitted message, where '''0хXX''' is: 0x00 (for standard format), 0x40 (for standard format with RTR), 0x80 (for extended format) or 0xC0 (for extended format with RTR). For more information, see note.
 
|}
 
|}
 
|- valign="top"
 
|- valign="top"
Line 356: Line 373:
 
{|border="0" align="left"
 
{|border="0" align="left"
 
|- valign="top"
 
|- valign="top"
|width="70px" style="padding-left:0.5em;"|0...65535
+
|width="70px" style="padding-left:0.5em;"|0...0xFFFF
|style="padding-left:0.5em;"|=
+
|style="padding-left:0.5em;"|
|style="padding-left:0.5em;"|значения соответствующих байт данных передаваемого сообщения CAN, по два байта на регистр.
+
|style="padding-left:0.5em;"|values of the corresponding data byte of transmitting CAN message, two bytes per register.
 
|}
 
|}
 
|}
 
|}
  
 
{|
 
{|
|valign="top" style="padding-left:0.5em;"|''Примечание:''
+
|valign="top" style="padding-left:0.5em;"|''Note:''
|valign="top" style="padding-left:0.5em;"|''Регистр сообщения передачи CAN ERL, помимо числа байт в передаваемом сообщении 0...8 в младших битах, содержит в своих старших битах информацию о специальных признаках сообщения: бит 15 - признак EXT и бит 14 признак RTR. Где EXT = 1 при передаче сообщения в расширенном формате,  EXT = 0 при стандартном формате сообщения; RTR = 1 при передаче удаленного запроса данных, EXT = 0 при передаче обычного сообщения.''
+
|valign="top" style="padding-left:0.5em;"|''CAN Transmit Data Register ERL, in addition to the number of bytes in the transmitting message 0 ... 8 least significant bits, contains in its most significant bits information about special message attributes: bit 15 - EXT flag & bit 14 - RTR flag. Where EXT = 1, when transmitting a message in the extended format,  EXT = 0 for a standard message format; RTR = 1 when transmitting remote data request, RTR = 0 when receiving normal message.''
 
|}
 
|}
  
Пример функциональной диаграммы отправки данных в шину CAN. Выполняя диаграмму контроллер, с периодичностью 1 раз в 100мс, передает в шину на скорости 125 кБод данные о состоянии трех своих входов, используя сообщения стандартного формата с идентификатором 0x123, содержащие один байт данных.
+
== Examples of message transmitting ==
 +
 
 +
An example of a functional diagram of the data sent to the CAN bus. Performing diagram the controller once every 100 ms, transmits to the bus at a speed of 125 kbps, the data about the state of its three inputs, using a standard format message with the identifier 0x123, contains a single byte of data.
  
 
[[File:6_9_2_1.png]]
 
[[File:6_9_2_1.png]]
  
Пример функциональной диаграммы приема данных из шины CAN. Выполняя диаграмму контроллер, получая по шине сообщения стандартного формата с идентификатором 0x0123, содержащие один байт данных, устанавливает на трех своих выходах состояние в соответствии с полученным значением.
+
An example of a functional diagram for sending a CAN message with a standard identifier is '''0x001: 0xDE 0xAD 0xBE 0xEF 0x12 0x34 0x56 0x78''' by the appearance of a signal on the channel #8 of the controller.
 +
 
 +
[[File:6_9_2_4.png|500px]]
 +
 
 +
An example of a functional diagram for sending a CAN message with the extended identifier is "0x1f110001: 0xDE 0xAD 0xBE 0xEF 0x12 0x34 0x56 0x78" by the appearance of a signal on the channel #8 of the controller.
 +
 +
Differences in sending an extended message from sending a standard one: set bit 15 of the register '''[CAN Transmit Data Register ERL]''', the leading part of the identifier should be written to the register '''[CAN Transmit Data Register IDH]'''.
 +
 
 +
[[File:6_9_2_5.png|500px]]
 +
 
 +
Example of a functional diagram for sending a CAN message with the standard identifier "0x001: 0xDE 0xAD 0xBE 0xEF 0x12 0x34 0x56 0x78" by the appearance of a signal on the channel #8 of the controller, and sending a message with the same ID, but with zero data when the signal on the channel #8 of the controller is disappears.
 +
 
 +
[[File:6_9_2_6.png|700px]]
 +
 
 +
An example of sending several CAN messages periodically.
 +
 
 +
[[File:6_9_2_7.png|800px]]
 +
 
 +
== Examples of message reciving ==
 +
 
 +
An example of a functional diagram of the data receive from the CAN bus. Performing the diagram controller, receiving message from the bus in standard format with ID 0x0123, containing one byte of data, sets on three of its outputs, states in accordance with received value.
  
 
[[File:6_9_2_2.png]]
 
[[File:6_9_2_2.png]]
  
Пример функциональной диаграммы приема данных из шины CAN. Выполняя диаграмму контроллер, получая по шине сообщения стандартного формата с идентификатором 0x01F3, анализирует содержащееся в одном из байтов сообщения значение и устанавливает на своих выходах и встроенном светодиоде соответствующие состояния.  
+
An example of a functional diagram of the data receive from the CAN bus. Performing the diagram controller, receiving message on the bus in standard format with an ID 0x01F3, analyzes contained in one of the  message bytes a value and sets on its outputs and built-in LED corresponding states.  
  
 
[[File:6_9_2_3.png]]
 
[[File:6_9_2_3.png]]

Latest revision as of 16:50, 27 August 2019

General Description

Two dedicated external outputs of CANNY 7 controller, located on the 4-pin connector: CAN-H and CAN-L, provided for connection to digital information CAN-bus.

Driver's registers

Below is a description of valid values for registers controlling CAN-bus driver operation.

CAN driver configuration registers allows to set the parameters of the controller as a CAN bus node:

Address Expected values
CAN Mode Setup Register
1...N = driver activation and CAN-messages transmit/receive speed setting (defined by a special constant of constants directory);
0 = driver disabled.
CAN Acceptance Filter Identifier Register IDL 0
...
CAN Acceptance Filter Identifier Register IDL 15
0...0xFFFF = set filter value for lower part of CAN-message identifier(bits 0...10 identifier standard format or bits 0...15 expanded identifier format);
CAN Acceptance Filter Identifier Register IDH 0
...
CAN Acceptance Filter Identifier Register IDH 15
0...0x1FFF = set filter value for higher part of CAN-message identifier (bits 16...28 expanded identifier format);
CAN Listen Only Mode Enable Register
≥ 1 = CAN messages passive reception mode enabled (listen only);
0 = CAN messages reception and transmission mode enabled (normal);
CAN Acceptance Filter Enable Register
≥ 1 = CAN received messages filtering mode enabled;
0 = CAN received messages filtering mode disabled;
CAN Transmitting Cancel On Error Register
≥ 1 = CAN transmitting cancel on error is enabled;
0 = CAN transmitting cancel on error is disabled.
Note: In passive receiving CAN messages mode (listen only), unlike normal CAN mode, the driver operates to receive data from CAN-bus, but does not send a confirmation of reception and does not puts network in an error state when it detects such. Thus, the controller remains invisible to the other devices on the bus, does not prove itself. For normal network operation, there must be present at least two devices operating in the normal mode.
Note: When filter mode enabled the CAN driver will accept only those messages whose identifiers match values in CAN message receive filter installation registers, ignoring all others.

CAN driver configuration is defined by a constant predetermined data transmission/reception speed.

Parameter A list of acceptable values
Data transmission/reception speed, Kbit/s 10; 20; 33.3; 50; 83.3; 95.2; 100; 125; 250; 500; 800; 1000

Named constants that represent CAN configuration parameters combination, available to the user in the "CAN Modes" CannyLab constants directory, which can be accessed via function block entry context menu having "constant" type.

CAN driver diagnostics registers allows the user to determine the status of the driver in one or another moment of a diagram execution.

Address Returning Values
CAN Idle Register
1 = CAN driver activity is absent, the bus is idle, the data reception is not performed;
0 = CAN activity registered.
CAN Overflow Register
1 = error, CAN buffer is full;
0 = no overflow of the receive buffer.
CAN Error Register
1 = CAN reception error rate exceeds a threshold;
0 = CAN reception error rate below an acceptable threshold.
CAN Ready To Send Register
1 = CAN driver data transmit buffer is empty and ready to send new messages;
0 = CAN driver data transmit buffer is not ready.

CAN driver receiving registers allows access to the values obtained on the bus.

Address Return values
CAN Data Set Ready Register
1 = CAN driver receive buffer has received message, this value appears in the register for one cycle of diagram execution, stating the relevance of data stored in the receive buffer;
0 = there is no data in the CAN driver receive buffer.
CAN Received Data Register IDL
0...0xFFFF = the value of the lower part of the identifier received CAN-message.
CAN Received Data Register IDH
0...0x1FFF = the value of the higher part of the identifier received CAN-message.
CAN Received Data Register ERL
0...0xXX08 = a value equal to the number of bytes of data in the received message, where 0хXX is: 0x00 (for standard format), 0x40 (for standard format with RTR), 0x80 (for extended format) or 0xC0 (for extended format with RTR). For more information, see note.
CAN Received Data Register D1:D0
...
CAN Received Data Register D7:D6
0...0xFFFF = values of the corresponding data bytes received in CAN message, two bytes per register.
Note: CAN Received Data Register ERL, in addition to the number of bytes in the received message 0 ... 8 least significant bits, contains in its most significant bits information about special message attributes: bit 15 - EXT flag & bit 14 - RTR flag. Where EXT = 1, when receive a message in the extended format, EXT = 0 for a standard message format; RTR = 1 when receiving remote data request, RTR = 0 when receiving normal message.

CAN transmit registers are used to accommodate data in the transmission buffer to be sent.

Address Expected values
CAN Request To Send Register
≥ 1 = load data from the transfer registers in to CAN driver send buffer;
0 = do not load data to CAN driver transmission buffer.
CAN Transmit Data Register IDL
0...0xFFFF = the value of the lower part of the identifier transmitting CAN-message.
CAN Transmit Data Register IDH
0...0x1FFF = the value of the higher part of the identifier transmitting CAN-message.
CAN Transmit Data Register ERL
0...0xXX08 = the value equal to the number of bytes of data in the transmitted message, where 0хXX is: 0x00 (for standard format), 0x40 (for standard format with RTR), 0x80 (for extended format) or 0xC0 (for extended format with RTR). For more information, see note.
CAN Transmit Data Register D1:D0
...
CAN Transmit Data Register D7:D6
0...0xFFFF values of the corresponding data byte of transmitting CAN message, two bytes per register.
Note: CAN Transmit Data Register ERL, in addition to the number of bytes in the transmitting message 0 ... 8 least significant bits, contains in its most significant bits information about special message attributes: bit 15 - EXT flag & bit 14 - RTR flag. Where EXT = 1, when transmitting a message in the extended format, EXT = 0 for a standard message format; RTR = 1 when transmitting remote data request, RTR = 0 when receiving normal message.

Examples of message transmitting

An example of a functional diagram of the data sent to the CAN bus. Performing diagram the controller once every 100 ms, transmits to the bus at a speed of 125 kbps, the data about the state of its three inputs, using a standard format message with the identifier 0x123, contains a single byte of data.

6 9 2 1.png

An example of a functional diagram for sending a CAN message with a standard identifier is 0x001: 0xDE 0xAD 0xBE 0xEF 0x12 0x34 0x56 0x78 by the appearance of a signal on the channel #8 of the controller.

6 9 2 4.png

An example of a functional diagram for sending a CAN message with the extended identifier is "0x1f110001: 0xDE 0xAD 0xBE 0xEF 0x12 0x34 0x56 0x78" by the appearance of a signal on the channel #8 of the controller.

Differences in sending an extended message from sending a standard one: set bit 15 of the register [CAN Transmit Data Register ERL], the leading part of the identifier should be written to the register [CAN Transmit Data Register IDH].

6 9 2 5.png

Example of a functional diagram for sending a CAN message with the standard identifier "0x001: 0xDE 0xAD 0xBE 0xEF 0x12 0x34 0x56 0x78" by the appearance of a signal on the channel #8 of the controller, and sending a message with the same ID, but with zero data when the signal on the channel #8 of the controller is disappears.

6 9 2 6.png

An example of sending several CAN messages periodically.

6 9 2 7.png

Examples of message reciving

An example of a functional diagram of the data receive from the CAN bus. Performing the diagram controller, receiving message from the bus in standard format with ID 0x0123, containing one byte of data, sets on three of its outputs, states in accordance with received value.

6 9 2 2.png

An example of a functional diagram of the data receive from the CAN bus. Performing the diagram controller, receiving message on the bus in standard format with an ID 0x01F3, analyzes contained in one of the message bytes a value and sets on its outputs and built-in LED corresponding states.

6 9 2 3.png

See also

CANNY 7

CANNY 7, LIN Driver