const uint32_t div = 1000; NOT WORKING

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

const uint32_t div = 1000; NOT WORKING

801 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by robertrau on Mon Dec 31 13:20:53 MST 2012
I have this simple function:
__INLINE static void DelayMS(uint32_t dlyTicks)
{
    uint32_t curTicks = msTicks;
    const uint32_t div = 1000;
    while( (msTicks - curTicks)/div < dlyTicks);

}
But div is 10 when I debug. I have set a break point at the while and inspected div as will as let the program run and  then inspected div, it is always 10!

I have attached a simple project showing this behavior.

Thank you.
0 项奖励
回复
2 回复数

793 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by robertrau on Mon Dec 31 14:10:59 MST 2012
After messing with my simple LED test I decided to see if one of the examples behaved correctly. I built & debugged adc_semihosting. Much to my surprise my scope showed the LED oscillating at a 10ms period, what a coincidence! Well, I clicked pause and 'step into' several times to see it executing two assignments over and over.....looks like at the same addresses as my while look in my led test?

As best as I can tell, LPCXpresso is (sometimes, or some projects) going through the motions of programming FLASH without actually doing it.

My environment:
Mac OS X 10.7.5
Version: LPCXpresso v5.0.14 [Build 1063] [2012-12-19]

Thank you.
0 项奖励
回复

793 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Mon Dec 31 13:53:57 MST 2012
Breakpoint at:

    while( (msTicks - curTicks)/div < dlyTicks);
shows correct div value with LPCXpresso v5.0.14 [Build 1109] in Debug mode here :confused:
0 项奖励
回复