- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello everybody,
I am trying to blink a led using a timer. My configuration is very simple:
On timer component
clock: 32Khz
period: 32000
trigger mode: node
capture:
enable mode: software
run mode: continuous.
The problem is that after uploading the led lights but is not blinking.
Here is the c code:
The commented lines is what i tried. Thank you in advance.
/* ========================================
*
* Copyright YOUR COMPANY, THE YEAR
* All Rights Reserved
* UNPUBLISHED, LICENSED SOFTWARE.
*
* CONFIDENTIAL AND PROPRIETARY INFORMATION
* WHICH IS THE PROPERTY OF your company.
*
* ========================================
*/
#include "project.h"
int array[4]={1,2,4,8};
volatile _Bool state=0;
CY_ISR(TMR_ISR_HANDLER){
if(state==1){
state=0;
LED_1_Write(1);
}
else{
state=1;
LED_1_Write(0);
}
//TMR_WritePeriod(32000);
//TMR_Stop();
//TMR_WritePeriod(5000);
//TMR_Start();
};
int main(void)
{
CyGlobalIntEnable; /* Enable global interrupts. */
TMR_ISR_StartEx(TMR_ISR_HANDLER);
TMR_Start();
/* Place your initialization/startup code here (e.g. MyInst_Start()) */
for(;;)
{
/* Place your application code here. */
}
}
/* [] END OF FILE */
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You did not clear the interrupt in the TMR component. Depending on what kind of timer you use (UDB or TCPWM) you need to read the TMR status or explicitly clear the interrupt in your handler.
Next time will you please post your complete project so that we all can have a look at all of your settings. To do so, use
Creator->File->Create Workspace Bundle (minimal)
and attach the resulting file.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You did not clear the interrupt in the TMR component. Depending on what kind of timer you use (UDB or TCPWM) you need to read the TMR status or explicitly clear the interrupt in your handler.
Next time will you please post your complete project so that we all can have a look at all of your settings. To do so, use
Creator->File->Create Workspace Bundle (minimal)
and attach the resulting file.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you it works!!!!
Forgot about it.
I will attach the complete code next time.