Details | Last modification | View Log | SVN | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 24 | johboh | 1 | #ifndef CANDEFS_H |
| 2 | #define CANDEFS_H |
||
| 3 | |||
| 4 | #include "../Include/compiler.h" |
||
| 5 | |||
| 6 | #define CAN_BAUD 0.250000 //in Mbits/s |
||
| 7 | #define CAN_LOOPBACK_MODE |
||
| 8 | |||
| 9 | |||
| 10 | // TQ(us) = (2 * (BRP + 1))/FOSC(MHz) |
||
| 11 | // Nominal Bit Rate(kbit/s) = 1 / TBIT = 1 / (TQ(us) * 8) |
||
| 12 | // Where 8 is nominal bit time. |
||
| 13 | // From this, BRP can be calculated. |
||
| 14 | // |
||
| 15 | // Nominal Bit Rate(kbit/s) = 1 / TBIT = 1 / ((2 * (BRP + 1))/FOSC(MHz) * 8) |
||
| 16 | |||
| 17 | #define CAN_BRP (int)(CLOCK_FOSC/(CAN_BAUD * 16) - 1) |
||
| 18 | |||
| 19 | |||
| 20 | #endif //CANdefs.h |