CE143_Timer_Period_14aug09

所属分类:单片机开发
开发工具:C/C++
文件大小:56KB
下载次数:10
上传日期:2011-11-07 15:38:55
上 传 者yaotiger
说明:  PIC单片机演示怎么使用定时器1定时循环产生中断
(This Code example gives a demonstration of how to use the Timer1 for Period Interrupts)

文件列表:
CE143_Timer_Period\CE_T1_PERIOD_INTERRUPT.mcp (1129, 2009-08-13)
CE143_Timer_Period\CE_T1_PERIOD_INTERRUPT.mcw (8944128, 2009-08-13)
CE143_Timer_Period\src (0, 2009-08-14)
CE143_Timer_Period\src\init_timer1.c (3362, 2007-09-11)
CE143_Timer_Period\src\main.c (4449, 2007-09-12)
CE143_Timer_Period (0, 2009-08-14)

Readme File for Code Example: CE143 - Using Timer1 for Period Interrupts --------------------------------------------------- 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. Revision History 1. Code Example Description: ---------------------------- a. This Code example gives a demonstration of how to use the Timer1 for Period Interrupts . b. When ever the Timer1 register is equal to the Period Register the Timer1 generates a Interrupt and Toggels the PORTA.1 bit of the PORTA i:e D4 LED on Explorer 16 . c. In order to configure the Period Value Configure the PR1 register in the init_timer1.c file. d. This code examples uses the value of M as 38 and N1 and N2 as 2 so and the External Crystal Frequency as 8 Mhz . In Case you are using the Externel Crystal value more then 8 Mhz you have to reconfigure the values of M ,N1,N2 (any one of them will also do) so that the Processore runs at or below 40MIPS otherwise the processor will run above 40MIPS and unexpected results may occur. Example: If using External Crystal of 8Mhz M1=40,N1=N2=2 then Fosc=80 Mhz and Fcy= 40Mhz External Crystal = 12Mhz M1=24,N1=N2=2 then Fosc=74Mhz and Fcy=37Mhz e. It is recommended to start thr processor on a clock without PLL and then enter the values to the PLL register and then switch to PLL mode . The same is being followed in this code. f. Init_timer1.c--------For Initialization of Timer1 for Period Interrupt g. Switch.s-------------For Switching from the non PLL mode to PLL mode with XT mode h. main.c---------------Main Application running in the code. 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 v2.02 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 v2.02 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 v2.02 toolsuite. d. 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 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. e. h This folder contains include files for the code example. f. src This folder contains all the C and Assembler source files (*.c, *.s) used in demonstrating the described example. This folder also contains a sub-folder named "obj" that stores compiled object files generated when the project is built. 3. Suggested Development Resources: ----------------------------------- a. MPLAB IDE v7.50 or later b. MPLAB C30 v3.00 or later c. MPLAB ICD 2 R23 or later d. MPLAB REAL ICE e. Explorer 16 Demo board with dsPIC33FJ256GP710 controller/PIC24H Controller. 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 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: 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 : ---------------------

近期下载者

相关文件


收藏者