资源简介
用于DSP 6713的i2c访问代码
对于初学者是非常实用的例子哦
代码片段和文件信息
/*********************************************************************************
* DEC6713_EEPROM.C ver1.0 *
* Copyright 2008 by Hunan Geoson Hi-Tech Ltd.
* All rights reserved. Property of Hunan Geosun Hi-Tech Ltd. *
* Write by: Zhili.Zeng
* Email: zzl290@163.com *
*********************************************************************************/
/*********************************************************************************
Program for test I2C module.
Bit Polling Mode.
Writting and reading operation on I2C device.
*********************************************************************************/
#define I2C_SLAVE_ADDRESS 0x50 //Set slave address of i2c device
//#define I2C_DataLen 4 //The number of bytes you access a time
#include “i2c.h“
#include //Used only for debug
unsigned short I2C_Add=0x0020; //The memory address to be accessed
unsigned char I2C_DataLen = 4; //The number of bytes you access a time
unsigned char I2C_DataSend[4] = {0x000xaa0x550xff};//The data to be write
unsigned char I2C_DataRec[4] = {0000}; //The data you read
unsigned char I2C_ByteSend =0x55; //The byte to be write
unsigned char I2C_ByteRec =0; //The byte you read
/*********************************************************************************
******************************* This is a example. *******************************
***You may modify the value of I2CPSC\I2CCLKH\I2CCLKL in I2C_Init() before use.***
****These registers are used to set data transfer ratefrom 10kbps to 400kbps.****
*********************************************************************************/
main()
{
unsigned int j;
I2C_Init();
//Write or read more than one byte a time.
I2C_WriteData(0I2C_DataSendI2C_DataLen);
printf(“\nWrite data is over.“);
printf(“\nThe Data you write is %x%x%x%x“I2C_DataSend[0]I2C_DataSend[1]I2C_DataSend[2]I2C_DataSend[3]);
I2C_ReadData(0I2C_DataRecI2C_DataLen);
printf(“\nReading data is over.“);
printf(“\nThe Data you read is %x%x%x%x“I2C_DataRec[0]I2C_DataRec[1]I2C_DataRec[2]I2C_DataRec[3]);
//Write or read one byte a time.
I2C_WriteByte(0x0200&I2C_ByteSend);
printf(“\nReading data is over.“);
printf(“\nThe byte you write is %x“I2C_ByteSend);
I2C_ReadByte(0x0200&I2C_ByteRec);
printf(“\nReading data is over.“);
printf(“\nThe byte you read is %x“I2C_ByteRec);
for(j=0;j<200000;j++);
// while(1);
}
/*********************************************************************************
End of DEC6713_EEPROM.C
*********************************************************************************/
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 453 2008-07-23 10:25 i2c\cc_build_Debug.log
文件 12784 2008-07-23 10:25 i2c\Debug\i2c.map
文件 8638 2008-07-23 10:25 i2c\Debug\i2c.obj
文件 55749 2008-07-23 10:25 i2c\Debug\i2c.out
文件 2740 2008-07-23 10:25 i2c\Debug\vecs.obj
文件 298 2008-07-23 10:25 i2c\Debug.lkf
文件 298 2008-07-23 10:25 i2c\Debug.lkv
文件 13284 2004-12-01 16:05 i2c\DEC6713.gel
文件 2780 2008-07-23 10:25 i2c\i2c.c
文件 1078 2004-11-22 11:03 i2c\i2c.cmd
文件 8143 2008-07-23 10:22 i2c\i2c.h
文件 1535 2008-07-23 10:25 i2c\i2c.paf
文件 889 2008-07-23 10:23 i2c\i2c.pjt
文件 3628 2004-11-22 11:03 i2c\vecs.asm
目录 0 2009-02-13 23:24 i2c\Debug
目录 0 2008-07-22 08:43 i2c\include
目录 0 2009-02-13 23:24 i2c
----------- --------- ---------- ----- ----
112297 17
- 上一篇:ginger premium
- 下一篇:基于labview的AD转换
相关资源
- 基于STM32实现的模拟I2C
- Arduino LiquidCrystal_I2C库
- I2C slaver 从机 Verilog代码实现
- i2c_master verilog源码与testbench
- 模拟I2C读写24C256和24C02
- I2C Master
- I2C总线规范V2.1中文版
- atsha204 认证程序基于I2C通信
- 24C01C/24C02C/24LC01B中文资料 I2C串行EEP
- STM32F103+VL53L0源代码.zip
- 串口/I2C调试工具
- Intel SoC处理器的I2C总线IP核设计与应用
- dw_apb_i2c_db.pdf
- DesignWare DW_apb_i2c Databook
- SMBUS1.1 SMBUS110 中文注释版
- LSM6DSL I2C总线驱动
- cw2015_battery 电池检测芯片 I2C
- I2C读写AT24C02 基于STM32F103 cube
- arduion库文件LiquidCrystal_I2C.rar
- ST TOF测距传感器 适用于stm32f103系列,
- stm32 gpio模拟i2c_slave
- 28335读写I2CEEPROM的例程
- STM32 I2C例程
- PMBUS规范总结.docx
- sony imx290 driver
- STM32F10x_模拟I2C读写EEPROM综合版切换
- 应用层读写取i2c设备代码可读写8位,
- i2c-tools-3.1.0
- i2c-tools-3.0.1 linux上调试i2c的工具 源码
- i2c总线最易懂最易学的使用说明
评论
共有 条评论