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

📄 can_handler.c

📁 基于FREESCALE单片机9S08DZ60的CAN的应用层源代码.开发环境为CODEWARRIOR FOR HC08
💻 C
字号:
/*******************************************************************************/
/*
Copyright (c) 2008 Freescale Semiconductor
\file       CAN_handler.c
\brief      CAN messages handling
\author     Freescale Semiconductor
\author     B05114
\version    0.1
\date       January/2008
*/
/*******************************************************************************/

/* MSCAN definitions */
#include "MSCAN.h"

/* Definitions and function prototypes for CAN messages handling */
#include "CAN_handler.h"

/* Error flag for CAN transmission*/
UINT8 CAN_Flag = NO_ERR;

/* Transmission buffer */
UINT8 TxBuffer[] = {0x10,0x20,0x30,0x40};

/* Reception array */
UINT8 RxData[8];    

/*******************************************************************************/
/*
* \brief    Send CAN message
* \author   B05114
* \param    void
* \return   void
*/
void Send_CAN_Msg(void)
{   
    /* Send CAN message */          
    CAN_Flag = MSCAN_SendFrame(STD_ID,0x00,sizeof(TxBuffer),TxBuffer); 
    
    if (!CAN_Flag)     LED1 ^= 1;   /* Toggle indicator */                            		                 
}		


/*******************************************************************************/
/**
* \brief    Read CAN reception buffer
* \author   B05114
* \param    void
* \return   void
*/
void Read_CAN_Buffer(void)
{
    if (RxData[0])  LED2 ^= 1;  /* Toggle indicator if message received*/          
    
    RxData[0] = 0;         
}

/*******************************************************************************/		

/*******************************************************************************/
/*                                                                             */
/* All software, source code, included documentation, and any implied know-how */
/* are property of Freescale Semiconductor and therefore considered            */ 
/* CONFIDENTIAL INFORMATION.                                                   */
/*                                                                             */
/* This confidential information is disclosed FOR DEMONSTRATION PURPOSES ONLY. */
/*                                                                             */
/* All Confidential Information remains the property of Freescale Semiconductor*/
/* and will not be copied or reproduced without the express written permission */
/* of the Discloser, except for copies that are absolutely necessary in order  */
/* to fulfill the Purpose.                                                     */
/*                                                                             */
/* Services performed by FREESCALE in this matter are performed AS IS and      */
/* without any warranty. CUSTOMER retains the final decision relative to the   */
/* total design and functionality of the end product.                          */
/*                                                                             */
/* FREESCALE neither guarantees nor will be held liable by CUSTOMER for the    */
/* success of this project.                                                    */
/*                                                                             */
/* FREESCALE disclaims all warranties, express, implied or statutory including,*/
/* but not limited to, implied warranty of merchantability or fitness for a    */
/* particular purpose on any hardware, software ore advise supplied to the     */
/* project by FREESCALE, and or any product resulting from FREESCALE services. */
/*                                                                             */
/* In no event shall FREESCALE be liable for incidental or consequential       */
/* damages arising out of this agreement. CUSTOMER agrees to hold FREESCALE    */
/* harmless against any and all claims demands or actions by anyone on account */
/* of any damage,or injury, whether commercial, contractual, or tortuous,      */
/* rising directly or indirectly as a result of the advise or assistance       */
/* supplied CUSTOMER in connectionwith product, services or goods supplied     */
/* under this Agreement.                                                       */
/*                                                                             */
/*******************************************************************************/


⌨️ 快捷键说明

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