亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? i2c.txt

?? pic單片機例程
?? TXT
字號:
The i2c functions and macros to implement the i squared c,
7-bit, standard-mode, master-mode protcol.

For a description of i squared c, see "The i2c bus -
and how to use it" by Philips Semiconductors.

CONTENTS
########

1 Setting Up
2 High-level Function and Macro Definitions
3 Lower-level Function and Macro Definitions
4 Examples


1) Setting Up
#############

The file i2c.h should be #included into your source
files. This file contains several macros which specify
which port bits are to be used for the clock (SCL) and
the data line (SDA). These should be adjusted to suit
your application. The bus time-out macro I2C_TM_SCL_TMO
in i2c.h may need adjusting to suit the devices used.
Some devices require relatively long time to process
data. A delay may be required in your code before
attempting further access to these devices. If your
PIC crystal frequency is not 4MHz, you will have to
redefined _XTAL_FREQ accordingly for the delays to be
accurate.


2) High-level Function and Macro Definitions
############################################

unsigned char
i2c_WriteTo(unsigned char address)
~~~~~~~~~~~

This function is used to commence writing to a device
on the bus. Specify the 7-bit address to which data is
to be sent. The least significant bit of the argument
is ignored. The function generates a (re)start condition
and reads an acknowledge from the slave. The function
returns TRUE if the slave did not acknowledge the address
transfer or FALSE otherwise.

unsigned char
i2c_ReadFrom(unsigned char address)
~~~~~~~~~~~~

This function is used to commence reading from a
device on the bus. Specify the 7-bit address from which
data is to be read. The least significant bit of the
argument is ignored. The function generates a (re)start
condition and reads an acknowledge from the slave. The
function returns TRUE if the slave did not acknowledge
the address transfer or FALSE otherwise.

signed char
i2c_PutByte(unsigned char byte)
~~~~~~~~~~~~

This function is used to send a byte of data to the
device which has been activated by i2c_WriteTo().
The function checks the acknowledge bit returned
by the slave. The function returns I2C_ERROR if during
the transfer a bus error occured, TRUE if the data
was not acknowledged, or FALSE if the transfer took
place without error and was acknowledged.

int
i2c_GetByte(unsigned char more)
~~~~~~~~~~~

This function is used to read a byte of data from
the device which has been activated by i2c_ReadFrom().
The argument to this function is used to determine if
more data is to be read from the activated device. If
more is I2C_LAST, or false, no acknowledge is sent, and
no more data can be read from the activated device
unless another i2c_ReadFrom() command is issued.
If more is I2C_MORE, or any true value, an acknowledge is
sent and more data can be read from the activated
device. The function returns the unsigned byte read
from the activated device or I2C_ERROR if a bus error
occured during the read operation.


signed int
i2c_PutString(const unsigned char *string,
~~~~~~~~~~~~~       unsigned char str_len)

This function is used to send a sequence of bytes to
the device which has been activated by i2c_WriteTo().
The function attempts to send str_len bytes which
are read from string. If a bus error occures during
the transfer, the function returns a negative int.
The magnitude of this number is the number of bytes
which were not successfully transmitted. If the
slaves fails to acknowledge a transfer, the
transmission is terminated and the function
returns a positive number. The magnitude of this
number is the number of bytes which were not
successfully transmitted. The function returns FALSE
if the all the bytes were transmitted without error
and they were all acknowledged by the slave.

unsigned char
i2c_GetString(unsigned char *string,
~~~~~~~~~~~~~ unsigned char str_len)

This function is used to obtain a sequence of bytes
from the device which has been activated by
i2c_ReadFrom(). The function attempts to read str_len
bytes which will be stored at string. If a bus error
occurs during the transfer, the function terminates
and returns the number of bytes not successfully read.
The function returns FALSE if all the data requested
was read without error. This function indicates to
the slave that no more data is to be read after
successfully reading the last byte. To read more data
after using this function, activate the source device
by using i2c_ReadFrom().


I2C_MORE and I2C_LAST
~~~~~~~~     ~~~~~~~~

These macros may be used with i2c_GetByte() to
indicate that more data is to be read or that this
is the last byte to be read, respectively.

I2C_ERROR
~~~~~~~~~

This macro may be used with i2c_GetByte() and
i2c_PutByte() to check for a bus error.


3) Lower-level Function and Macro Definitions
#############################################

void
i2c_Stop(void)
~~~~~~~~

Sends a stop condition.

void
i2c_Restart(void)
~~~~~~~~~~~

Sends a start condition.

void
i2c_Start(void)
~~~~~~~~~~~

Sends a start condition. Functionally the same
as i2c_Restart().

unsigned char
i2c_SendByte(unsigned char byte)
~~~~~~~~~~~~

Sends an 8-bit number to the active device. The
acknowledge bit is not checked. Returns TRUE if
a bus error occured; FALSE otherwise.

usigned char
i2c_SendAddress(unsigned char address,
~~~~~~~~~~~~~~~      unsigned char rw)

Sends an 8-bit quantity representing a 7-bit
address and a 1-bit read/write mode bit. Returns
TRUE if a bus error occurred; FALSE otherwise.

signed char
i2c_ReadAcknowledge(void)
~~~~~~~~~~~~~~~~~~~

Reads the acknowledge bit from the slave.
Returns I2C_ERROR if a bus error occurs, TRUE if
the device did not acknowledge, or FALSE
otherwise.

int
i2c_ReadByte(void)
~~~~~~~~~~~~

Reads an 8-bit quantity from the slave. The
acknowledge is not generated. Returns the byte or
I2C_ERROR if a bus error occurred.

void
i2c_SendAcknowledge(unsigned char status)
~~~~~~~~~~~~~~~~~~~

Sends an acknowledge if status is TRUE; sends
a ~acknowledge otherwise. A ~acknowledge is used
to indicate to the slave that no more data is to
be read and that it should release the bus so that
the master can issue the next command.

unsigned char
i2c_Open(unsigned char address, unsigned char mode)
~~~~~~~~

Sends a 7-bit address and 1-bit read/write mode bit.
Returns TRUE if the device did not acknowledge.

unsigned char
i2c_WaitForSCL(void)
~~~~~~~~~~~~~~

Waits for the clock line to be released by the slave.
If the line is not released after I2C_TM_SCL_TMO micro
seconds, the function times out and a bus error is
assumed. In this case, the function returns TRUE;
FALSE otherwise.


4) Examples
###########

i2c_WriteTo(0xAE);	/* talk to device 1010111w */
i2c_PutByte(0x00);	/* send data 0x00 */

i2c_ReadFrom(0xAE);	/* talk to device 1010111r */
data1 = i2c_GetByte(I2C_MORE);	/* read one byte */
data2 = i2c_GetByte(I2C_MORE);	/* read another */
i2c_GetString(my_string, 10);	/* read 10 bytes */

/* i2c_GetString() terminates reading, if more data
 * is required, re-address the device
 */

i2c_ReadFrom(0xAE);
data3 = i2c_GetByte(I2C_LAST);	/* last byte read */

/* check for errors */
if(i2c_PutByte(0xff))
  my_error_routine();	/* bus error or ~ack */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲国产精品高清| 7799精品视频| 久久久.com| 成人晚上爱看视频| 亚洲欧洲精品一区二区精品久久久| 成人午夜激情在线| 亚洲综合一区在线| 欧美一卡在线观看| 国产精品综合二区| 亚洲天天做日日做天天谢日日欢| 色婷婷精品大在线视频| 肉色丝袜一区二区| 久久久蜜桃精品| 色999日韩国产欧美一区二区| 亚洲国产精品自拍| 精品美女一区二区三区| 丁香六月综合激情| 亚洲国产日韩精品| www一区二区| 色94色欧美sute亚洲线路一久| 日本强好片久久久久久aaa| 久久久美女毛片| 在线观看视频一区二区| 精品一区二区三区视频在线观看 | 亚洲一区二区三区四区在线观看| 欧美日韩黄色一区二区| 激情欧美一区二区| 亚洲精品综合在线| 337p亚洲精品色噜噜| 国产高清成人在线| 亚洲123区在线观看| 国产日韩欧美在线一区| 欧美日韩综合在线免费观看| 国产精品伊人色| 亚洲亚洲精品在线观看| 国产欧美一区二区三区在线老狼| 欧洲一区二区三区免费视频| 国产在线播精品第三| 午夜精品在线视频一区| 中文字幕久久午夜不卡| 91精品国产综合久久福利| 99久久精品国产一区| 国模一区二区三区白浆| 午夜激情一区二区三区| 亚洲同性gay激情无套| 久久久99精品久久| 日韩午夜av电影| 欧美亚洲国产bt| 99riav一区二区三区| 国产成人精品三级| 麻豆精品一区二区| 亚洲福利一区二区| 夜夜精品视频一区二区| 中文字幕不卡在线播放| 久久午夜老司机| 日韩欧美在线影院| 欧美一区二区三区视频在线观看| 欧美性色黄大片| 色狠狠一区二区| 99精品国产一区二区三区不卡| 精品午夜久久福利影院| 日韩av一级片| 日本aⅴ亚洲精品中文乱码| 亚洲免费色视频| 国产精品国模大尺度视频| 国产日韩欧美综合在线| 久久久久久免费| 精品国产99国产精品| 日韩三级在线观看| 欧美一级黄色大片| 日韩亚洲欧美一区| 26uuu成人网一区二区三区| 欧美va亚洲va| 精品国产伦一区二区三区观看方式 | 91原创在线视频| 成人激情校园春色| a美女胸又www黄视频久久| 懂色av一区二区三区免费看| 国产麻豆精品视频| 国产成人综合亚洲91猫咪| 国产不卡高清在线观看视频| 国产成人在线观看| 成人av中文字幕| 99国产精品久久久久久久久久| 99久久综合99久久综合网站| jlzzjlzz亚洲女人18| 色综合久久99| 欧美日韩国产乱码电影| 日韩午夜精品电影| 国产三级一区二区三区| 国产精品久久一级| 亚洲人亚洲人成电影网站色| 亚洲女子a中天字幕| 国产精品1区2区| 99久久婷婷国产综合精品| 欧美主播一区二区三区| 欧美一区二区三区视频免费| 精品日韩av一区二区| 国产精品国产三级国产aⅴ中文 | 蜜臀久久久99精品久久久久久| 激情图片小说一区| fc2成人免费人成在线观看播放| 91视频在线观看| 4438x亚洲最大成人网| 久久一留热品黄| 亚洲三级小视频| 麻豆精品视频在线观看视频| 成人福利视频网站| 欧美精品 日韩| 国产丝袜在线精品| 午夜婷婷国产麻豆精品| 国产精品一区不卡| 欧美视频一区二区在线观看| 欧美sm美女调教| 亚洲麻豆国产自偷在线| 久久电影国产免费久久电影| 91尤物视频在线观看| 日韩欧美中文字幕公布| 亚洲视频在线一区| 国产在线一区二区综合免费视频| 色综合天天综合狠狠| 精品久久久久99| 一区二区三区小说| 国产xxx精品视频大全| 欧美日本韩国一区| 综合久久给合久久狠狠狠97色 | 一区二区三区精品在线观看| 久久精品久久综合| 欧洲在线/亚洲| 国产日韩精品久久久| 日本亚洲天堂网| 色综合 综合色| 国产午夜精品一区二区三区视频| 亚洲不卡一区二区三区| 99re免费视频精品全部| 精品99久久久久久| 婷婷夜色潮精品综合在线| 波多野结衣中文一区| 亚洲精品在线电影| 日韩二区三区在线观看| 色婷婷综合久久| 亚洲国产精品精华液2区45| 蜜臀精品一区二区三区在线观看 | 欧美三级欧美一级| ...xxx性欧美| 豆国产96在线|亚洲| 久久综合国产精品| 老司机午夜精品| 这里只有精品电影| 亚洲国产日产av| 欧美在线制服丝袜| 亚洲视频一区在线| 不卡一区在线观看| 国产精品久久午夜| 成人免费高清在线观看| 久久久久国产精品人| 国产一区二区三区视频在线播放| 8x8x8国产精品| 日韩和的一区二区| 欧美日韩国产天堂| 午夜国产不卡在线观看视频| 欧美性色黄大片手机版| 成人国产精品免费| 欧美国产欧美综合| 成人一区二区三区视频在线观看| 久久免费的精品国产v∧| 国产在线视视频有精品| 久久久久国产成人精品亚洲午夜| 国产一区二区在线视频| 久久久久久9999| 成人激情免费视频| 亚洲乱码中文字幕综合| 欧美在线综合视频| 日本特黄久久久高潮| 精品国产乱码久久久久久浪潮 | 精品久久久久久久久久久久久久久久久 | 亚洲午夜久久久久| 欧美日韩在线不卡| 琪琪一区二区三区| 精品免费一区二区三区| 成人午夜电影网站| 亚洲欧美另类在线| 欧美日韩第一区日日骚| 日本成人在线看| 久久女同精品一区二区| 国产成人综合亚洲网站| 亚洲人成在线观看一区二区| 欧美色图12p| 精品一区二区三区香蕉蜜桃| 中文字幕高清一区| 欧亚一区二区三区| 六月婷婷色综合| 欧美经典三级视频一区二区三区| 91麻豆.com| 日韩电影免费在线观看网站| 国产亚洲精品久| 一本一道久久a久久精品综合蜜臀| 日韩中文字幕1| 久久精品视频在线免费观看| 在线日韩av片|