- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi. In my project I have one element which measure acceleration, and I get data using I2C interface.
In my program I want to get this data, and make some calculation every (for example) 100 ms. I use for this Timer with interrupt, but then the program stops working, and I can't get any data from this I2C.
I know, that there is a way to do it, but I don't know it ;(
- Labels:
-
PSoC 5LP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Just set a flag in your interrupt handler and check for it in your main-loop. Act upon accordingly.
When still stuck, post your complete project. 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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Nearly.
volatile uint8 TimerFlag = 0;
CY_ISR(Timer_Interrupt)
{
Timer_Flag = 1;
//code to clear interrupt cause of timer goes here
}
and in main:
isr_StartEx(Timer_Interrupt);
.
.
.
if(Timer_Flag)
{
readFromI2C();
TimerFlag = 0;
}
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks 😉