This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| en:hardware:avr-can:can-functions [2010/04/05 12:57] – created mikk.leini | en:hardware:avr-can:can-functions [2020/07/20 12:00] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== CAN-Functions ====== | ||
| + | ====The can_t Structure==== | ||
| + | |||
| + | CAN communication between the used CAN boards is (on the programming | ||
| + | level) accessed through the use of a structure named can_t which is defined in | ||
| + | " | ||
| + | message for sending or read to process a received message. Here is an overview | ||
| + | of the variables of this structure: | ||
| + | |||
| + | <code c> | ||
| + | Structure | ||
| + | |||
| + | uint32_t | ||
| + | |||
| + | struct flags | ||
| + | int rtr: // remote-transmit-request-frame | ||
| + | int extended: // extended | ||
| + | |||
| + | uint8_t length: // number | ||
| + | uint8_t data[8]: // message | ||
| + | </ | ||
| + | |||
| + | ====Functions for CAN Communication==== | ||
| + | |||
| + | The header file " | ||
| + | cation. The CAN library is open source. The following functions are sufficient | ||
| + | for basic communication: | ||
| + | |||
| + | **Initialization of the CAN interface, setting of the baud rate:** | ||
| + | <code c> | ||
| + | extern | ||
| + | |||
| + | // Check if a CAN message | ||
| + | |||
| + | extern | ||
| + | |||
| + | // Retrieving | ||
| + | |||
| + | extern | ||
| + | |||
| + | // Sending | ||
| + | |||
| + | extern | ||
| + | </ | ||