can.h

Go to the documentation of this file.
00001 #include "t89c51cc02.h"
00002 #include "datatypes.h"
00004 /* baud rate 500kbit/s and bit timing parameters at Fosc=16Mhz */
00005 /* refer to Xcalculator software on Atmel website for other bit timing */
00006 
00007 /* defaults waren 5 0 1 3 2 */
00008 
00009 #define BRP_500k    0x00
00010 #define SJW_500k    0x00
00011 #define PRS_500k    0x00
00012 #define PHS2_500k   0x07
00013 #define PHS1_500k   0x05
00014 
00015 #define BRP_250k    0x01
00016 #define PRS_250k    0x00
00017 #define PHS1_250k   0x05
00018 #define PHS2_250k   0x07
00019 #define SJW_250k    0x00
00020 
00021 #define MSK_CANGCON_ENA         0x02
00022 #define MSK_CANGCON_GRES        0x01
00023 
00024 #define DLC_MAX            8
00025 #define CH_DISABLE         0x00
00026 #define CH_RxENA           0x80
00027 #define CH_TxENA           0x40
00028 #define MSK_CANGIE_ENRX    0x20
00029 #define MSK_CANGIE_ENTX    0x10
00030 
00032 #define CAN_ACK                 0x06
00033 
00034 #define CAN_NAK                 0x15
00035 
00037 #define CAN_RECVID              0x400
00038 
00039 #define CAN_SENDID              0x401
00040 
00042 #define CAN_setchannel(ch) CANPAGE = (ch << 4)
00043 
00044 #define CAN_enablechannel(ch) CANEN |= (1 << ch)
00045 
00046 void CAN_init(void);
00047 void CAN_interrupt(void) interrupt 7 using 1;
00048 void CAN_SendACK(BYTE);
00049 void CAN_SendMsg(BYTE);
00050 void CAN_SendNAK(BYTE);
00051 
00052 /* allow foreign access to can data array */
00053 extern volatile BYTE idata can_data[8];

Generated on Wed Oct 24 12:57:24 2007 for SensorControl by  doxygen 1.4.6