Searching \ for '[PIC]: F877 A/D coding detail' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/ios.htm?key=a%2Fd
Search entire site for: 'F877 A/D coding detail'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: F877 A/D coding detail'
2001\04\10@193324 by Brian Reed

flavicon
face
As long as I account for capacitor charge time, can I turn the A/D off
and on at will?  Right now I just leave it on...

The first line in AD_RA0() leaves the A/D enabled for the life of the app.
The second line does a delay for A/D capacitor charge time before ADGO.
I've placed a comment where I wonder if I could/should turn the A/D off.

- Bri


void AD_init(void)
{
 OPTION = 0x87;             // Set TMR0 prescaler, and 1:256
 ADCON1 = 0x02;             // Left justify result, 3 analog channels
}

unsigned char AD_RA0(void)
{
 ADCON0 = 0x41;             // Fosc/8, A/D enabled
 DelayUs(20);               // Allow time for A/D capacitor to charge
 ADGO = 1;                  // Set the bit to start the conversion
 while (ADGO)               // Wait for the conversion to complete
   continue;                //
 //// could/should disable A/D here?  (w/ADCON0)
 return ADRESH;             // Return the AD value (just the top 8 bits)
}

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email spam_OUTlistservTakeThisOuTspammitvma.mit.edu with SET PICList DIGEST in the body


2001\04\10@200240 by Drew Vassallo

picon face
>As long as I account for capacitor charge time, can I turn the A/D off
>and on at will?  Right now I just leave it on...

Yes, you can do this to save power.

I believe it still has to charge up each time you power it back up (turn it
on).

You know, I really don't know how much power you'd save by doing this... I
run my stuff off batteries and really can't see a difference with the A/D
module on or off.

Maybe it's there, but I can't see it, at least not in practical
applications.

--Andrew
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email .....listservKILLspamspam@spam@mitvma.mit.edu with SET PICList DIGEST in the body


2001\04\11@080737 by Wynn Rostek

flavicon
face
The spec sheet claims you'll save a milliamp.

Wynn

> You know, I really don't know how much power you'd save by doing this... I
> run my stuff off batteries and really can't see a difference with the A/D
> module on or off.
>
> Maybe it's there, but I can't see it, at least not in practical
> applications.
>
> --Andrew

--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-requestspamKILLspammitvma.mit.edu


2001\04\11@083232 by Olin Lathrop

face picon face
{Quote hidden}

I see no reason you couldn't turn it off as long as you observer all the
rules when turning it back on again.  I've never done it this way.  Why do
you want to turn off the A/D?  will you not use it again or are you trying
to save power?


********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, .....olinKILLspamspam.....embedinc.com, http://www.embedinc.com

--
http://www.piclist.com hint: To leave the PICList
EraseMEpiclist-unsubscribe-requestspam_OUTspamTakeThisOuTmitvma.mit.edu


2001\04\11@092030 by Brian Reed
flavicon
face
>Why do you want to turn off the A/D?  will you not use it again or are
>you trying to save power?

Saving power wouldn't hurt (battery powered robot), but the real reason
for asking is just to write good code and understand the A/D better.

>I've never done it this way.

Ah... that probably means I don't need/want to.  Are you saying you
normally just leave it on (unless it won't be used again for a while)?

- Bri


{Quote hidden}

--
http://www.piclist.com hint: To leave the PICList
@spam@piclist-unsubscribe-requestKILLspamspammitvma.mit.edu


2001\04\11@120612 by Olin Lathrop

face picon face
> Ah... that probably means I don't need/want to.  Are you saying you
> normally just leave it on (unless it won't be used again for a while)?

So far I've just left it on (when using it at all) but that doesn't mean
it's the right answer for your situation.  I hadn't thought about this issue
because I have so far not run into a case where power was limited and A/D
readings are only needed occasionally where the processor couldn't otherwise
sleep.


********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, KILLspamolinKILLspamspamembedinc.com, http://www.embedinc.com

--
http://www.piclist.com hint: To leave the PICList
RemoveMEpiclist-unsubscribe-requestTakeThisOuTspammitvma.mit.edu


2001\04\11@121012 by Bob Ammerman

picon face
----- Original Message -----
From: "Olin Lathrop" <spamBeGoneolin_piclistspamBeGonespamEMBEDINC.COM>
To: <TakeThisOuTPICLISTEraseMEspamspam_OUTMITVMA.MIT.EDU>
Sent: Wednesday, April 11, 2001 11:20 AM
Subject: Re: [PIC]: F877 A/D coding detail


> > Ah... that probably means I don't need/want to.  Are you saying you
> > normally just leave it on (unless it won't be used again for a while)?
>
> So far I've just left it on (when using it at all) but that doesn't mean
> it's the right answer for your situation.  I hadn't thought about this
issue
> because I have so far not run into a case where power was limited and A/D
> readings are only needed occasionally where the processor couldn't
otherwise
> sleep.

I could be mistaken, but I think the A/D will consume considerable current
even in sleep if it is enabled.

Bob Ammerman
RAm Systems
(contract development of high performance, high function, low-level
software)

--
http://www.piclist.com hint: To leave the PICList
RemoveMEpiclist-unsubscribe-requestspamTakeThisOuTmitvma.mit.edu


2001\04\11@145106 by Olin Lathrop

face picon face
> I could be mistaken, but I think the A/D will consume considerable current
> even in sleep if it is enabled.

The A/D is automatically powered down in sleep mode although the ADON bit
stays set if it was originally set.  The A/D will stay on in sleep mode to
finish the current conversion if one is in progress and the internal RC
oscilator is used to time the conversion.  Once that conversion is over, it
will be powered down.

At least this is how it is documented for the 16F87x.  It may be different
on older chips - I haven't looked.


********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, olinEraseMEspam.....embedinc.com, http://www.embedinc.com

--
http://www.piclist.com hint: To leave the PICList
EraseMEpiclist-unsubscribe-requestspammitvma.mit.edu


More... (looser matching)
- Last day of these posts
- In 2001 , 2002 only
- Today
- New search...