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

📄 linsci.h

📁 基于摩托罗拉(现在飞思卡尔)系列MC68HC908单片机开发车辆ECU系统!
💻 H
字号:
#ifndef LINSCI_H
#define LINSCI_H

/******************************************************************************
*
*       Copyright (C) 2003 Motorola, Inc.
*       All Rights Reserved
*
* Filename:     $RCSfile: linsci.h,v $
* Author:       $Author: ttz778 $
* Locker:       $Locker:  $
* State:        $State: Exp $
* Revision:     $Revision: 1.0 $
*
* Functions:    SCI routins header file
*
* History:      Use the RCS command log to display revision history
*               information.
*
* Description:  
*
* Notes:        
*
******************************************************************************/

/****************************************************************************
 * All extern declarations of common-purpose RAM variables shall be here.
 ***************************************************************************/
/****************************************************************************
 * Some of the variables (more often used) can be declared using LIN_ZPAGE
 * modifier
 * It require to perform zero page RAM placement optimisation.
 ***************************************************************************/
#if defined(CW08)
#pragma DATA_SEG SHORT ZeroSeg
#endif /* defined(CW08) */

extern LIN_ZPAGE LIN_BYTE LIN_TmpSCIStatus;     /* byte to clear SCI status, and to receive byte   */

#if defined(CW08) 
#pragma DATA_SEG DEFAULT
#endif /* defined(CW08) */

/****************************************************************************/
/***                     Functions                                        ***/
/****************************************************************************/

#if !defined(LINAPI_1_0)
void LIN_SCIInit( void );
#endif /* !defined(LINAPI_1_0) */

/****************************************************************************/
/***                     Interrupt Driven routins                         ***/
/****************************************************************************/

#if !defined(LINAPI_1_0)

LIN_INTERRUPT LIN_ISR_SCI_Receive  ( void ); /* SCI receive interrupt */
#if defined(MASTER)
LIN_INTERRUPT LIN_ISR_SCI_Transmit ( void ); /* SCI transmit interrupt */
#endif /* defined(MASTER) */
LIN_INTERRUPT LIN_ISR_SCI_Error    ( void ); /* SCI error interrupt */

#endif /* !defined(LINAPI_1_0) */

/****************************************************************************/
/***                     Macros                                           ***/
/****************************************************************************/

#define    LIN_SCDRPut(data)     ( LIN_SCDR = (data) )

/* Tx pin inversion */
#define LIN_SCITxInvEnable()    ( LIN_SCC1 |= LIN_SCC1_TXINV )

/* Cancel Tx pin inversion */
#define LIN_SCITxInvDisable()   ( LIN_SCC1 &= ~LIN_SCC1_TXINV )


/**************************************************************************
 * Function :   LIN_SCISendWakeup
 *
 * Description: Send Wakeup message
 *
 * Returns:     none
 *
 * Notes:       Master -- SCI Tx Completed interrupt enabled and used
 *              Slave  -- SCI Rx interrupt used
 *
 **************************************************************************/
#define WAKEUP_BYTE             0x80

/* ------------------------------------------------------------- HC08AZ32 */
#if defined(MASTER)
#define LIN_SCISendWakeup()                                                                     \
        LIN_TmpSCIStatus = LIN_SCS1;            /* Read SCI status register to clear it */      \
        LIN_SCDRPut(WAKEUP_BYTE);               /* Send wakeup frame */                         \
        LIN_SCC2 |= LIN_SCC2_TCIE               /* Enable SCI Tx completed interrupt */
#endif /* defined(MASTER) */

#if defined(SLAVE)
#define LIN_SCISendWakeup()                                                                     \
        LIN_TmpSCIStatus = LIN_SCS1;            /* Read SCI status register to clear it */      \
        LIN_SCDRPut(WAKEUP_BYTE)                /* Send wakeup frame */  
#endif /* defined(SLAVE) */


#endif /* !define (LINSCI_H) */

⌨️ 快捷键说明

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