CE017_DataEEPROM

所属分类:DSP编程
开发工具:Visual C++
文件大小:22KB
下载次数:13
上传日期:2015-06-05 08:56:40
上 传 者wangzhiheng232
说明:  dspic的EEPROM的读取以及擦除,已经经过实际项目的验证,绝对ok,开发环境一定要mplab3.3版本,低版本会编译出错
(read dspic of EEPROM, and erase the actual project has been proven, absolutely ok, the development environment must mplab3.3 version, low version will compile error)

文件列表:
CE017_DataEEPROM_write_erase_functions_110907 (0, 2014-10-26)
CE017_DataEEPROM_write_erase_functions_110907\CE017_DataEEPROM_write_erase_functions (0, 2014-10-26)
CE017_DataEEPROM_write_erase_functions_110907\CE017_DataEEPROM_write_erase_functions\CodeExample.mcp (809, 2007-11-09)
CE017_DataEEPROM_write_erase_functions_110907\CE017_DataEEPROM_write_erase_functions\CodeExample.mcs (75, 2014-10-26)
CE017_DataEEPROM_write_erase_functions_110907\CE017_DataEEPROM_write_erase_functions\CodeExample.mcw (84992, 2014-10-26)
CE017_DataEEPROM_write_erase_functions_110907\CE017_DataEEPROM_write_erase_functions\hex (0, 2015-06-05)
CE017_DataEEPROM_write_erase_functions_110907\CE017_DataEEPROM_write_erase_functions\src (0, 2014-10-26)
CE017_DataEEPROM_write_erase_functions_110907\CE017_DataEEPROM_write_erase_functions\src\hex (0, 2015-06-05)
CE017_DataEEPROM_write_erase_functions_110907\CE017_DataEEPROM_write_erase_functions\src\main_DataEEPROM_access.c (4467, 2007-11-09)
CE017_DataEEPROM_write_erase_functions_110907\CE017_DataEEPROM_write_erase_functions\src\main_DataEEPROM_access.o (48169, 2007-11-09)

Readme File for Code Example: CE017 - Reading, Erasing and Writing to dsPIC30F Data EEPROM ------------------------------------------------------------- This file contains the following sections: 1. Code Example Description 2. Folder Contents 3. Suggested Development Resources 4. Reconfiguring the project for a different dsPIC30F device 5. Revision History 1. Code Example Description ----------------------------- Many dsPIC30F devices in the dsPIC Digital Signal Controller products feature internal or on-chip Data EEPROM (Electrically Erasable Programmable Read Only memory). MPLAB C30 (v3.01 and later) provides library routines to read, erase or write one word or one row of internal Data EEPROM in dsPIC30F devices. To use these functions, simply include the header file libpic30.h in the C source file. Function prototypes are defined in the header file and reproduced here for convenience. Source code for the library functions is available in MPLAB C30\src\pic30\eedata_helper.s. This file contains full documentation on how to call the library functions from assembly language. How to specify an address in Data EEPROM: ----------------------------------------- MPLAB C30 defines a type _prog_addressT which is used to represent an address in Data EEPROM or Flash. The following example shows how to create and initialize a variable of this type: _prog_addressT EE_addr; _init_prog_address(EE_addr, ArrayinEE); How to copy memory from Data EEPROM to RAM: ------------------------------------------- The _memcpy_p2d16() function is used to copy data from program memory (where Data EEPROM is located) to data memory: _prog_addressT _memcpy_p2d16(void *dest, _prog_addressT src, unsigned int len); Parameters Definition: dest: is the address of the destination RAM location or array src: is the source address in EPROM len: is the number of bytes to copy Return Value: Function returns an updated source address, which can be used for sequential copy operations. In this example the return value is ignored. How to erase Data EEPROM memory: -------------------------------- The _erase_eedata() function is used to erase a word or row of Data EEPROM, while _erase_eedata_all() is used to erase the entire range of memory. The erase operation requires time to complete, during which execution may continue. The _wait_eedata() function can be used to delay execution until the operation is complete: void _erase_eedata(_prog_addressT dst, int len); void _erase_eedata_all(); void _wait_eedata(); Parameters Definition: dst: is the address of Data EEPROM memory to erase len: is the number of bytes to erase and is the value _EE_WORD or _EE_ROW (these constants are defined in libpic30.h); How to write Data EEPROM memory: -------------------------------- The _write_eedata_row() and _write_eedata_word() functions are used to write Data EEPROM memory. The write operation requires time to complete, during which execution may continue. The _wait_eedata() function can be used to delay execution until the operation is complete: void _write_eedata_row(_prog_addressT dst, int *src); void _write_eedata_word(_prog_addressT dst, int dat); void _wait_eedata(); Parameters Definition: dst: is the address of the destination in Data EEPROM memory src: is the address of the source RAM array dat: is the 16 bit data value 2. Folder Contents: ------------------- This folder contains the following sub-folders: a. gld This folder contains a linker script file for the example project. This file is used for building the project for a 30F6014A device. This file simply includes the relevant device linker script, "p30F6014A.gld" and the relevant MPLAB C30 library files, "libdsp-coff.a", "libc-coff.a", and "libm-coff.a" or "libdsp-elf.a", "libc-elf.a", and "libm-elf.a" from their installed location. b. h This folder contains C header files useful in building this project. The folder is empty because "libpic30.h" may be found in the installation folder of the MPLAB C30 toolsuite. c. hex This folder contains three file types - coff, hex and map. These are files generated by the MPLAB C30 toolsuite on build operation performed within MPLAB IDE. The *.map file contains details on memory allocation for various variables, constants and dsPIC30F instructions specified in the source and library code. The *.hex file contains a binary file that may be programmed into the dsPIC30F device. The *.coff file contains a binary file that is used by MPLAB IDE for simulation. d. src This folder contains all the C and Assembler source files (*.c, *.s) used in demonstrating the described example. 3. Suggested Development Resources: ----------------------------------- a. dsPICDEM 1.1 Development Board (See below) b. dsPIC30F6014A Digital Signal Controller Plug-In Module (See below) 4. Reconfiguring the project for a different dsPIC30F device: ------------------------------------------------------------- The Project/Workspace can be easily reconfigured for any dsPIC30F device. Please use the following general guidelines: a. Change device selection within MPLAB IDE to a dsPIC30F 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 Device ASM Include file- YourDrive:>Program Files\Microchip\MPLAB C30\support\inc c. Provide the appropriate path to your MPLAB C30 support file locations using the menu option: MPLAB IDE>>Project>>Build Options>>Project d. Chose the development board applicable to your device. Some options are provided below: - dsPICDEM 2 Development Board supports: 30F2010, 30F2011, 30F2012, 30F3010, 30F3011, 30F3012, 30F3013, 30F3014, 30F4011, 30F4012, 30F4013 - dsPICDEM 1.1 Development Board supports: 30F5013, 30F6010, 30F6011, 30F6012, 30F6013, 30F6014, 30F6011A, 30F6012A, 30F6013A, 30F6014A - dsPICDEM MC1 Development Board supports: 30F6010, 30F6010A, 30F5016 e. Re-build the MPLAB project using the menu option: MPLAB IDE>>Project>>Build All f. Download the hex file into the device and run. 5. Revision History : --------------------- 11/02/2005 - Initial Release of the Code Example 10/18/2007 - Revised to Use New Library Functions

近期下载者

相关文件


收藏者