虫虫首页| 资源下载| 资源专辑| 精品软件
登录| 注册

您现在的位置是:虫虫下载站 > 资源下载 > 单片机编程 > I2C slave routines for the 87L

I2C slave routines for the 87L

  • 资源大小:79 K
  • 上传时间: 2013-11-19
  • 上传用户:zjl2013
  • 资源积分:2 下载积分
  • 标      签: routines slave I2C 87L

资 源 简 介

The 87LPC76X Microcontroller combines in a small package the
benefits of a high-performance microcontroller with on-board
hardware supporting the Inter-Integrated Circuit (I2C) bus interface.
The 87LPC76X can be programmed both as an I2C bus master, a
slave, or both. An overview of the I2C bus and description of the bus
support hardware in the 87LPC76X microcontrollers appears in
application note AN464, Using the 87LPC76X Microcontroller as an
I2C Bus Master. That application note includes a programming
example, demonstrating a bus-master code. Here we show an
example of programming the microcontroller as an I2C slave.
The code listing demonstrates communications routines for the
87LPC76X as a slave on the I2C bus. It compliments the program in
AN464 which demonstrates the 87LPC76X as an I2C bus master.
One may demonstrate two 87LPC76X devices communicating with
each other on the I2C bus, using the AN464 code in one, and the
program presented here in the other. The examples presented here
and in AN464 allow the 87LPC76X to be either a master or a slave,
but not both. Switching between master and slave roles in a
multimaster environment is described in application note AN435.
The software for a slave on the bus is relatively simple, as the
processor plays a relatively passive role. It does not initiate bus
transfers on its own, but responds to a master initiating the
communications. This is true whether the slave receives or transmits
data—transmission takes place only as a response to a bus
master’s request. The slave does not have to worry about arbitration
or about devices which do not acknowledge their address. As the
slave is not supposed to take control of the bus, we do not demand
it to resolve bus exceptions or “hangups”. If the bus becomes
inactive the processor simply withdraws, not interfering with the
master (or masters) on the bus which should (hopefully) try to
resolve the situation.

相 关 资 源

您 可 能 感 兴 趣 的