Rev 88 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 88 | Rev 339 | ||
|---|---|---|---|
| Line 2... | Line 2... | ||
| 2 | * |
2 | * |
| 3 | * CAN specification |
3 | * CAN specification |
| 4 | * |
4 | * |
| 5 | ********************************************************************* |
5 | ********************************************************************* |
| 6 | * FileName: $HeadURL: https://svn.auml.se/svn/HomeAutomation/trunk/EmbeddedSoftware/PIC/canBoot/Include/CANdefs.h $ |
6 | * FileName: $HeadURL: https://svn.auml.se/svn/HomeAutomation/trunk/EmbeddedSoftware/PIC/canBoot/Include/CANdefs.h $ |
| 7 | * Last changed: $LastChangedDate: |
7 | * Last changed: $LastChangedDate: 2007-02-25 20:51:08 +0100 (Sun, 25 Feb 2007) $ |
| 8 | * By: $LastChangedBy: johboh $ |
8 | * By: $LastChangedBy: johboh $ |
| 9 | * Revision: $Revision: |
9 | * Revision: $Revision: 339 $ |
| 10 | ********************************************************************/ |
10 | ********************************************************************/ |
| 11 | 11 | ||
| 12 | #ifndef CANDEFS_H |
12 | #ifndef CANDEFS_H |
| 13 | #define CANDEFS_H |
13 | #define CANDEFS_H |
| 14 | 14 | ||
| 15 | #include <compiler.h> |
15 | #include <compiler.h> |
| 16 | - | ||
| 17 | #define CAN_BAUD 0.500000 //in Mbits/s |
- | |
| 18 | //#define CAN_LOOPBACK_MODE |
- | |
| 19 | - | ||
| 20 | - | ||
| 21 | // TQ(us) = (2 * (BRP + 1))/FOSC(MHz) |
- | |
| 22 | // Nominal Bit Rate(kbit/s) = 1 / TBIT = 1 / (TQ(us) * 8) |
- | |
| 23 | // Where 8 is nominal bit time. |
- | |
| 24 | // From this, BRP can be calculated. |
- | |
| 25 | // |
- | |
| 26 | // Nominal Bit Rate(kbit/s) = 1 / TBIT = 1 / ((2 * (BRP + 1))/FOSC(MHz) * 8) |
- | |
| 27 | - | ||
| 28 | #define CAN_BRP (int)(CLOCK_FOSC/(CAN_BAUD * 16) - 1) |
- | |
| 29 | 16 | ||
| 30 | 17 | ||
| 31 | #endif //CANdefs.h |
18 | #endif //CANdefs.h |