Searching \ for '[PIC]: 16F628 and analog inputs' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: techref.massmind.org/techref/microchip/ios.htm?key=analog
Search entire site for: '16F628 and analog inputs'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: 16F628 and analog inputs'
2003\06\21@055606 by Tim ODriscoll

flavicon
face
Hi Everyone,

I need to read an analog voltage in the range 0v to 1v with a resolution
of about 0.01v, and I need to do it in less than 30uS.

I've got a few 16f628's left over from a previous project, so I was
hoping to use one or two of them for the job, but I'm new to analog inputs
and I'm getting confused..

From what I can tell, the analog inputs on the 16f628 aren't proper analog
inputs; they're just 'comparators'. I get the impression that in order to
read the voltage, you need to have a loop that sets Vref and then checks
if the analog input==Vref. That seems way too time consuming for my needs.

So am I barking up the wrong pic, or would a completely separate ADC be a
better choice, like the ADC08831?

Cheers,

Tim

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads

2003\06\21@063049 by Stef

flavicon
face
12F675 can do the job
Stef

Tim ODriscoll wrote:

{Quote hidden}

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads

2003\06\21@063255 by Jinx

face picon face
> I need to read an analog voltage in the range 0v to 1v with a
> resolution of about 0.01v, and I need to do it in less than 30uS.
>
> So am I barking up the wrong pic, or would a completely
> separate ADC be a better choice, like the ADC08831?

I haven't used the comparators this way - just my opinion based
on what's in the manual

They should work but I think not with the internal Vref because
of the coarseness of the increments and because Vref won't
go right down to 0V. I don't know how close it gets - AFAICT
the parameter is not in the manual. You could use an external
Vref that's made with PIC pins and a resistor ladder. It could
get pretty complicated because you want to discriminate 101
voltages. Maybe a digital pot ?

If it was my choice I'd go for the ADC08831, TLC549, something
like that

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads

2003\06\21@093634 by Tim ODriscoll

flavicon
face
On Sat, 21 Jun 2003, Jinx wrote:
> > I need to read an analog voltage in the range 0v to 1v with a
> > resolution of about 0.01v, and I need to do it in less than 30uS.
> >
>
> If it was my choice I'd go for the ADC08831, TLC549, something
> like that
>
Hmmm, I'd quite like to keep the parts count down, so the 12f675 seems
nice.. What's your reason for shifting the ADC onto another IC? Is there a
feature I've overlooked?

My project is to detect changes in a picture from a video camera without a
PC.. I know there's loads of open source PC software projects to do the
job, but where's the fun in that? :)

I'm thinking that if I can sync my pic to the vertical refresh of a video
frame, then I can sample the voltage a couple of times along that
scan-line and compare it to the next frame to see if anything's changed.
I know it's a bit crude, but I can't think of a reason why it won't work
so far....

Cheers,

Tim

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads

2003\06\21@101605 by Jinx

face picon face
> > If it was my choice I'd go for the ADC08831, TLC549, something
> > like that
> >
> Hmmm, I'd quite like to keep the parts count down, so the 12f675
> seems nice..

Yes, you could do the A2D in ~22us + code (probably about time
for 35 instructions)

> What's your reason for shifting the ADC onto another IC? Is there a
> feature I've overlooked?

Not sure how you mean that

Either -

You said you had F628s - A2D would have to be added, and you
mentioned the ADC08831.

Or -

The TLC549 is slower than the 08331, as I've found out (17us vs 4us)
and both are serial, which takes time, so the 08331 would be a better
choice and forget the TLC549

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads

2003\06\21@152515 by Olin Lathrop

face picon face
> I need to read an analog voltage in the range 0v to 1v with a resolution
> of about 0.01v, and I need to do it in less than 30uS.

That is doable with a standard 10 bit PIC A/D.  Even if set up for the full
0-5V range, you would still twice the resolution you need.  That makes the
circuit easier since you don't have to mess around with external references.

> I've got a few 16f628's left over from a previous project,
>
> ...
>
> So am I barking up the wrong pic, or would a completely separate ADC be a
> better choice, like the ADC08831?

I think a different PIC would be simpler and cheaper.  There are 18 pin PICs
with A/Ds, but I don't have my line card here right now.  The 18F1320 is one
of them, but there are also some newer 16F PICs that have A/Ds as I vaguely
remember.


*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads

2003\06\21@155618 by Randy Jones

flavicon
face
The 18-pin 16F819 is a lot like the 16F628, but with 10-bit A/D and without
the USART.  It also has an 8-speed "shift on the fly" internal oscillator
and some of Microchip's new low power "nano-watt" features.  About the same
price as the 16F628.   ...And it's the first 18-pin 16F to support
bootloading.

Randy

http://www.glitchbuster.com


{Original Message removed}

2003\06\21@171335 by gaston.gagnon

face
flavicon
face
Tim ODriscoll a écrit :
>
> Hi Everyone,
>
> I need to read an analog voltage in the range 0v to 1v with a resolution
> of about 0.01v, and I need to do it in less than 30uS.
>
> I've got a few 16f628's left over from a previous project, so I was
> hoping to use one or two of them for the job, but I'm new to analog inputs
> and I'm getting confused..
>
> >From what I can tell, the analog inputs on the 16f628 aren't proper analog
> inputs; they're just 'comparators'. I get the impression that in order to
> read the voltage, you need to have a loop that sets Vref and then checks
> if the analog input==Vref. That seems way too time consuming for my needs.

I have not tried this but what about feeding your signal on one input of
a comparator while the other input is connected to the pwm output trough
a low pass filter?
The comparator output is then used to make the pwm follow your analog
signal. Could the time constant of the filter be made small enough ?
Gaston

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads

2003\06\22@143956 by Tim ODriscoll

flavicon
face
On Sat, 21 Jun 2003, Tim ODriscoll wrote:
> So am I barking up the wrong pic, or would a completely separate ADC be a
> better choice, like the ADC08831?
>

Hi Everyone,

Thanks for all the advice; I've got some 16c711's on order now to have a
play with.

I know they've only got an 8 bit ADC, but they're cheap and my programmer
software/hardware won't need modifying to program them.

Thanks again,

Tim

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

2003\06\22@154258 by Gaston Gagnon

face
flavicon
face
Tim,
Did my suggestion made it to the list or was it discarded for a lack of
good sense ?
Gaston

Tim ODriscoll a écrit :
{Quote hidden}

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

2003\06\22@163947 by Tim ODriscoll

flavicon
face
On Sun, 22 Jun 2003, Gaston Gagnon wrote:
> Tim,
> Did my suggestion made it to the list or was it discarded for a lack of
> good sense ?
> Gaston
>
It did make it, but only after I sent my last email :(  Time to change
ISPs I think...

I'll paste in your email here:
> I have not tried this but what about feeding your signal on one input of
> a comparator while the other input is connected to the pwm output trough
> a low pass filter?
> The comparator output is then used to make the pwm follow your analog
> signal.
> Could the time constant of the filter be made small enough ?
> Gaston

Hmm, I don't quite understand what you mean here.. I *think* you mean to
watch the comparator 'match' flag, then read what the PWM pin was doing at
the that instance? If so, isn't the PWM output a square wave, so my analog
input will only match if it hits vss or vdd? Or is that what the low pass
filter fixes?

Cheers,

Tim

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

2003\06\22@171819 by Gaston Gagnon

face
flavicon
face
Tim ODriscoll a écrit :
{Quote hidden}

The low pass filter output will average the pwm value. A simple RC
network should do.
The idea is to have the pwm output average to match your analog signal. You watch the comparator output to determine if the pwm value should be
increased or decreased.
The pwm value is the digital image of your analog signal.

I hope this is clearer %^}
Gaston
 
>
> Cheers,
>
> Tim
>
> --
> http://www.piclist.com hint: The list server can filter out subtopics
> (like ads or off topics) for you. See http://www.piclist.com/#topics

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

2003\06\22@173906 by Jinx

face picon face
> If so, isn't the PWM output a square wave, so my analog input
> will only match if it hits vss or vdd? Or is that what the low pass
> filter fixes?

Yes, it integrates the wave to a DC voltage. It depends on the
values and quality of the filter (eg a simple RC) and the mark:
space ratio or duty cycle of the wave. Getting 10mV resolution
in 30us might be a big ask

And BTW, thanks for saying thanks. So many / too many people
have lousy manners

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

2003\06\22@180846 by Tom Messenger

flavicon
face
At 09:36 AM 6/23/2003 +1200, Jinx wrote:
>
>And BTW, thanks for saying thanks. So many / too many people
>have lousy manners
>

Thanks, Jinx!

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

2003\06\22@183845 by Jinx

face picon face
> >And BTW, thanks for saying thanks. So many / too many people
> >have lousy manners
> >
>
> Thanks, Jinx!

hehe. but seriously.....there are those who give and those who
like to take. I've a pretty good idea who the "takers" are and
ignore them. Which isn't as brutal or churlish as "I've got what
you want but you can't have it because you don't appreciate
help", but the result is ultimately the same - they are denied
what they want because of their demeanour

My 2c

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

2003\06\22@184851 by John Nall

flavicon
face
At 10:36 AM 6/23/2003 +1200, Jinx wrote:

> >...there are those who give and those who
>like to take. I've a pretty good idea who the "takers" are and
>ignore them. Which isn't as brutal or churlish as "I've got what
>you want but you can't have it because you don't appreciate
>help", but the result is ultimately the same - they are denied
>what they want because of their demeanour

Don't suppose you'd care to elaborate on that, would you?  My own
experience with such things is that on any mailing list you can probably
divide people into about four categories:  (a)  Those who know everything,
(b) those who know a lot, (c) those who know a little, and (d) those who
know nothing.  People in categories c and d will almost never
respond.  People in category b will respond to queries that are pretty much
directly on point in their area of expertise.  People in category a respond
to everything, because they know everything.  (That last sounds bitter --
it is not meant that way -- they really do know everything, and whether we
like it or not every single mailing list is built around a few individuals
of this type).

John

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

2003\06\23@035109 by hael Rigby-Jones

picon face
{Quote hidden}

I think that is a little simplistic.  What about someone in category (a) or
(b) who can't spend the time required to answer many queries?  Chances are
people on (a) may have fairly high pressure jobs.  My experience is exactly
what Jinx has said.  Those that post in a concise and polite manner and have
done at least some groundwork themselves before posting a question are most
likely to get an answer.

Mike


=======================================================================
This e-mail is intended for the person it is addressed to only. The
information contained in it may be confidential and/or protected by
law. If you are not the intended recipient of this message, you must
not make any use of this information, or copy or show it to any
person. Please contact us immediately to tell us that you have
received this e-mail, and return the original to us. Any use,
forwarding, printing or copying of this message is strictly prohibited.
No part of this message can be considered a request for goods or
services.
=======================================================================
Any questions about Bookham's E-Mail service should be directed to postmasterspamKILLspambookham.com.

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2003\06\23@051347 by Tim ODriscoll

flavicon
face
On Sun, 22 Jun 2003, Gaston Gagnon wrote:
> The low pass filter output will average the pwm value. A simple RC
> network should do.
> The idea is to have the pwm output average to match your analog signal.
> You watch the comparator output to determine if the pwm value should be
> increased or decreased.
> The pwm value is the digital image of your analog signal.
>
Aaah, I see now... I think I need to add 'low pass filters' to my list of
things to read up on :)

Although I've never tried it, I'm not sure it would work for my
application... My analog input is a video signal, so it's changing quite
quickly and the low pass filter sounds like it will take some time to
settle. So, by the time I've read back the last voltage to compare to the
current one, I've lost the rest of the scanline.

I think that's how it'll go, anyway :/

Thanks for the idea though, it could come in handy..

Cheers,

Tim

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2003\06\23@051935 by Tim ODriscoll

flavicon
face
On Mon, 23 Jun 2003, Jinx wrote:
> > If so, isn't the PWM output a square wave, so my analog input
> > will only match if it hits vss or vdd? Or is that what the low pass
> > filter fixes?
>
> Yes, it integrates the wave to a DC voltage. It depends on the
> values and quality of the filter (eg a simple RC) and the mark:
> space ratio or duty cycle of the wave. Getting 10mV resolution
> in 30us might be a big ask
>
I'll hold out for my 16c711's I think.. One less thing to go wrong, anyway
:)


> And BTW, thanks for saying thanks. So many / too many people
> have lousy manners
>
No problem.. "Treat other people the way you want them to treat you", as I
recall..

Cheers,

Tim

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2003\06\23@053220 by hael Rigby-Jones

picon face
{Quote hidden}

For video applications, even the inbuilt ADC is probably not going to be
fast enough.  Typicaly a complete conversion cycle on a PIC will take
between 30 and 40 us which means you will get one, maybe two samples per
line.  You generaly need a high speed/flash converter for video work.

Regards

Mike


=======================================================================
This e-mail is intended for the person it is addressed to only. The
information contained in it may be confidential and/or protected by
law. If you are not the intended recipient of this message, you must
not make any use of this information, or copy or show it to any
person. Please contact us immediately to tell us that you have
received this e-mail, and return the original to us. Any use,
forwarding, printing or copying of this message is strictly prohibited.
No part of this message can be considered a request for goods or
services.
=======================================================================
Any questions about Bookham's E-Mail service should be directed to postmasterspamspam_OUTbookham.com.

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2003\06\23@081316 by Olin Lathrop

face picon face
>> And BTW, thanks for saying thanks. So many / too many people
>> have lousy manners
>>
> No problem.. "Treat other people the way you want them to treat you",
> as I recall..

Just my $.02 that I'll probably get the use hate mail for, but I wouldn't
want people cluttering up the list with "thanks" replies.  I might be
interesting and instructive to see how the problem was eventually solved,
but I wouldn't want things to get to "chatty".

In my opinion, the most polite way to ask a question is to explain the
problem clearly and concisely but without omitting the all important
context (this is because often the real problem is that the wrong question
is being asked, but this can't be determined without the bigger picture).
You should also have made all the reasonable attempts within your
capabilities to solve the problem, and show that you have done so.  For
example, no matter how little you know about electronics or
microcontrollers, there is no excuse for at least trying to read the
manual and commenting your code.  Question like "my A/D doesn't work" are
useless.  A good question is "On page 111 is says the A/D does <this>, but
I seem to get <that>...".

Other than that, the next most polite thing to do is to leave the
bandwidth to someone else unless you've got something to add.  This isn't
the Little Old Lady's Knitting and Gossip Society.  If you want to
socialize, take it to [OT] or somewhere else (where I'm not).


*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2003\06\23@102552 by Tim ODriscoll

flavicon
face
On Mon, 23 Jun 2003, Michael Rigby-Jones wrote:
> For video applications, even the inbuilt ADC is probably not going to be
> fast enough.  Typicaly a complete conversion cycle on a PIC will take
> between 30 and 40 us which means you will get one, maybe two samples per
> line.  You generaly need a high speed/flash converter for video work.
>
I thought it would take quite a long time (wrt a video scanline), so I was
planning on taking a sample at the beginning of one line, then taking
the next sample from the end of the next line and doing that three times
for the whole frame, then I can do my comparisions in the next odd/even
frame. I know it's not very precise, but I think it'll be enough to detect
significant movement in the picture.

And if *that* doesn't work then I'll have to reinvent the PIR so it's more
daylight-tolerant :/ ....

Cheers,

tim

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2003\06\24@091629 by Mike Singer

picon face
Olin Lathrop wrote:
> ... Question like "my A/D doesn't work" are useless.
> A good question is "On page 111 is says the A/D does
> <this>, but I seem to get <that>...".
>
> ... I wouldn't want people cluttering up the list with
> "thanks" replies...
> This isn't the Little Old Lady's Knitting and Gossip
> Society.  If you want to socialize, take it to [OT]
> or somewhere else (where I'm not).
>

Thank you, Olin, for expressing your opinion.

  Statements like "This isn't the Little Old Lady's
Knitting and Gossip Society" are useless, I think.
  A good statement is "PICList rules say <this>, but
bad guys seem to say <that>.
  Are you sure there is something in PICList FAQ against
"thanks"? If you aren't why are you trying to set your
non-human no-thanks rules? Who are you? List owner?
Remember your "golden rule": have no gold - have no right
to change rules. Or as in politics - double standards
in action?

Best Regards.

Mike.

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

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