如何通过CANdb++创建一个新的DBC(一)

我们测试的时候都是直接拿到别人给的DBC就使用了, 但是如果没有数据库文件,怎样创建一个DBC呢?

方法1.XLS2DBC

通常情况下,我们可以拿到通信矩阵。这时可以先整理好通信矩阵的表格格式,再通过网上提供的一些工具直接转换成DBC,此处不多讲。如果自己具备编码能力,也可以自己去写转换工具实现这个功能。

方法2. 通过CANoe的小工具CANdb++新建DBC

CANdb++在CANoe中的位置

它也支持单独打开,安装目录下Vector CANoe 10.0Exec32CANdb.exe

-----------------------分割线-------------------------

在开始讲解DBC的创建之前,先说一下基本知识点

1. Intel 和 Motorola格式

在CAN数据库中的信号可以定义为intel或motorola处理器的字节序,它用来区分消息中信号的字节排序情况。

Byte order for Motorola processors (Big Endian)

Byte order for Intel processors (Little Endian)

Bit significance (Bit Order)

Within a byte the significance of bits is the same in both formats

msb: most significant bit; lsb: least significant bit

Bit Indication

The bits of a message have following indices:

(1) Bit indexing in the byte from the right to the left

Transmitting a message with 8 byte length on the bus, bit 7 (most significant bit of byte 0) will be transmitted first, followed by bit 6. Bit 56 (least significant bit of byte 7) will be transmitted at last.

(2) Bit indexing in the byte from the left to the right – inverted or sequential bit indexing

Transmitting a message with 8 byte length on the bus, bit 0 (most significant bit of byte 0) will be transmitted first, followed by bit 1. Bit 63 (least significant bit of byte 7) will be transmitted at last.

2.对象命名规则

注意:此处的对象在第3点会描述这些对象的属性

(1) 以下对象的命名需遵循C语言标识符的命名规则

必须字母或下划线开头,之后可以包含字母/字符/下划线等.

  • Signals, multiplexor signals, multiplexed signals
  • Signal groups, multiplexor signal groups, multiplexed signal groups
  • Messages
  • Nodes/network nodes
  • Value tables
  • Environment variables

(2) 以下对象的命名不受约束

  • Controllers/ECUs
  • Vehicles
  • Networks
  • Node groups
  • Attributes
  • Value descriptions within value tables*

3.Vector工具链属性

总体分为以下5类,分别是DBC数据库中的各个对象下的一些属性,这些属性的定义了它们能用在Vector的哪些工具链中。

  • General

  general attributes, which cannot be ordered to any application domain.

  • Interaction Layer

  attributes describing the transmit and receive behavior of messages and signals.

  此处简单描述几个属于此分类下的属性

GenMsgCycleTime

Object Type:

Message

Value Type:

Int

Unit:

[ms]

Default Value:

0

Valid Values:

>= 0

Description:

Defines the fixed periodicity for cyclic message transmissions.

GenSigStartValue

Object Type:

Signal

Value Type:

Int

Unit:

 

Default Value:

0

Valid Values:

 

Description:

Defines the start or initial value of the signal.
This value is send after system start-up until the application sets the signal value the first time.
The signals start value is given as a signals raw value in this attribute.
  • Transport Protocol and Diagnostics

  attributes for the configuration and the behavior of the ISO/DIS transport protocol for CAN and the diagnostics of ECUs.

  • Network Management

  attributes for the configuration and the behavior of the OSEK network management of a CAN network.

  • Tool specific

  attributes used for the configuration of Vector tools

 -----------------------分割线-------------------------

未完待续,下篇继续多图展示一步步创建DBC

原文地址:https://www.cnblogs.com/yao-zhang/p/11648506.html