Searching \ for '[PIC]: R/W Analog values on a P16F84' 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=analog
Search entire site for: 'R/W Analog values on a P16F84'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: R/W Analog values on a P16F84'
2001\02\18@185211 by Robert Shady

picon face
Okay.. Still working on the Infrared thing here...
I've got the multiplexer (CD4051) hooked up
to RB4/5/6 (for select lines), and the analog
signal coming into RB7.  Problem is, I can't find
ANY example code on reading an analog signal
directly into the 16F84, the only thing I've found
even remotely close used a 555 timer to measure
infrared pulses and output the count to the 16f84.

Can anyone point me in the right direction?  I've
got my loops all setup to loop through the mux
(I just need the info on reading Pin RB7... :(

-- Rob


__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35
a year!  http://personal.mail.yahoo.com/

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


2001\02\18@190247 by David Duffy

flavicon
face
Rob wrote:
>Okay.. Still working on the Infrared thing here...
>I've got the multiplexer (CD4051) hooked up
>to RB4/5/6 (for select lines), and the analog
>signal coming into RB7.  Problem is, I can't find
>ANY example code on reading an analog signal
>directly into the 16F84, the only thing I've found
>even remotely close used a 555 timer to measure
>infrared pulses and output the count to the 16f84.

The 16F84 had no inbuilt A2D convertor !

>Can anyone point me in the right direction?  I've
>got my loops all setup to loop through the mux
>(I just need the info on reading Pin RB7... :(

There are routines out there for doing A2D on parts without
a convertor using some tricky techniques. I've not done it
myself but the piclist.com site should have some examples.
Regards...

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


2001\02\18@204843 by Robert Shady

picon face
Boy do I feel stupid... I must have got my 16F877
and 16F84 mixed up.. Does anybody know of a way
of measuring analog signal w/16F84?  I know I've
seen something about using some cap's & resistors
and measuring the time it takes to charge the caps,
but I can't seem to find that page again... Does
anyone have more information on this method, or
any method for that matter that might work?

-- Rob

--- David Duffy <spam_OUTpiclistTakeThisOuTspamAUDIOVISUALDEVICES.COM.AU> wrote:
{Quote hidden}

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35
a year!  http://personal.mail.yahoo.com/

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


2001\02\19@025931 by Drew Ames

flavicon
face
I'm a realtive newbie at this also, but here's my crude code...

It set the pin to output and charges a capacitor via a small resistor. The
resistive load to be measured in this case is a Thermistor which is
connected across the capacitor (and typically has a much higher resistance
than the charging resistor).
Once the capacitor is charged, the pin is switched to input and TMR0
overflows are counted until a low is read on the pin.


MEASURE bcf PORTA,0
    bsf STATUS,RP0
    bcf TRISA,0     ; Set RA0 as output
    bcf STATUS,RP0
    bsf PORTA,0     ; Charge the capacitor

    call    LCDWT15 ; 5*1k*10uF*3.2768e+6 = 16384 cycles = 0x4000 = 5ms

    clrf    CNTDLY
    clrf    CNTDLY1
    clrf    CNTDLY2
    movlw   A'-'
    movwf   CNTOVER

    bsf STATUS,RP0
    bsf TRISA,0     ; Set RA4 as input
    bcf STATUS,RP0

WAIT    btfss   PORTA,0
    goto    DISPLAY

    btfss   INTCON,T0IF ; Wait for the timer to overflow
    goto    WAIT

    bcf INTCON,T0IF ; clear the overflow flag

    incfsz  CNTDLY,f    ; count the overflow
    goto    WAIT
    incfsz  CNTDLY1,f
    goto    WAIT
    incfsz  CNTDLY2,f
    goto    WAIT
    movlw   A'+'
    movwf   CNTOVER
    goto    WAIT


At 10:21 19/02/01, you wrote:
{Quote hidden}

----------------------------------------------------------------
Drew & Karen Ames

Home E-Mail: .....drewKILLspamspam@spam@rebel.net.au or karenspamKILLspamrebel.net.au
Business E-Mail: .....damesKILLspamspam.....syserv.com.au

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


2001\02\19@031141 by Mitch Stein

picon face
                  Status Distribution February 19, 2001 02:05:42                        
Sent by AMAUO01

The message regarding "Re: [PIC]: R/W Analog values on a P16F84" sent on February 19, 2001 09:05:42 was sent by

Status Recipient
         Type                To
         Native Name         PICLISTspamspam_OUTMITVMA.MIT.EDU
         Foreign Native Name @spam@PICLISTKILLspamspamMITVMA.MIT.EDU/n/n/nSMTP



Recipients

Status Reporters
         Type                From
         Name Domain         LOTUS
         Native Name         CN=Mitch Stein/OU=BRQ/OU=RESEARCH/O=PHILIPS@AMEC
         Foreign Native Name CN=Mitch Stein/OU=BRQ/OU=RESEARCH/O=PHILIPS/nAMEC/n/n
         Organization        PHILIPS
         Org Unit 1          RESEARCH
         Org Unit 2          BRQ
         Last Name           Stein
         First Name          Mitch



Status          769
Explanation     Invalid recipient

X.400 Status    769
Explanation     Error delivering to ARJ015M/M/SERVER/PHILIPS mail3/mitchstein.nsf; I/O data error

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


2001\02\19@150543 by Robert Shady

picon face
Can you throw together a quick circuit to demonstrate
this?  For some reason I'm just having a hell of a time
with this...

I gather your doing something like...

                       1k?
+5V--->Thermistor--->Resistor---v---> PortA,0
                               |
                               -
                               -  1uf Cap?
                               |
                              GND

Yes? No?  I can't figure this out...  My TMR0
never overflows properly because it's being
used in an interrupt routine where I reset it...
But I've taken that part out of your code, and
just added another counter.  Trouble is, I
never seem to see the cap toggle the pin..


--- Drew Ames <RemoveMEdrewTakeThisOuTspamREBEL.NET.AU> wrote:
{Quote hidden}

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35
a year!  http://personal.mail.yahoo.com/

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


2001\02\19@201250 by Robert Shady

picon face
I'm must be the dumbest person in the world.. I
haven't run into a stump this big in along time!

I *STILL* haven't figured out how to read an
analog value on my 16F84, I've tinkered with the
R/C method -- No luck, so I went and bought an
ADC8031 & found some code for the PIC16C71 which
I converted to PIC16F84 (see below).. I've thrown
a 1Meg resister in there as follows:

+5VDC--->1M Resistor--->Photocell--->ADC0831 VIN

And *something* is happening, however I pretty much
only get a value of 134 or 192 (nothing higher/lower)
depending on whether I cover the photocell or not.
Now I'm pretty sure THIS isn't right, so I checked the
voltage on VIN and it is only appears to be
changing from 4.45 to 4.5 (or there abouts).  Any idea
on what I can do to make the voltage change greater?

Here's my converted code, if anybody is interested...


A2D_Pulse_Clock MACRO
       bsf     A2D_Clock       ;; Bring the CLOCK line HIGH
       call    usec_delay      ;; Wait around for a bit...
       bcf     A2D_Clock       ;; Bring the CLOCK line LOW
       call    usec_delay      ;; Wait a little bit more...
       ENDM

a2d
       bcf     A2D_CS          ;; Enable the ADC0831 chip

       movlw   D'8'            ;; We need to read 8 bits...
       movwf   a2d_timer       ;; ...store that # in our timer

       A2D_Pulse_Clock         ;; Pulse the ADC0831 CLOCK line...

       clrf    a2d_count_1     ;; Clear out our storage byte...

a2d_loop_1:
       A2D_Pulse_Clock         ;; Pulse the ADC0831 CLOCK line...

       bcf     STATUS,C        ;; Our 'default' data bit is 0
       btfsc   A2D_Data        ;; If the data bit is SET, skip the
next line
       bsf     STATUS,C        ;; ...The bit was actually 1, hmm... :)

       rlf     a2d_count_1,F   ;; Rotate the carry bit into our byte!

       decfsz  a2d_timer,F     ;; Decrement our counter
       goto    a2d_loop_1      ;; ... and do it again (if we're not
done!)

       bsf     A2D_CS          ;; Disable the ADC0831 chip
       return

{Quote hidden}

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35
a year!  http://personal.mail.yahoo.com/

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


2001\02\19@204611 by David Duffy

flavicon
face
At 05:13 PM 19/02/01 -0800, you wrote:
>I'm must be the dumbest person in the world.. I
>haven't run into a stump this big in along time!
>
>I *STILL* haven't figured out how to read an
>analog value on my 16F84, I've tinkered with the
>R/C method -- No luck, so I went and bought an
>ADC8031 & found some code for the PIC16C71 which
>I converted to PIC16F84 (see below).. I've thrown
>a 1Meg resister in there as follows:
>
>+5VDC--->1M Resistor--->Photocell--->ADC0831 VIN

Robert,
Connect the photocell to ground instead of the ADC input.
Then connect the ADC input to the junction of the resistor & photocell.
Experiment with different resistor values to get the best range.
Regards...

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


2001\02\19@224445 by dpharris

picon face
Hi-
As usual the answer to this question lies at http://www.piclist.com, try out
these links:
http://www.piclist.com/techref/microchip/a2d.htm - for analog to digital
http://www.dattalo.com/technical/software/software.html - for specific
A2D using i/o line with capacitor
David

Robert Shady wrote:

{Quote hidden}

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


2001\02\20@033321 by Vasile Surducan

flavicon
face
see below

On Tue, 20 Feb 2001, David Duffy wrote:

{Quote hidden}

 If you will use a photodiode instead of photocell and respect David
advice will be better. But if you need an electric signal proportional
and linear with ilumination you need a current/voltage converter because
only the photocurent is linear with incident light beam intensity.
Easy to do: put the photodiode to ground from -in, a reesistor R in
negative feedback of an AO ( operational amplifier ). AO must have
input current at least ten times smaller then minimum photocell current.
Positive input of operational amplifir to ground. At output you'll have
Vout = - RxIphoto . With an automat offset corection circuit this may be
the input for a visible spectrophotometer...
Vasile

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


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