在线观看www成人影院-在线观看www日本免费网站-在线观看www视频-在线观看操-欧美18在线-欧美1级

0
  • 聊天消息
  • 系統消息
  • 評論與回復
登錄后你可以
  • 下載海量資料
  • 學習在線課程
  • 觀看技術視頻
  • 寫文章/發帖/加入社區
會員中心
創作中心

完善資料讓更多小伙伴認識你,還能領取20積分哦,立即完善>

3天內不再提示

如何使用MAX2990 I2C接口編寫工業標準EEPROM

星星科技指導員 ? 來源:ADI ? 作者:ADI ? 2023-01-12 09:48 ? 次閱讀

文章和固件代碼示例介紹了如何使用MAX2990電力線通信調制解調器上的IC接口與外部EEPROM 24C04接口。

介紹

本應用筆記和固件代碼示例描述了MAX2990電力線通信調制解調器上的IC接口如何與外部EEPROM 24C04接口。IC總線由MAX2990(主機)控制,24C04 EEPROM由從機控制。下面的示意圖顯示了此示例中使用的硬件配置。

pYYBAGO_ZwuANZftAAAYjLb2-sA586.gif?imgver=1

固件說明

IC接口初始化

每當使能IC模塊時,SCL和SDA必須配置為漏極開路。此配置是IC通信正常運行所必需的。由于IC是GPIO端口的替代功能,固件必須確保在初始化期間禁用SCL和SDA輸入上的上拉(通過將零寫入該端口控制器輸出位)。

該示例具有 250kHz 時鐘頻率。首先,需要在MAX2990中設置IC接口,如下所示:

PO1_bit.Bit2 = 0; 		// Disables the GPIO function of the
PO1_bit.Bit3 = 0; 		// I2C pins

I2CCN_bit.I2CEN = 0; 	// Makes sure that I2C is disabled
			// to allow the changing of the I2C settings

I2CCN_bit.I2CMST = 1; 		// Sets the I2C engine to master mode
I2CCN_bit.I2CEA = 0; 		// 7-bit address mode
I2CCK_bit.I2CCKL = 0x40; 	// 2μs CLK-low, to define I2C frequency
I2CCK_bit.I2CCKH = 0x40; 	// 2μs CLK-high, to define I2C frequency

I2CTO = 200; 		// I2C_TIMEOUT
I2CST = 0x400; 		// Resets I2C status register

I2CCN_bit.I2CEN = 1; 		// Enables the I2C engine

寫入模式

要寫入 24C04 EEPROM,必須通過 IC 接口寫入以下字節:

IC EEPROM 的地址(在本例中0xA0)

EEPROM 中存儲器位置的地址

數據字節(地址將自動增加)

在此示例中,我們嘗試從位置0x00開始將以下字節寫入EEPROM:0x12,0x34,0x56,0x78和0x90。

i2c_init_write(); 	// Sets the MAX2990 I2C Engine into write mode
i2c_write(0x50); 	// 24C04 write (adr = 0b1010 000 0) = 0xA0
			// The MAX2990 I2C engine shifts the I2C address by
			// 1 bit, because it will generate the R/W bit
			// automatically

i2c_write(0x00); 	// word address location
i2c_write(0x12); 	// data1
i2c_write(0x34); 	// data2
i2c_write(0x56); 	// data3
i2c_write(0x78); 	// data4
i2c_write(0x90); 	// data5
I2C_STOP; 		// Sends I2C stop-condition

poYBAGO_Zw2AcV04AAArexTx28c660.gif?imgver=1

閱讀模式

為了回讀數據,我們從EEPROM寫入。重要的是,我們要給 24C04 足夠的時間來編寫。這通常需要在“停止條件”后的幾毫秒內。請查閱IC的數據手冊,確保使用正確的時序。

i2c_init_write(); 	// Sets the MAX2990 I2C engine into write mode
i2c_write(0x50); 	// 24C04 write (adr = 0b1010 000 0) = 0xA0
			// The MAX2990 I2C engine shifts the I2C address by
			// 1 bit, because it will generate the R/W bit
			// automatically

i2c_write(0x00); 	// word address location

i2c_init_read(); 	// Sets the MAX2990 I2C engine into read mode

i2c_write(0x50); 	// 24C04 read (adr = 0b1010 000 1) = 0xA1
			// The MAX2990 I2C engine shifts the I2C address by
			// 1 bit, because it will generate the R/W bit
			// automatically

unsigned char data[5]; 		// Array to store the received data
i2c_read(data[0]); 		// Reads 1 byte from I2C and writes it to the array
i2c_read(data[1]); 		// Reads 1 byte from I2C and writes it to the array
i2c_read(data[2]); 		// Reads 1 byte from I2C and writes it to the array
i2c_read(data[3]); 		// Reads 1 byte from I2C and writes it to the array
i2c_read(data[4]); 		// Reads 1 byte from I2C and writes it to the array
I2C_STOP; 			// Sends I2C stop-condition

現在我們檢查以下用于讀取和寫入EEPROM的函數。

i2c_init_write(void)
i2c_init_read(void)
i2c_write(UINT8 data)
i2c_read(UINT8 *data)

pYYBAGO_ZxCAErhmAABO0Okhm0E415.gif?imgver=1

void i2c_init_write(void)
{
I2CCN_bit.I2CMODE = 0; 	// I2C transmit mode
I2CCN_bit.I2CACK = 1; 	// Creates I2C NACK so that slave can create ACK
I2C_START; 		// Generates I2C START condition
while( I2CCN_bit.I2CSTART == 1 ); 	// Waits until the START condition
					// was put to the I2C bus
I2CST_bit.I2CSRI = 0; 			// Resets the I2C interrupt flag
}

int i2c_init_read(void)
{
I2CCN_bit.I2CMODE = 1; 	// I2C read-mode
I2CCN_bit.I2CACK = 0; 	// Creates I2C ACK after receive
I2C_START; 		// Generates I2C START condition

while( I2CCN_bit.I2CSTART == 1 ); 	// Waits until the START condition
I2CST_bit.I2CSRI = 0; 			// Resets the I2C interrupt flag
}

void i2c_write(UINT8 data)
{
I2CBUF = data; 				// Puts the data on the I2C bus
while( I2CST_bit.I2CTXI == 0 ); 	// Waits for transfer complete
I2CST_bit.I2CTXI = 0; 			// Resets the I2C transmit complete
					// interrupt flag
}

void i2c_read(UINT8 *data)
{
I2CBUF = 0xff; 		// Puts "all ones" on the I2C bus so that slave can pull
			// the bus down to generate zeros

while( !I2CST_bit.I2CRXI ); 		// Waits for receive complete
I2CST_bit.I2CRXI=0; 			// Resets the I2C receive complete
					// interrupt flag

*data = I2CBUF; 			// Writes the data to the pointer
}

審核編輯:郭婷

聲明:本文內容及配圖由入駐作者撰寫或者入駐合作網站授權轉載。文章觀點僅代表作者本人,不代表電子發燒友網立場。文章及其配圖僅供工程師學習之用,如有內容侵權或者其他違規問題,請聯系本站處理。 舉報投訴
  • 調制解調器
    +關注

    關注

    3

    文章

    860

    瀏覽量

    38940
  • 總線
    +關注

    關注

    10

    文章

    2903

    瀏覽量

    88397
  • 代碼
    +關注

    關注

    30

    文章

    4827

    瀏覽量

    69054
收藏 人收藏

    評論

    相關推薦

    LTC2990-I2C溫度、電壓和電流監視器

    LTC2990描述 LTC®2990用于監視系統溫度、電壓和電流。該器件可通過I2C串行接口進行配置,以測量內部溫度、遠端溫度、遠端電壓、
    發表于 12-09 16:06 ?4175次閱讀

    MAX2990 pdf

    The MAX2990 power line communication (PLC) base- band modem delivers a cost-effective
    發表于 06-30 13:41 ?87次下載

    AN979使用手冊,I2C™串行EEPROM與P

    AN979使用手冊,I2C™串行EEPROM與PIC18器件接口設計 Microchip Technology 的24LCXXB串行EEPROM器件與
    發表于 03-04 11:09 ?16次下載

    MAX2990 Integrated Power-Line

    This programming manual describes the chip architecture and programming capabilities of the MAX2990
    發表于 07-24 12:09 ?16次下載

    如何通過MAX2990 I2C接口標準EEPROM (24

      引言   本文介紹了如何通過MAX2990電力線通信調制解調器的
    發表于 10-22 11:32 ?1519次閱讀
    如何通過<b class='flag-5'>MAX2990</b> <b class='flag-5'>I2C</b><b class='flag-5'>接口</b>向<b class='flag-5'>標準</b><b class='flag-5'>EEPROM</b> (24

    使用硬件模塊實現8051 MCU與I2C?串行EEPROM接口

    本文檔內容介紹了基于使用硬件模塊實現8051 MCU與I2C串行EEPROM接口,供參考
    發表于 03-29 15:03 ?1次下載

    I2C串行EEPROM與PIC18器件接口設計的詳細中文資料概述

    Microchip Technology的24LCXXB串行EEPROM器件與 I2C? 兼容,支持標準的 100 kHz 和 400 kHz 快速模式。當設計中采用串行 EEPROM
    發表于 06-29 10:25 ?12次下載
    <b class='flag-5'>I2C</b>串行<b class='flag-5'>EEPROM</b>與PIC18器件<b class='flag-5'>接口</b>設計的詳細中文資料概述

    STM32F10x _硬件I2C讀寫EEPROM(標準外設庫版本)

    STM32F10x_硬件I2C讀寫EEPROM(標準外設庫版本)
    的頭像 發表于 03-25 11:11 ?1w次閱讀
    STM32F10x _硬件<b class='flag-5'>I2C</b>讀寫<b class='flag-5'>EEPROM</b>(<b class='flag-5'>標準</b>外設庫版本)

    使用MSSP模塊進行I2C串行EEPROM與PIC16器件的接口設計

    使用MSSP模塊進行I2C串行EEPROM與PIC16器件的接口設計說明。
    發表于 05-11 10:14 ?16次下載

    使用MSSP模塊進行I2C串行EEPROM與PIC18器件的接口設計

    使用MSSP模塊進行I2C串行EEPROM與PIC18器件的接口設計說明。
    發表于 05-11 10:23 ?11次下載

    I2C串行EEPROM與PICmicro單片機的接口設計

    I2C串行EEPROM與PICmicro單片機的接口設計說明。
    發表于 05-11 10:24 ?7次下載

    如何使用 MAX2990 I2C 接口編寫工業標準 EEPROM (24C04)

    發表于 11-17 12:42 ?0次下載
    如何使用 <b class='flag-5'>MAX2990</b> <b class='flag-5'>I</b>2<b class='flag-5'>C</b> <b class='flag-5'>接口</b><b class='flag-5'>編寫</b><b class='flag-5'>工業</b><b class='flag-5'>標準</b> <b class='flag-5'>EEPROM</b> (24<b class='flag-5'>C</b>04)

    如何使用I2C EEPROM

    電子發燒友網站提供《如何使用I2C EEPROM.zip》資料免費下載
    發表于 02-03 09:53 ?0次下載
    如何使用<b class='flag-5'>I2C</b> <b class='flag-5'>EEPROM</b>

    EEPROM接口的選擇方法

    接口的選擇方法 EEPROM的常規接口有3個分別是Microwire和SPI與I2C。 這些接口各自具有技術特點。 請選擇符合客戶需求的
    的頭像 發表于 07-12 17:37 ?1521次閱讀

    CW32單片機I2C接口讀寫EEPROM芯片介紹

    CW32單片機I2C接口讀寫EEPROM芯片介紹
    的頭像 發表于 11-09 17:42 ?1154次閱讀
    CW32單片機<b class='flag-5'>I2C</b><b class='flag-5'>接口</b>讀寫<b class='flag-5'>EEPROM</b>芯片介紹
    主站蜘蛛池模板: 在线成人精品国产区免费 | 中日韩免费视频 | 日本黄色免费在线 | 能看的黄网 | 亚洲第一成网站 | 日本sese| 色国产视频 | 天天干天天爱天天射 | 中文字幕在线播放一区 | 久久精品国产精品亚洲婷婷 | 丁香花在线电影小说观看 | 欧美成人精品一区二区 | 免费看黄视频网站 | 午夜一区二区三区 | 亚洲婷婷国产精品电影人久久 | 台湾一级毛片 | 久久精品午夜视频 | 久99频这里只精品23热 视频 | 丁香花在线影院观看在线播放 | 国产高清在线精品一区 | 久久亚洲精选 | 伊人色综合久久天天爱 | 38pao强力打造永久免费高清视频 | 求av网址 | 羞涩妩媚玉腿呻吟嗯啊销魂迎合 | 可以直接看的黄色网址 | 伊人天伊人天天网综合视频 | 国产理论最新国产精品视频 | 女人本色高清在线观看wwwwww国产 | 日鲁夜鲁鲁狠狠综合视频 | 天天想夜夜操 | 久久久www免费人成看片 | 天天色天天色天天色 | 黄色1级视频 | 大量喷潮free| 日本janpanese护士bus中国 | 在线精品国产成人综合第一页 | 国产呦在线观看视频 | 国产亚洲一区二区在线观看 | 天天综合网站 | 成色网 |