beautypg.com

1 can bus, 1 overview, 2 can message format – Acrosser AR-B6051 User Manual

Page 43: 1 can bus 6.1.1 overview

background image

Chapter 6 Software Installation and

Programming Guide

6.1 CAN bus

6.1.1 Overview

The CAN bus APIs provide interfaces to CAN bus subsystem. By invoking these APIs, programmers

can implement the applications which have the functions listed below:

1.

Set the BAUD rate.

2.

Send the CAN packages over the CAN bus.

3.

Receive the CAN packages via the CAN bus hardware interface.

4.

Set the CAN package filter to selectively receive CAN packages with specific ID.

5.

Set the mask bits to selectively make some filter bits take effect.

In folder ‘ARB6051\Utility\Source’ on the CD, we provides:

1.

API header file.

2.

API library in static library format and shared library format.

3.

Test utility and its source code.

6.1.2 CAN Message Format

// TYPE DEFINITION

typedef char i8;

typedef unsigned char u8;

typedef short i16;

typedef unsigned short u16;

typedef unsigned long u32;

typedef int i32;

struct CanMsg {

u32 id;

u8 id_type;

u8 length;

u8 data[8];

43