Subversion Repositories HomeAutomation

Rev

Details | Last modification | View Log | SVN | RSS feed

Rev Author Line No. Line
85 johboh 1
/*********************************************************************
2
 *
86 johboh 3
 *                  CAN definitions like behavior and bus speed
85 johboh 4
 *
5
 *********************************************************************
86 johboh 6
 * FileName:        $HeadURL: https://svn.auml.se/svn/HomeAutomation/trunk/EmbeddedSoftware/PIC/canBase/Include/CANdefs.h $
7
 * Last changed:    $LastChangedDate: 2007-01-28 14:58:11 +0100 (Sun, 28 Jan 2007) $
8
 * By:              $LastChangedBy: johboh $
9
 * Revision:        $Revision: 260 $
85 johboh 10
 ********************************************************************/
11
 
86 johboh 12
 
85 johboh 13
#ifndef CANDEFS_H
14
#define CANDEFS_H
15
 
16
#include <compiler.h>
17
 
260 johboh 18
//#define CAN_BAUD 0.500000 //in Mbits/s
85 johboh 19
//#define CAN_LOOPBACK_MODE
20
 
21
 
22
// TQ(us) = (2 * (BRP + 1))/FOSC(MHz)
23
// Nominal Bit Rate(kbit/s) = 1 / TBIT = 1 / (TQ(us) * 8)
24
// Where 8 is nominal bit time.
25
// From this, BRP can be calculated.
26
//
27
// Nominal Bit Rate(kbit/s) = 1 / TBIT = 1 / ((2 * (BRP + 1))/FOSC(MHz) * 8)
28
 
29
#define CAN_BRP (int)(CLOCK_FOSC/(CAN_BAUD * 16) - 1)
30
 
31
 
32
#endif //CANdefs.h