gnupic: Re: [gnupic] Re: PIC18F47J53


Previous by date: 14 Aug 2013 00:46:37 -0000 Re: PIC18F47J53, Luis de Arquer
Next by date: 14 Aug 2013 00:46:37 -0000 Re: [gnupic] Re: PIC18F47J53, Luis de Arquer
Previous in thread:
Next in thread: 14 Aug 2013 00:46:37 -0000 Re: [gnupic] Re: PIC18F47J53, Luis de Arquer

Subject: Re: [gnupic] Re: PIC18F47J53
From: Don Wooton ####@####.####
Date: 14 Aug 2013 00:46:37 -0000
Message-Id: <20130814004524.GB31665@snuggle.org>

I'm a little late but ...

Is the loop being opimized away?
When that happens, c will have no use.
Looking at the asm should show that.
The usual fix is volatile.

void sleep_a_while(byte c)
{
    volatile byte i,j;

    for(i=0; i<200; i++)
	for(j=0; j<c; j++) ;
}

    - Don

On Aug 13, Luis de Arquer propounded certain bytes, to wit:
> Subject: [gnupic] Re: PIC18F47J53
>
> I think I am giving up on this one.
> 
> I have put all the right SMD capacitors as close as I could, including
> a 10uF ceramic for vddcore, but still the same issue.
> 
> I am using pickit2 for this pic (18f47j53), and although I found a
> .dat file which supports it, I couldn't find anywhere in the microchip
> website saying it is supported really... so that could be the source
> of the grief.
> 
> Thank you all anyway :)
> 
> On Mon, Aug 12, 2013 at 10:54 PM, Bob Jacobsen ####@####.#### wrote:
> >
> > On Aug 12, 2013, at 1:09 PM, Luis de Arquer ####@####.#### wrote:
> >
> >> Problem number 1 is surely a C issue, which is the sleep function I made:
> >>
> >> ****************************
> >>
> >> typedef unsigned char byte;
> >>
> >> void sleep_a_while(byte c)              /* A */
> >> {
> >>  byte i,j;                                           /* B */
> >>
> >>  for(i=0; i<200; i++)
> >>    for(j=0; j<c; j++) ;
> >> }
> >>
> >>
> >> **************************
> >>
> >> Changing "byte" for "int" in any of those lines changes the timing. It
> >> makes the sleep time not only different -which makes sense since int
> >> is translated to int16 apparently, with its overhead-, but independent
> >> on c (the input parameter ! ).
> >
> >
> > Do you mean if you change (A) but not (B) or vice-versa?
> >
> > I'd check the assembler code to see what's happening to the upper byte of the int values.  If it's being left unchanged, all sorts of interesting things can happen, particularly if you call sleep-a-while with a value greater than 127.
> >
> > Bob
> > --
> > Bob Jacobsen, LBNL Physics Division
> > ####@####.#### +1-510-486-7355 AIM, Skype JacobsenRG
> >
> >
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: ####@####.####
> > For additional commands, e-mail: ####@####.####
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ####@####.####
> For additional commands, e-mail: ####@####.####
>-- End of excerpt from Luis de Arquer'

Previous by date: 14 Aug 2013 00:46:37 -0000 Re: PIC18F47J53, Luis de Arquer
Next by date: 14 Aug 2013 00:46:37 -0000 Re: [gnupic] Re: PIC18F47J53, Luis de Arquer
Previous in thread:
Next in thread: 14 Aug 2013 00:46:37 -0000 Re: [gnupic] Re: PIC18F47J53, Luis de Arquer


Powered by ezmlm-browse 0.20.