资源简介
用于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转换
相关资源
- 用DIO 做的I2C程式
- I2C总线接口设计
- 8051F040SMBUS多机通信
- DHT10_I2C驱动.zip
- I2C串行EEPROM应用系统的健壮性设计
- 电子-GravityI2C3.7V锂电池电量计stm32L1
- arduino主机,stm8从机。I2C测试 。每次
- 10位ADC转换器AD5612(stm32_IO口模拟I2C)
- (带有源代码)基于FPGA的模拟I2C接口
- I2C-verilog-(非常详细的i2c学习心得)
- stm32f103iic读取AT24XX全系eeprom
- 分享一个0.96的oled显示驱动,软件模拟
- DAC8571_I2C模式_STM32
- STM32F4 I2C从机中断
- ADS1110stm32驱动自带I2C驱动
- STM32F103C8 例程
- stm32 I2C主从机模式控制代码
- 基于STM32F103硬件I2C读写24Cxx驱动代码的
- Ginkgo_USB-I2C_Classic_Setup_v2.9.2.zip
- I2C从设备接收数据verilog代码实现
- CH341-I2C-labview-应用说明+VI-所有版本都
- Delphi2CPP 和注册机
- STM32_MPU6050DMP硬件I2C读取欧拉角
- 基于FPGA的EEPROM读写系统
- 用stm32硬件I2C和模拟I2C读写EEPROM
- 利用STM32硬件I2C使用加速度传感器AD
- STM32与HTU21的I2C通讯源码
- stm32f103硬件I2C主从通信
- sht20 程序
- 黑苹果i2c触摸驱动教程
评论
共有 条评论