gnupic: Re: [gnupic] 16f628


Previous by date: 3 Jul 2005 15:48:53 +0100 Re: [gnupic] 16f628, Maxime Larocque
Next by date: 3 Jul 2005 15:48:53 +0100 Re: [gnupic] 16f628, Peter Onion
Previous in thread: 3 Jul 2005 15:48:53 +0100 Re: [gnupic] 16f628, Maxime Larocque
Next in thread: 3 Jul 2005 15:48:53 +0100 Re: [gnupic] 16f628, Peter Onion

Subject: Re: [gnupic] 16f628
From: Greg Hill ####@####.####
Date: 3 Jul 2005 15:48:53 +0100
Message-Id: <Pine.LNX.4.62.0507030838240.25931@hillnet.us>

On Sun, 3 Jul 2005, MvH wrote:

> I got some pics 16f628 in a hardware programming class, but after trying 
> to use them in a small project that involves a sharp IR sensor ( 
> outputting a voltage range of 0.2 to 2.4 V) I found that the ANx pin's 
> aren't analog ADC but comparators;  I'm looking for the right kind of 
> circuitry to create one ( sigma delta thing?) is anyone on this list 
> experienced in this? or would trying to get my hands on 16f88 ( with 
> adc) be a better solution. I currently have no experience in assembler - 
> I use jal for now - are there better suggestions? is pyastra the way to 
> go?

I couldn't comment on the language choice -- assembler is the only thing 
I've used on the PICs.

As for your other problem, I do have a suggestion. Once I used the F628 in 
a system which switched outputs based on light levels as measured by a 
resistive photocell (CdS, I believe). I built a voltage divider with the 
photocell and another resistor and ended up with a varying voltage to 
measure, similar to what you're doing.

The method I came up with was to configure the part so that comparator A 
used input 1 and the voltage reference as its inputs (actual names for the 
components may be different, I don't remember!). I set the voltage 
reference to one end of its range (minimum, for example). Then, in a loop 
(for/while/etc) check to see whether the comparator output has changed, 
increment the voltage reference setting, then repeat. Once you find the 
switching point of the reference, you can conclude that the input voltage 
was between this reference level and the previous one. You might be able 
to make the assumption that the input level actually matches the reference 
level, pretending that the system (comparator+programmable reference) is 
just an ADC.

You'll notice that the voltage reference has a "high" and "low" range 
setting. In my system I actually used both ranges. The trick was to start 
the compare loop for the high range, which I did second, with the 
reference set to some value which closely matched the last value I'd had 
in the low range.

Greg


Previous by date: 3 Jul 2005 15:48:53 +0100 Re: [gnupic] 16f628, Maxime Larocque
Next by date: 3 Jul 2005 15:48:53 +0100 Re: [gnupic] 16f628, Peter Onion
Previous in thread: 3 Jul 2005 15:48:53 +0100 Re: [gnupic] 16f628, Maxime Larocque
Next in thread: 3 Jul 2005 15:48:53 +0100 Re: [gnupic] 16f628, Peter Onion


Powered by ezmlm-browse 0.20.