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

📄 can1.h

📁 基于摩托罗拉16位单片机MC9612HZ256的CAN(control area network)驱动部分源代码
💻 H
📖 第 1 页 / 共 2 页
字号:
**                           will be written to the IDAR4 register
**                           and the least significant byte of the
**                           acceptance code will be written to the
**                           IDAR7 register.
**     Returns     :
**         ---             - Error code, possible codes:
**                           ERR_OK - OK
**                           ERR_SPEED - This device does not work in
**                           the active speed mode
**                           ERR_DISABLED - This bean is disabled by
**                           user
** ===================================================================
*/

byte CAN1_GetError(CAN1_TError *Err);
/*
** ===================================================================
**     Method      :  CAN1_GetError (bean FreescaleCAN)
**
**     Description :
**         Returns the content of the receiver flag register.
**     Parameters  :
**         NAME            - DESCRIPTION
**       * Err             - Pointer to the returned set of errors
**     Returns     :
**         ---             - Error code (if GetError did not succeed),
**                           possible codes:
**                           ERR_OK - OK
**                           ERR_SPEED - This device does not work in
**                           the active speed mode
** ===================================================================
*/

byte CAN1_SendFrame(byte BufferNum,dword MessageID,byte FrameType,byte Length,byte *Data);
/*
** ===================================================================
**     Method      :  CAN1_SendFrame (bean FreescaleCAN)
**
**     Description :
**         Sends the frame via the CAN device. Using this method the
**         user can send own message to the CAN bus. This method
**         allows to specify CAN buffer number, message ID, data to
**         be sent and frame type (DATA_FRAME/REMOTE_FRAME).
**     Parameters  :
**         NAME            - DESCRIPTION
**         BufferNum       - Number of the buffer.
**         MessageID       - Identification of the
**                           message - ID. Message ID can be
**                           specified in the STANDARD format
**                           (default) or the EXTENDED format. The
**                           most significant bit in the ID is set to
**                           specify EXTENDED format. Predefined
**                           macro CAN_EXTENDED_FRAME_ID can be used
**                           (ID "bitwise or" CAN_EXTENDED_FRAME_ID)
**                           to mark ID as extended. If the most
**                           significant bit of ID is clear, STANDARD
**                           format is used.
**         FrameType       - Type of frame
**                           DATA_FRAME - data frame
**                           REMOTE_FRAME - remote frame
**         Length          - The length of the frame in bytes
**                           (0..8)
**       * Data            - Pointer to data
**     Returns     :
**         ---             - Error code, possible codes:
**                           ERR_OK - OK
**                           ERR_SPEED - This device does not work in
**                           the active speed mode
**                           ERR_DISABLED - This bean is disabled by
**                           user
**                           ERR_VALUE - Some parameter is out of
**                           possible range
**                           ERR_TXFULL - Transmition buffer is full.
** ===================================================================
*/

byte CAN1_ReadFrame(dword *MessageID, byte *FrameType, byte *FrameFormat, byte *Length, byte *Data);
/*
** ===================================================================
**     Method      :  CAN1_ReadFrame (bean FreescaleCAN)
**
**     Description :
**         Reads a frame from the CAN device. The user is informed
**         about CAN reception through OnFullRxBuffer event or
**         GetStateRX method.
**     Parameters  :
**         NAME            - DESCRIPTION
**       * MessageID       - Pointer to a message
**                           indentification
**       * FrameType       - Pointer to a frame type
**                           DATA_FRAME - data frame
**                           REMOTE_FRAME - remote frame
**       * FrameFormat     - Pointer to a frame
**                           format
**                           STANDARD_FORMAT - standard frame 11-bits
**                           EXTENDED_FORMAT - extended frame 29-bits.
**                           Note: This parameter is obsolete and
**                           will be removed in future releases.
**       * Length          - Pointer to a length of the frame
**       * Data            - The buffer for received data
**     Returns     :
**         ---             - Error code, possible codes:
**                           ERR_OK - OK
**                           ERR_SPEED - This device does not work in
**                           the active speed mode
**                           ERR_DISABLED - This bean is disabled by
**                           user
**                           ERR_RXEMPTY - The receive buffer is
**                           empty
**                           ERR_OVERRUN - The previous message in
**                           the receive buffer was overwriten by a
**                           new message.
** ===================================================================
*/

void CAN1_Init(void);
/*
** ===================================================================
**     Method      :  CAN1_Init (bean FreescaleCAN)
**
**     Description :
**         Initializes the associated peripheral(s) and the beans 
**         internal variables. The method is called automatically as a 
**         part of the application initialization code.
**         This method is internal. It is used by Processor Expert only.
** ===================================================================
*/

#define CAN1_GetStateTX()  (CANTFLG & 7)
/*
** ===================================================================
**     Method      :  CAN1_GetStateTX (bean FreescaleCAN)
**
**     Description :
**         Returns a value of the transmission complete flags.
**     Parameters  : None
**     Returns     :
**         ---             - Content of the transmitter complete
**                           flag register.
** ===================================================================
*/

byte CAN1_SetAcceptanceMask(dword AccMask1, dword AccMask2);
/*
** ===================================================================
**     Method      :  CAN1_SetAcceptanceMask (bean FreescaleCAN)
**
**     Description :
**         Sets the acceptance mask registers. This method writes an
**         acceptance mask directly to the acceptance mask registers.
**     Parameters  :
**         NAME            - DESCRIPTION
**         AccMask1        - Acceptance mask for the
**                           message filtering. This acceptance mask
**                           will be written to the acceptance mask
**                           registers IDMR0-IDMR3. The most
**                           significant byte of the acceptance mask
**                           will be written to the IDMR0 register
**                           and the least significant byte of the
**                           acceptance mask will be written to the
**                           IDMR3 register.
**         AccMask2        - Acceptance mask for the
**                           message filtering. This acceptance mask
**                           will be written to the acceptance mask
**                           registers IDMR4-IDMR7. The most
**                           significant byte of the acceptance mask
**                           will be written to the IDMR4 register
**                           and the least significant byte of the
**                           acceptance mask will be written to the
**                           IDMR7 register.
**     Returns     :
**         ---             - Error code, possible codes:
**                           ERR_OK - OK
**                           ERR_SPEED - This device does not work in
**                           the active speed mode
**                           ERR_DISABLED - This bean is disabled by
**                           user
** ===================================================================
*/

#pragma CODE_SEG __NEAR_SEG NON_BANKED
__interrupt void CAN1_InterruptRx(void);
#pragma CODE_SEG CAN1_CODE
/*
** ===================================================================
**     Method      :  CAN1_InterruptRx (bean FreescaleCAN)
**
**     Description :
**         The method services the receive interrupt of the selected 
**         peripheral(s) and eventually invokes the beans event(s).
**         This method is internal. It is used by Processor Expert only.
** ===================================================================
*/

#pragma CODE_SEG __NEAR_SEG NON_BANKED
__interrupt void CAN1_InterruptError(void);
#pragma CODE_SEG CAN1_CODE
/*
** ===================================================================
**     Method      :  CAN1_InterruptError (bean FreescaleCAN)
**
**     Description :
**         The method services the error interrupt of the selected 
**         peripheral(s) and eventually invokes the beans event(s).
**         This method is internal. It is used by Processor Expert only.
** ===================================================================
*/



#pragma CODE_SEG DEFAULT

/* END CAN1. */

#endif /* ifndef __CAN1 */
/*
** ###################################################################
**
**     This file was created by UNIS Processor Expert 2.96 [03.76]
**     for the Freescale HCS12 series of microcontrollers.
**
** ###################################################################
*/

⌨️ 快捷键说明

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