another strange thing :
10000000 is 0x00989680
and 3247832688 is 0xC1989680
the compiler seems to alter the high byte of the parameter.
Whys and how , i don't know ...
Someone from Rowley here ? :)
--- In lpc2000@yahoogroups.com, "nourson54" <yannsuisini@h...> wrote:
>
> I have investigate a little more . It looks like ii's a bug from the
> compiler :-/
>
> I set two breakpoints just after the call and it seems the duration
> parameter is altered
>
> void pause(uint32_t duration)
> {
> uint32_t startTime = T0TC; <----- 1st BP here,duration=10000000
> uint32_t now,temp;
>
> now=startTime; <-- 2nd BP here,duration=3247832688
> temp=now-startTime;
> while (temp < duration)
> {
> now=T0TC;
> temp=(uint32_t)(now-startTime);
> WDOG();
> }
>
>
>
>
>
>
>
>
>
>
>
>
>
> --- In lpc2000@yahoogroups.com, "nourson54" <yannsuisini@h...> wrote:
> >
> > I have written a pause() fonction under crossworks 1.3 like this :
> >
> > #define ONE_SEC (uint32t)10000000
> >
> > void pause(uint32_t duration)
> > {
> > uint32_t startTime = T0TC;
> > uint32_t now,temp;
> >
> > now=startTime;
> > temp=now-startTime;
> > while (temp < duration)
> > {
> > now=T0TC;
> > temp=(uint32_t)(now-startTime);
> > WDOG();
> > }
> > }
> >
> > main
> > {
> > Inittimer, ports, etc ....
> >
> > while(1)
> > {
> > pause(ONE_SEC);
> > IOPIN^=LED;
> > }
> >
> >
> >
> > Then when i want to use this function , it happens strange things :
> > the first time I calls pause() , when i set a brekpoint on the
> > function pause the parameter duration passed has a value of 3248002688
> > instead of 10000000 !!! But at the second call(and others)
> > duration=ONE_SEC=1000000 in pause() . So my led blink at the good
> > frequency of 1s .
> > So , what's wrong ??
> >
> >
> > thanks in advanceMessage
Re: Trouble with simple delay function :-/
2004-12-09 by nourson54
Attachments
- No local attachments were found for this message.