📄 i2c1.h
字号:
/** ###################################################################
** THIS BEAN MODULE IS GENERATED BY THE TOOL. DO NOT MODIFY IT.
** Filename : I2C1.H
** Project : LM75A
** Processor : MC9S08QE8CFM
** Beantype : InternalI2C
** Version : Bean 01.196, Driver 01.20, CPU db: 3.00.026
** Compiler : CodeWarrior HCS08 C Compiler
** Date/Time : 2009-1-13, 15:18
** Abstract :
** This bean encapsulates the internal I2C communication
** interface. The implementation of the interface is based
** on the Philips I2C-bus specification version 2.0.
** Interface features:
** MASTER mode
** - Multi master communication
** - The combined format of communication possible
** (see "Automatic stop condition" property)
** - 7-bit slave addressing (10-bit addressing can be made as well)
** - Acknowledge polling provided
** - No wait state initiated when a slave device holds the SCL line low
** - Holding of the SCL line low by slave device recognized as 'not available bus'
** - Invalid start/stop condition detection provided
** SLAVE mode
** - 7-bit slave addressing
** - General call address detection provided
** Settings :
** Serial channel : IIC
**
** Protocol
** Mode : MASTER
** Auto stop condition : yes
** SCL frequency : 104.858 kHz
**
** Initialization
**
** Slave address : 8
** Bean function : Enabled
** Events : Enabled
**
** Registers
** Input buffer : IICD [$0034]
** Output buffer : IICD [$0034]
** Control register : IICC1 [$0032]
** Status register : IICS [$0033]
** Baud setting reg. : IICF [$0031]
** Address register : IICA [$0030]
**
** Interrupt
** Vector name : Viic
** Priority :
**
** Used pins :
** ----------------------------------------------------------
** Function | On package | Name
** ----------------------------------------------------------
** SDA | 24 | PTA2_KBIP2_SDA_ADP2
** SCL | 23 | PTA3_KBIP3_SCL_ADP3
** ----------------------------------------------------------
** Contents :
** SendChar - byte I2C1_SendChar(byte Chr);
** RecvChar - byte I2C1_RecvChar(byte *Chr);
** SendBlock - byte I2C1_SendBlock(void* Ptr, word Siz, word *Snt);
** RecvBlock - byte I2C1_RecvBlock(void* Ptr, word Siz, word *Rcv);
** GetCharsInTxBuf - word I2C1_GetCharsInTxBuf(void);
** SelectSlave - byte I2C1_SelectSlave(byte Slv);
** GetCharsInRxBuf - word I2C1_GetCharsInRxBuf(void);
**
** (c) Copyright UNIS, spol. s r.o. 1997-2008
** UNIS, spol. s r.o.
** Jundrovska 33
** 624 00 Brno
** Czech Republic
** http : www.processorexpert.com
** mail : info@processorexpert.com
** ###################################################################*/
#ifndef __I2C1
#define __I2C1
/* MODULE I2C1. */
/*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 inherited beans */
#include "Cpu.h"
/* MODULE I2C1. */
extern volatile word I2C1_SndRcvTemp;
__interrupt void I2C1_Interrupt(void);
/*
** ===================================================================
** Method : I2C1_Interrupt (bean InternalI2C)
**
** 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.
** ===================================================================
*/
byte I2C1_SendChar(byte Chr);
/*
** ===================================================================
** Method : I2C1_SendChar (bean InternalI2C)
**
** Description :
** When working as a MASTER, this method writes one (7-bit
** addressing) or two (10-bit addressing) slave address
** bytes inclusive of R/W bit = 0 to the I2C bus and then
** writes one character (byte) to the bus. The slave address
** must be specified before, by the "SelectSlave" or
** "SelectSlave10" method or in the bean initialization
** section, "Target slave address init" property. If
** interrupt service is enabled and the method returns
** ERR_OK, it doesn't mean that transmission was successful.
** The state of transmission is obtainable from
** (OnTransmitData, OnError or OnArbitLost) events.
** When working as a SLAVE, this method writes a character
** to the internal output slave buffer and, after the master
** starts the communication, to the I2C bus. If no character
** is ready for a transmission (internal output slave buffer
** is empty), the Empty character will be sent (see "Empty
** character" property).
** 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
** ERR_BUSY - The slave device is busy, it
** does not respond by an acknowledge (only
** in master mode and when interrupt
** service is disabled)
** ERR_BUSOFF - Clock timeout elapsed or
** device cannot transmit data
** ERR_TXFULL - Transmitter is full (slave
** mode only)
** ERR_ARBITR - Arbitration lost (only when
** interrupt service is disabled and in
** master mode)
** ===================================================================
*/
#define I2C1_RecvChar(Chr) I2C1_RecvBlock((Chr), (word)1, (word*)&I2C1_SndRcvTemp)
/*
** ===================================================================
** Method : I2C1_RecvChar (bean InternalI2C)
**
** Description :
** When working as a MASTER, this method writes one (7-bit
** addressing) or two (10-bit addressing) slave address
** bytes inclusive of R/W bit = 1 to the I2C bus, then reads
** one character (byte) from the bus and then sends the stop
** condition. The slave address must be specified before, by
** the "SelectSlave" or "SelectSlave10" method or in bean
** initialization section, property "Target slave address
** init". If interrupt service is enabled and the method
** returns ERR_OK, it doesn't mean that transmission was
** finished successfully. The state of transmission must be
** tested by means of events (OnReceiveData, OnError or
** OnArbitLost). In case of successful transmission,
** received data is ready after OnReceiveData event is
** called.
** When working as a SLAVE, this method reads a character
** from the input slave buffer.
** Parameters :
** NAME - DESCRIPTION
** * Chr - Received character.
** 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
** ERR_BUSY - The slave device is busy, it
** does not respond by the acknowledge
** (only in master mode and when interrupt
** service is disabled)
** ERR_BUSOFF - Clock timeout elapsed or
** device cannot receive data
** ERR_RXEMPTY - No data in receiver (slave
** mode only)
** ERR_OVERRUN - Overrun error was detected
** from the last character or block
** received (slave mode only)
** ERR_ARBITR - Arbitration lost (only when
** interrupt service is disabled and in
** master mode)
** ERR_NOTAVAIL - Method is not available
** in current mode - see generated code
** comment
** ===================================================================
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -