📄 can1.h
字号:
/** ###################################################################
** THIS BEAN MODULE IS GENERATED BY THE TOOL. DO NOT MODIFY IT.
** Filename : CAN1.H
** Project : NODE_A
** Processor : MC9S12C64CFA16
** Beantype : FreescaleCAN
** Version : Bean 02.334, Driver 01.21, CPU db: 2.87.339
** Compiler : Metrowerks HC12 C Compiler
** Date/Time : 2006-11-11, 13:11
** Abstract :
** This bean "FreescaleCAN" implements a CAN serial channel.
** Settings :
** CAN channel : MSCAN
**
** Protocol
** Interrupt priority : 1
** Time segment 1 : 7
** Time segment 2 : 3
** RSJ : 1
**
** Recieve accept. code : 0
** Recieve accept. mask : 4294967295
**
** Input interrupt
** Vector name : Vcanrx
** Priority : 1
**
** Output interrupt
** Vector name : Vcantx
** Priority : 1
**
** Contents :
** SetAcceptanceCode - byte CAN1_SetAcceptanceCode(dword AccCode1,dword AccCode2);
** SetAcceptanceMask - byte CAN1_SetAcceptanceMask(dword AccMask1,dword AccMask2);
** SetAcceptanceMode - byte CAN1_SetAcceptanceMode(byte Mode);
** SendFrame - byte CAN1_SendFrame(byte BufferNum,dword MessageID,byte FrameType,byte...
** ReadFrame - byte CAN1_ReadFrame(dword *MessageID,byte *FrameType,byte *FrameFormat,byte...
** GetStateTX - byte CAN1_GetStateTX(void);
** GetStateRX - bool CAN1_GetStateRX(void);
** GetError - byte CAN1_GetError(CAN1_TError *Err);
** SendFrameExt - byte CAN1_SendFrameExt(dword MessageID,byte FrameType,byte Length,byte *Data);
**
** (c) Copyright UNIS, spol. s r.o. 1997-2005
** UNIS, spol. s r.o.
** Jundrovska 33
** 624 00 Brno
** Czech Republic
** http : www.processorexpert.com
** mail : info@processorexpert.com
** ###################################################################*/
#ifndef __CAN1
#define __CAN1
#include "Cpu.h"
/*Include shared modules, which are used for whole project*/
#include "PE_Types.h"
#include "PE_Error.h"
#include "PE_Const.h"
#include "IO_Map.h"
#include "PE_Timer.h"
/* MODULE CAN1. */
#ifndef __BWUserType_CAN1_TError
#define __BWUserType_CAN1_TError
typedef union {
word err;
struct {
bool OverRun : 1; /* Overrun error flag */
bool RxBufOvf : 1; /* Rx buffer full error flag */
bool Idle : 1; /* Idle character detect */
bool BusOff : 1; /* Bus-off state */
bool TxPassive : 1; /* Transmitter error passive */
bool RxPassive : 1; /* Reciver error passive */
bool TxWarning : 1; /* Transmitter warning */
bool RxWarning : 1; /* Receiver warning */
bool Ack : 1; /* Acknowledge error */
bool Crc : 1; /* CRC error */
bool Form : 1; /* Form error */
bool Stuff : 1; /* Stuff bit error */
bool Bit0 : 1; /* Bit 0 error */
bool Bit1 : 1; /* Bit 1 error */
}errName;
} CAN1_TError; /* Error flags. For languages which don't support bit access is byte access only to error flags possible. */
#endif
#pragma DATA_SEG CAN1_DATA
#pragma CODE_SEG CAN1_CODE
/* User constants */
/* Message filterring */
#define TWO_32_FILTERS 0
#define FOUR_16_FILTERS 1
#define EIGHT_8_FILTERS 2
#define FILTER_CLOSED 3
/* Frame formats */
#define STANDARD_FORMAT 0
#define EXTENDED_FORMAT 1
/* Frame types */
#define DATA_FRAME 0
#define REMOTE_FRAME 1
/* Extended message ID identifier. This constant can be used to specify an extended message ID
* anywhere the message ID is required.
*/
#define CAN_EXTENDED_FRAME_ID 0x80000000UL /* Extended message ID identifier */
/* Global variables */
byte CAN1_SendFrameExt(dword MessageID,byte FrameType,byte Length,byte *Data);
/*
** ===================================================================
** Method : CAN1_SendFrameExt (bean FreescaleCAN)
**
** Description :
** Sends a frame. This method automatically selects a free
** transmit buffer for data transmission. The user cannot
** specify a transmit buffer.
** Parameters :
** NAME - DESCRIPTION
** 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
** ===================================================================
*/
byte CAN1_SetAcceptanceMode(byte Mode);
/*
** ===================================================================
** Method : CAN1_SetAcceptanceMode (bean FreescaleCAN)
**
** Description :
** Sets the acceptance mode register.
** Parameters :
** NAME - DESCRIPTION
** Mode - Acceptance mode.
** Supported modes:
** TWO_32_FILTERS - Two 32-bit acceptance
** filters
** FOUR_16_FILTERS - Four 16-bit acceptance
** filters
** EIGHT_8_FILTERS - Eight 8-bit acceptance
** filters
** FILTER_CLOSED - Filter closed
** 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 - Parameter has incorrect value
** ===================================================================
*/
byte CAN1_GetStateRX(void);
/*
** ===================================================================
** Method : CAN1_GetStateRX (bean FreescaleCAN)
**
** Description :
** Returns a value of the reception complete flag.
** Parameters : None
** Returns :
** --- - The value of the receiver complete flag
** of the given buffer.
** Possible values:
** FALSE - message buffer is empty
** TRUE - message buffer isn't empty
** ===================================================================
*/
byte CAN1_SetAcceptanceCode(dword AccCode1, dword AccCode2);
/*
** ===================================================================
** Method : CAN1_SetAcceptanceCode (bean FreescaleCAN)
**
** Description :
** Sets the acceptance code registers. This method writes a
** code mask directly to the acceptance code registers.
** Parameters :
** NAME - DESCRIPTION
** AccCode1 - Acceptance code for the
** message filtering. This acceptance code
** will be written to the acceptance code
** registers IDAR0-IDAR3. The most
** significant byte of the acceptance code
** will be written to the IDAR0 register
** and the least significant byte of the
** acceptance code will be written to the
** IDAR3 register.
** AccCode2 - Acceptance code for the
** message filtering. This acceptance code
** will be written to the acceptance code
** registers IDAR4-IDAR7. The most
** significant byte of the acceptance code
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -