iic33f

所属分类:DSP编程
开发工具:C/C++
文件大小:18KB
下载次数:4
上传日期:2009-10-07 17:08:06
上 传 者dale39
说明:  DSPIC33FIIC源程序码。谢谢了哟。
(DSPIC33FIIC source code. Thank you in yo.)

文件列表:
CE145_I2C_Slave\h (0, 2007-10-05)
CE145_I2C_Slave\h\I2CSlaveDrv.h (3204, 2007-10-05)
CE145_I2C_Slave\I2CSlaveDemo.mcp (1052, 2007-10-05)
CE145_I2C_Slave\I2CSlaveDemo.mcw (958976, 2007-10-05)
CE145_I2C_Slave\src (0, 2007-10-05)
CE145_I2C_Slave\src\I2CSlaveDrv.c (5094, 2007-10-05)
CE145_I2C_Slave\src\Main.c (4353, 2007-10-05)
CE145_I2C_Slave (0, 2007-10-05)

Readme File for Code Example: CE145 - Using I2C module as Slave device --------------------------------------------------- This file contains the following sections: 1. Code Example Description 2. Folder Contents 3. Suggested Development Resources 4. Reconfiguring the project for a different dsPIC33F device 5. Hardware Details: 6. Revision History 1. Code Example Description: ---------------------------- This code example shows how to use I2C module in slave mode. To demonstrate it, dsPIC33FJ is used as I2C slave device. The master I2C device uses the slave I2C device as RAM. Thus master I2C device can read/write particular RAM area of I2C slave device. 2. Folder Contents: ------------------- This folder contains the following sub-folders: a. C:\Program Files\Microchip\MPLAB C30\support\gld This folder will have the device GLD file, it is used for building the project. This file was provided with the MPLAB C30 v3.01 toolsuite. b. C:\Program Files\Microchip\MPLAB C30\support\h This folder contains C header files useful in building this project. Device register and bit definitions are provided in the *.h file that follows the device name. These files were provided with the MPLAB C30 v3.01 toolsuite. c. C:\Program Files\Microchip\MPLAB C30\lib This folder contains library archive files, which are a collection of precompiled object files. The file named "libpic30-coff.a" contains the C run-time start-up library. These file were provided with the MPLAB C30 v3.01 toolsuite.Not used in this code example. d. HEX This folder contains three file types - coff, hex and map. These are files generated by the MPLAB C30 v3.01 toolsuite on build operation performed within MPLAB IDE. The *.map file contains details on memory allocation for various variables, constants and dsPIC instructions specified in the source and library code. The *.hex file contains a binary file that may be programmed into the dsPIC device. The *.coff file contains a binary file that is used by MPLAB IDE for simulation. You will see I2CSlaveDemo.hex, I2CSlaveDemo.cof & I2CSlaveDemo.map file. e. H There is a I2CSlaveDrv.h file. This header file defines function prototype and variables. The variables are defined as "extern" so it can be accessed from any other source file. f. SRC This folder contains all the C and Assembler source files (*.c) used in demonstrating the described example. You will see Main.c & I2CSlaveDrv.c files. The I2CSlaveDrv.c file contains required routines for handling I2C slave demonstration. g. OBJ This folder contains *.Obj files which are compiled object files generated when the project is built. You will find I2CSLVDRV.obj & Main.obj files. 3. Suggested Development Resources: ----------------------------------- a. MPLAB IDE v7.60 or later b. MPLAB C30 v3.0 or later c. MPLAB ICD2/RealICE e. Explorer 16 Demo board with dsPIC33FJ256GP710 DSC 4. Reconfiguring the project for a different dsPIC33F device: ------------------------------------------------------------- The Project/Workspace can be easily reconfigured for any dsPIC33F device. Please use the following general guidelines: a. Change device selection within MPLAB IDE to a dsPIC33F device of your choice by using the following menu option: MPLAB IDE>>Configure>>Select Device b. Provide the correct device linker script and header file for your device. Device linker scripts and header files are available in your MPLAB C30 installation folder under: Device Linker Script- YourDrive:>Program Files\Microchip\MPLAB C30\support\gld Device C Header file- YourDrive:>Program Files\Microchip\MPLAB C30\support\h c. Provide the appropriate path to your MPLAB C30 support file locations using the menu option: MPLAB IDE>>Project>>Build Options>>Project d. Re-build the MPLAB project using the menu option: MPLAB IDE>>Project>>Build All f. Download the hex file into the device and run. Note: If you are using MPLAB IDE for configuration register settings then make sure you have done all the required configuration settings in case you have selected device other than dsPIC33FJ256GP710.This project has set required configuration register settings in the code itself(Main.c) 5. Hardware Details: ------------------- Crystal Used: 7.37 MHz Explorer16 Development Board REV5(DM240001) There is no pull up resistors on SCL1/SDA1 lines in Explorer16 Development Board. So you have to connect pull up resistor externally. I2C Slave Implementation: This code example is written to show how to use I2C module in salve mode. A master I2C device communicates with I2C slave (dsPIC33FJ) device. For master I2C device, dsPIC33FJ acts as RAM. Thus we have define an array of 256 bytes which is used to store data coming from master I2C device. The master device will do following with I2C slave device: Refer Microchip's 24LC08B serial EEPROM for details on write/read operation. 1)It writes a byte to I2C slave device. Protocol used (similar to I2C serial EEPROM) I2C Slave Address (Write Operation) + RAM address to be written + Data to be written 2) It reads I2C slave device. Protocol used (similar to I2C serial EEPROM): I2C Slave Address (Write Operation) + RAM address to be read + Repeated Start Condition + I2C Slave Address (Read operation) + Data sent to master device by slave device 6. Revision History: --------------------- Pinakin K.Makwana 09/02/2007 Initial Revision

近期下载者

相关文件


收藏者