- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am starting to add several internal software timers to a psoc4 design starting on the cykit-049 (most will probably be 1 sec decrement values but some could be minutes) . Can someone give me some advise on best path. I have declared a static volatile uint8 in main as global and also inside of the SysTick_interrupt_timer with a clean compile. However when I decrement the var in the systick it obviously doesn't decrement in main. Should I be using extern since SysTick is a separate file?
At some point I will be adding a WDT so maybe I need advice to move away from SysTick and into a WDT type interrupt but I still am confused on how to make a global in main visitable and modifiable in an interrupt routine such as SysTick. Is there an example that would help me understand this shared variable concept ?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
A global variable declared in main.c is global and can be accessed from other modules when declared as extern. When you declare it again in a different file it will be a second variable that just happens to have the same name as that in main.c.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please post your current code by clicking on file in Psoc Creator then click on create workspace bundle so we can check your code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
A global variable declared in main.c is global and can be accessed from other modules when declared as extern. When you declare it again in a different file it will be a second variable that just happens to have the same name as that in main.c.
Bob