| Electronic Components Datasheet Search |
|
AN2165 Datasheet(PDF) 14 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
AN2165 Datasheet(HTML) 14 Page - STMicroelectronics |
|
14 / 18 page ![]() Application example: interrupt handling AN2165 14/18 2 Application example: interrupt handling This section describes a simple ST10F27x software example making use of the interrupts. The application uses Timers’ overflow interrupts to generate two square signals with different frequencies on two standard port pins: P2.0 & P2.1. The project contains 3 source files: ● Timer.c: It contains c source code for the following project routines – Configure_GPT1_Timer_2(): In this routine, GPT1 Timer 2 is set up to operate in Timer mode and is configured to generate an interrupt every 1.678 seconds. – Configure_GPT1_Timer_3(): In this routine, GPT1 Timer 3 is set up to operate in Timer mode and is configured to generate an interrupt every 104.8 milliseconds. – Timer 2 and Timer 3 interrupts’ definitions: Timer 2 interrupt is toggling P2.0 while Timer 3 interrupt is toggling P2.1. ● Timer.h: It contains Timer.c routines prototypes. ● main.c: It uses the routines described in Timer.c in order to start the two timer overflow interrupts. Timings suppose that the chip is operating at a frequency of 40 Mhz. The environment has been setup as described in the first chapter. For more details about the timers’ functionalities, their registers and interrupts’ handling, refer to the ST10F27x user’s manual. 2.1 Debug operation After successfully building the program: ● Select Debug -> Start / Stop Debug Session from the toolbar menu. Port 2 output signals can be displayed using the Logic Analyser feature provided by Keil. This feature is available only on simulation mode. In order to view the port 2 content, select Peripherals -> IO Ports -> Port 2 from the toolbar menu. 2.2 Logic analyser use ● Select View -> Logic Analyser Window from the toolbar menu of the debug window. ● Select Debug -> Logic Analyser from the toolbar menu ● Enter the variable that you want to visualize: Port 2 pin 0 and Port 2 pin1. ● Precise the Mask to indicate if the signal corresponds to P2.0 or P2.1. |
|
|
Link URL |
| Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Contact us | Privacy Policy | Link to Datasheet | Link Exchange | Manufacturer List All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |