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

📄 sm1.h

📁 用PE生成的SPI驱动,是一个很好的学习使用PE开发的范例
💻 H
字号:
/** ###################################################################
**     THIS BEAN MODULE IS GENERATED BY THE TOOL. DO NOT MODIFY IT.
**     Filename  : SM1.H
**     Project   : DP256B_PE_SPI
**     Processor : MC9S12DP256BCPV
**     Beantype  : SynchroMaster
**     Version   : Bean 02.251, Driver 01.14, CPU db: 2.87.419
**     Compiler  : CodeWarrior HC12 C Compiler
**     Date/Time : 2007-4-29, 14:20
**     Abstract  :
**         This bean "SynchroMaster" implements MASTER part of synchronous
**         serial master-slave communication.
**     Settings  :
**         Synchro type                : MASTER
**
**         Serial channel              : SPI0
**
**         Protocol
**             Init baud rate          : 100kHz
**             Clock edge              : rising
**             Width                   : 8 bits (always)
**             Empty character         : 0
**             Empty char. on input    : RECEIVED
**
**         Registers
**             Input buffer            : SPI0DR    [221]
**             Output buffer           : SPI0DR    [221]
**             Control register        : SPI0CR1   [216]
**             Mode register           : SPI0CR2   [217]
**             Baud setting reg.       : SPI0BR    [218]
**
**         Input interrupt
**             Vector name             : Vspi0
**             Priority                : 1
**
**         Output interrupt
**             Vector name             : Vspi0
**             Priority                : 1
**
**         Used pins                   :
**         ----------------------------------------------------------
**              Function    | On package |    Name
**         ----------------------------------------------------------
**               Input      |     93     |  PS4_MISO0
**               Output     |     94     |  PS5_MOSI0
**               Clock      |     95     |  PS6_SCK0
**         ----------------------------------------------------------
**
**     Contents  :
**         RecvChar        - byte SM1_RecvChar(SM1_TComData *Chr);
**         SendChar        - byte SM1_SendChar(SM1_TComData Chr);
**         GetCharsInRxBuf - word SM1_GetCharsInRxBuf(void);
**         GetCharsInTxBuf - word SM1_GetCharsInTxBuf(void);
**         GetError        - byte SM1_GetError(SM1_TError *Err);
**
**     (c) Copyright UNIS, spol. s r.o. 1997-2006
**     UNIS, spol. s r.o.
**     Jundrovska 33
**     624 00 Brno
**     Czech Republic
**     http      : www.processorexpert.com
**     mail      : info@processorexpert.com
** ###################################################################*/

#ifndef __SM1
#define __SM1

/* MODULE SM1. */

#include "Cpu.h"

#pragma DATA_SEG SM1_DATA
#pragma CODE_SEG SM1_CODE


#ifndef __BWUserType_SM1_TError
#define __BWUserType_SM1_TError
  typedef union {
    byte err;
    struct {
      bool OverRun  : 1;   /* OverRun error flag - the data overflow on the input has been detected. Both hardware detection (if supported) and software detection (when the value of Input buffer size property is 0) is used. */
      bool RxBufOvf : 1;   /* Rx buffer full error flag - the input circular buffer defined by the Input buffer size property has overrun. */
      bool FaultErr : 1;   /* Fault mode error flag - only if supported by hardware */
    }errName;
  } SM1_TError;                        /* Error flags. For languages which don't support bit access is byte access only to error flags possible.  */
#endif

#define SM1_EOF 0                      /* Empty character*/
#ifndef __BWUserType_SM1_TComData
#define __BWUserType_SM1_TComData
  typedef byte SM1_TComData ;          /* User type for communication. */
#endif



byte SM1_RecvChar(SM1_TComData *Chr);
/*
** ===================================================================
**     Method      :  SM1_RecvChar (bean SynchroMaster)
**
**     Description :
**         If any data is received, this method returns one
**         character, otherwise it returns an error code (it does
**         not wait for data).
**     Parameters  :
**         NAME            - DESCRIPTION
**       * Chr             - A pointer to the received character
**     Returns     :
**         ---             - Error code, possible codes:
**                           ERR_OK - OK
**                           ERR_SPEED - This device does not work in
**                           the active speed mode
**                           ERR_RXEMPTY - No data in receiver
**                           ERR_OVERRUN - Overrun error was detected
**                           from the last char or block received. In
**                           polling mode, this error code is
**                           returned only when the hardware supports
**                           detection of the overrun error. 
**                           ERR_FAULT - Fault error was detected
**                           from the last char or block received.
**                           This error may not be supported on some
**                           CPUs (see generated code).
** ===================================================================
*/

byte SM1_SendChar(SM1_TComData Chr);
/*
** ===================================================================
**     Method      :  SM1_SendChar (bean SynchroMaster)
**
**     Description :
**         Sends one character to the channel.
**     Parameters  :
**         NAME            - DESCRIPTION
**         Chr             - Character to send
**     Returns     :
**         ---             - Error code, possible codes:
**                           ERR_OK - OK
**                           ERR_SPEED - This device does not work in
**                           the active speed mode
**                           ERR_DISABLED - Device is disabled (only
**                           if output DMA is supported and enabled)
**                           ERR_TXFULL - Transmitter is full
** ===================================================================
*/

word SM1_GetCharsInRxBuf(void);
/*
** ===================================================================
**     Method      :  SM1_GetCharsInRxBuf (bean SynchroMaster)
**
**     Description :
**         Returns the number of characters in the input buffer.
**         Note: If the Interrupt service is disabled, and the
**         Ignore empty character is set to yes, and a character has
**         been received, then this method returns 1 although it was
**         an empty character.
**     Parameters  : None
**     Returns     :
**         ---             - Number of characters in the input
**                           buffer.
** ===================================================================
*/

word SM1_GetCharsInTxBuf(void);
/*
** ===================================================================
**     Method      :  SM1_GetCharsInTxBuf (bean SynchroMaster)
**
**     Description :
**         Returns the number of characters in the output buffer.
**     Parameters  : None
**     Returns     :
**         ---             - Number of characters in the output
**                           buffer.
** ===================================================================
*/

byte SM1_GetError(SM1_TError *Err);
/*
** ===================================================================
**     Method      :  SM1_GetError (bean SynchroMaster)
**
**     Description :
**         Returns a set of errors on the channel (errors that
**         cannot be returned in given methods). The errors
**         accumulate in a set; after calling [GetError] this set is
**         returned and cleared.
**     Parameters  :
**         NAME            - DESCRIPTION
**       * Err             - A 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
** ===================================================================
*/

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

void SM1_Init(void);
/*
** ===================================================================
**     Method      :  SM1_Init (bean SynchroMaster)
**
**     Description :
**         Initializes the associated peripheral(s) and the bean 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.
** ===================================================================
*/

#pragma CODE_SEG DEFAULT

/* END SM1. */

#endif /* ifndef __SM1 */
/*
** ###################################################################
**
**     This file was created by UNIS Processor Expert 2.97 [03.83]
**     for the Freescale HCS12 series of microcontrollers.
**
** ###################################################################
*/

⌨️ 快捷键说明

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