gnupic: PIC18F47J53


Previous by date: 12 Aug 2013 18:10:59 -0000 Re: PIC18F47J53, Luis de Arquer
Next by date: 12 Aug 2013 18:10:59 -0000 Re: PIC18F47J53, KHMan
Previous in thread: 12 Aug 2013 18:10:59 -0000 Re: PIC18F47J53, Luis de Arquer
Next in thread: 12 Aug 2013 18:10:59 -0000 Re: PIC18F47J53, KHMan

Subject: Re: PIC18F47J53
From: Marko Kohtala ####@####.####
Date: 12 Aug 2013 18:10:59 -0000
Message-Id: <CAJ0yFaztWaR=r39jMdkRB_qFhXor3moqqksn6kYTVCTJgvxtHQ@mail.gmail.com>

Hi.

It is best using LATB for output.

Check your ADCON1. The pin is at reset analog input. PORTB reads digital
input even while you have TRISB bit cleared. Reading digital input on
analog input always reads 0 and therefore BTG always writes 1.

Marko


2013/8/12 Luis de Arquer ####@####.####

> Hi Bob,
>
> Thanks for the info, since that was something I didn't know anyway.
>
> As you say, that may not be the problem after all. The 'sleep_a_while'
> function that is called in between is defined as (in C code)
>
> void sleep_a_while(byte c)
> {
>   byte i,j;
>
>   for(i=0; i<200; i++)
>     for(j=0; j<c; j++) ;
> }
>
> so surely it has enough time to settle.
>
> I have seen some examples around using lots of config words for the
> PIC, while I am only using these:
>
>     CONFIG    OSC=INTOSC,WDTEN=OFF
>
> I have read all of the other config words and thought I don't need any
> more, but maybe I am missing shtg?
>
> Regards,
>
> Luis
>
> Luis
>
> On Mon, Aug 12, 2013 at 6:27 PM, Bob Jacobsen ####@####.####
> wrote:
> >
> > On Aug 12, 2013, at 9:58 AM, Luis de Arquer ####@####.####
> wrote:
> >
> >>
> >> I have tried a simple program blinking an LED. It does work, if I use
> >> the instructions
> >>
> >> PORTB &= 0x08
> >> PORTB |= 0x08
> >>
> >> for toggling the LED (see asm translation below).
> >> However if I use
> >>
> >> PORTB ^= 0x08
> >>
> >> which translates to a BTG (bit toggle) instruction, it won't blink at
> >> all -it will light the LED up though, but no blinking can be seen even
> >> with the oscilloscope.
> >
> >
> > Perhaps some hints here:
> >
> > http://www.xargs.com/pic/c-faq.html#rmw
> >
> > but that doesn't seem to fit your timing.
> >
> > 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: ####@####.####
>
>

Previous by date: 12 Aug 2013 18:10:59 -0000 Re: PIC18F47J53, Luis de Arquer
Next by date: 12 Aug 2013 18:10:59 -0000 Re: PIC18F47J53, KHMan
Previous in thread: 12 Aug 2013 18:10:59 -0000 Re: PIC18F47J53, Luis de Arquer
Next in thread: 12 Aug 2013 18:10:59 -0000 Re: PIC18F47J53, KHMan


Powered by ezmlm-browse 0.20.