⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mscan.h

📁 freescale can bus application code using freescale mcu and codewarrior platform
💻 H
字号:
/////////////////////////////////////////////////////////////////////////////////////////
//
// Sample for Freescale EVB9S08DZ60
//
//--------------------------------------------------------------------------------------
//
// This project has been written for CodeWarrior 5.0 for HC(S)08
//
//--------------------------------------------------------------------------------------
//
// Copyright (c) 2006 SofTec Microsystems
// http://www.softecmicro.com/
//
/////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////
//
// NOTES:
//
// - The following parameters are calculated according to application note
//   AN1798.
// - Only standard identifiers are used.
//
/////////////////////////////////////////////////////////////////////////////////////////
//
// fNBT = 125000 bit/s
// CANCLK = 4000000 Hz
// tBUS = 25 ns (0.5 m * 5*10^-9 sm^-1)
// tTx = 500 ns
// tRx = 500 ns
//
// NBT = 10
// Tq = 0.75ns
// P = 3
// SYNC_SEG = 1Tq
// PROP_SEG = 3Tq
// PHASE_SEG1 = 3Tq
// PHASE_SEG2 = 3Tq
// RJW = 3
// OscToll = 1.1811%
//
/////////////////////////////////////////////////////////////////////////////////////////
#include <hidef.h>

/////////////////////////////////////////////////////////////////////////////////////////
// Defines
/////////////////////////////////////////////////////////////////////////////////////////
#define   SJW     3     // Synchronization Jump Width (value between 1 and 4 Tq) 
#define   BRP     3     // Baud Rate Prescaler (Value between 1 and 64)
#define   TSEG1   6     // Time segment one Bit Time (value between 1 and 16 Tq)
                        // TSEG1 = PROP_SEG + PHASE_SEG1  
#define   TSEG2   3     // Time segment two Bit Time (value between 1 and 8 Tq)
                        // TSEG2 = PHASE_SEG2
#define   MAX_LEN 8     // Max Data Frame

/////////////////////////////////////////////////////////////////////////////////////////
// Variables
/////////////////////////////////////////////////////////////////////////////////////////
struct can_msg 
{
    unsigned int id;
    Bool RTR;
    unsigned char data[8];
    unsigned char len;
    unsigned char prty;
};

/////////////////////////////////////////////////////////////////////////////////////////
// Functions
/////////////////////////////////////////////////////////////////////////////////////////
void MSCANInit(void);
Bool MSCANSendMsg(struct can_msg msg);
Bool MSCANGetMsg(struct can_msg *msg);
Bool MSCANCheckRcvdMsg(void);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -