While problem
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-03-14 11:53 AM
While problem
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-05-17 5:27 AM
Is the variable delay_main is of volatile type ?
__IO uint32_t delay_main;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-05-17 5:27 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-05-17 5:27 AM
do I miss something here ?
Define it as volatile so the compiler doesn't optimize it to an infinite loop. ie it changes outside the context of the current routine.Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-05-17 5:27 AM
Thank you
is not unsigned int a volatile ? since I define it under the include headers directly . where can I fine the type of definisions for keil for the new lib 3.4 ?- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-05-17 5:27 AM
is not unsigned int a volatile ? since I define it under the include headers directly .
No, being external or publically defined is not the same as being volatile, which infers that it might change between different reads. Like a hardware register, or interrupt incremented counter. volatile unsigned int delay_main;Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-05-17 5:27 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-05-17 5:27 AM
sorry I am back with new question , exuce me I am new to cortex m3 and STM
my system coreclock is 72Mhz , I want the system tike inturrept every 5ms so how can I calculate this what is the formula? what is the relation between tick and ms? if(SysTick_Config(SystemCoreClock / x) ) // 5ms interrupts x=? the formula please . Thank you- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-05-17 5:27 AM
what is the relation between tick and ms? what is the diffrent between static and volatile in this case ?
1/1000 th of a second is 1ms, x = 1000 5ms period is 1000/5 thus x = 200, ie 5/1000 th of a second or 1/200 th of a second. Measured in 72 MHz cycles, where 72000000 cycles per second 72000 cycles per millisecond, and 360000 cycles per 5 milliseconds. A static is invisible outside the current object file. You should use volatile if the value changes independent of program flow. ie in an interrupt. If you call a subroutine it is assumed variables will change. You could also turn off optimization, and then the compiler wouldn't hold variables in registers, or reduce loops.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-05-17 5:27 AM
Thank you alot Clive
if(SysTick_Config(SystemCoreClock / 360000) ) // 5ms interrupts
returns an error that cant load it ; any solution for 5ms interrupt? I am using the new library 3.4. Regards