|
|
Line 182: |
Line 182: |
| {|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 189: |
| |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. |
| |} | | |} |
| |} | | |} |
Revision as of 15:27, 11 September 2016
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
|
|
1...8
|
=
|
driver activation and CAN-messages transmit/receive speed setting (defined by a special constant of constants directory);
|
0
|
=
|
style="padding-left:0.5em;"driver disabled.
|
|
CAN Acceptance Filter Identifier Register IDL 0
|
...
|
CAN Acceptance Filter Identifier Register IDL 15
|
|
0...65535
|
=
|
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...32767
|
=
|
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.
|
|
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; 33; 50; 83; 100; 125; 250; 500; 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
|
|
1
|
=
|
CAN driver activity is absent, the bus is idle, the data reception is not performed;
|
0
|
=
|
CAN activity registered.
|
|
|
1
|
=
|
error, CAN buffer is full;
|
0
|
=
|
no overflow of the receive buffer.
|
|
|
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...65535
|
=
|
the value of the lower part of the identifier received CAN-message.
|
|
CAN Received Data Register IDH
|
|
0...32767
|
=
|
the value of the higher part of the identifier received CAN-message.
|
|
CAN Received Data Register ERL
|
|
0...ER + 8
|
=
|
a value equal to the number of bytes of data in the received message, signs EXT and RTR (See note).
|
|
CAN Received Data Register D1:D0
|
...
|
CAN Received Data Register D7:D6
|
|
0...65535
|
=
|
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 sign & bit 14 - RTR sign. 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, EXT = 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...65535
|
=
|
the value of the lower part of the identifier transmitting CAN-message.
|
|
CAN Transmit Data Register IDH
|
|
0...32767
|
=
|
the value of the higher part of the identifier transmitting CAN-message.
|
|
CAN Transmit Data Register ERL
|
|
0...ER + 8
|
=
|
the value equal to the number of bytes of data in the transmitted message signs EXT и RTR (see note).
|
|
CAN Transmit Data Register D1:D0
|
...
|
CAN Transmit Data Register D7:D6
|
|
0...65535
|
|
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 sign & bit 14 - RTR sign. 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, EXT = 0 when receiving normal message.
|
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.
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.
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.
See also
CANNY 7
CANNY 7, LIN Driver