Searching \ for '[PIC]: ADCIN to LCDout' 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=adc
Search entire site for: 'ADCIN to LCDout'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: ADCIN to LCDout'
2006\10\28@224126 by Ken Ouellette

picon face
Hello,

I have this program , it does compile but the output
value is always the same (around 500). It should read
the input portC.0 from analog and display its decimal
value to the lcd. The analog input is between 2 to 5
volt. I am using a Pic16F876a.

DEFINE LCD_DREG PORTB        
DEFINE LCD_DBIT 4        
DEFINE LCD_RSREG PORTB        
DEFINE LCD_RSBIT 1        
DEFINE LCD_EREG PORTB        
DEFINE LCD_EBIT 0        
DEFINE LCD_BITS 4        
DEFINE LCD_LINES 2        

Define  ADC_BITS        10            
Define  ADC_CLOCK       3            
Define  ADC_SAMPLEUS    50            

adval  var word                                

TRISC = %11111111                
ADCON1 = %10000010                
Low PORTB.2                                
Pause 500      
               
loop:        ADCIN 4, adval                        
Lcdout $fe, 1                       Lcdout "Value: ", DEC adval        
Pause 100                      
Goto loop                      
End

end

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

2006\10\29@020839 by John Temples

flavicon
face
The 16F876A does not have analog inputs on PORTC.

On Sat, 28 Oct 2006, Ken Ouellette wrote:

{Quote hidden}

> --

2006\10\29@074343 by Bernd Rüter

flavicon
face
part 0 44 bytes
his is a multi-part message in MIME format.
part 1 424 bytes content-type:text/plain; charset=ISO-8859-1; format=flowed (decoded 7bit)

Ken Ouellette schrieb:
> I have this program , it does compile but the output
> value is always the same (around 500). It should read
> the input portC.0 from analog and display its decimal
> value to the lcd. The analog input is between 2 to 5
> volt. I am using a Pic16F876a.

Sorry,
we are not able to find any PIC16F876A who has an analog input on PortC.0.


greetings


part 2 478 bytes content-type:text/x-vcard; charset=utf-8;
(decoded 7bit)

begin:vcard
fn;quoted-printable:Bernd R=C3=BCter
n;quoted-printable:R=C3=BCter;Bernd
org:Promaxx;Entwicklung
adr;quoted-printable;dom:;;W=C3=BClferoder Stra=C3=9Fe 10;Hannover;Nds;30539
email;internet:spam_OUTbernd.rueterTakeThisOuTspampromaxx.net
title:Dipl.-Ing.
tel;work:+49 511 3746207
tel;fax:+49 511 3746208
note:Meine Kontakte sammle und pflege ich in OpenBC: http://www.openbc.com/go/invite/3470477.7f1d19
url:http://www.promaxx.net
version:2.1
end:vcard



part 3 35 bytes content-type:text/plain; charset="us-ascii"
(decoded 7bit)

2006\10\29@082949 by Ken Ouellette

picon face
I changed to port A and no effect.

ken


--- John Temples <.....piclist2KILLspamspam@spam@xargs.com> wrote:

{Quote hidden}

2006\10\29@090852 by Ken Ouellette

picon face
mainly I just want to use this program but convert it
in picbasic pro and hace a LCD out of the input.

‘***Real A to D on the 876****
program RealAtoDSafe
Dim data1 as word
Main:
TrisB = %00000000
TrisA = %00001000
ADCON1 = %10000100
while TRUE
data1=Adc_Read(3)
If data1 < 4 Then
data1 = 4
End If
PortB = word(data1 >> 2)
wend
End.
‘***************************

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

2006\10\29@091553 by Victor Faria

picon face
Ken,
perhaps you may want to ask at the picbasic pro forum?
http://www.picbasic.co.uk/forum/
victor
{Original Message removed}

2006\10\29@100356 by Mauricio Jancic

flavicon
face
The problems is that the AD module is not ON. Read the AD section on your
microcontrollers datasheed and check the configurations you must set trough
ADCON1 and ADCON0 (ADCON0 is missing on you code).

Mauricio Jancic
Janso Desarrollos
http://www.janso.com.ar
infospamKILLspamjanso.com.ar
(54) 11-4542-3519


> {Original Message removed}

2006\10\29@103742 by =?windows-1252?Q?Bernd R=FCter?= n/a

flavicon
face
part 0 44 bytes
his is a multi-part message in MIME format.
part 1 829 bytes content-type:text/plain; charset=windows-1252; format=flowed (decoded quoted-printable)

Ken Ouellette schrieb:
> mainly I just want to use this program but convert it
> in picbasic pro and hace a LCD out of the input.
> > ‘***Real A to D on the 876****
> program RealAtoDSafe
> Dim data1 as word
> Main:
> TrisB = %00000000
> TrisA = %00001000
> ADCON1 = %10000100
> while TRUE
> data1=Adc_Read(3)
> If data1 < 4 Then
> data1 = 4
> End If
> PortB = word(data1 >> 2)
> wend
> End.


Ken,
you have to make clear, what ports you are using. This is important !
First you tried PortC.0 as AN4 - wrong,
then you changed it to PortA ? What pin ?
Now you use an unknwon language and refers to channel 3.

So,
make it easy for us to write your programm.

What Port-Pin is connected to the analog input ?

greetings


part 2 478 bytes content-type:text/x-vcard; charset=utf-8;
(decoded 7bit)

begin:vcard
fn;quoted-printable:Bernd R=C3=BCter
n;quoted-printable:R=C3=BCter;Bernd
org:Promaxx;Entwicklung
adr;quoted-printable;dom:;;W=C3=BClferoder Stra=C3=9Fe 10;Hannover;Nds;30539
email;internet:.....bernd.rueterKILLspamspam.....promaxx.net
title:Dipl.-Ing.
tel;work:+49 511 3746207
tel;fax:+49 511 3746208
note:Meine Kontakte sammle und pflege ich in OpenBC: http://www.openbc.com/go/invite/3470477.7f1d19
url:http://www.promaxx.net
version:2.1
end:vcard



part 3 35 bytes content-type:text/plain; charset="us-ascii"
(decoded 7bit)

2006\10\29@110317 by Ken Ouellette

picon face
Actually I was looking into that, I am not 100% sure
about the functionnality , I put
ADCON1 = %10000000                
ADCON0 = %00000001
ADCON1 was put this way to make all port analog and
taking Vdd and Vss as reference.
ADCON0 has the bit 0 at 1 to turn on the A/D
still not working
I am not sure what the GO/DONE does, should it be at 1

k



--- Mauricio Jancic <EraseMEinfospam_OUTspamTakeThisOuTjanso.com.ar> wrote:

{Quote hidden}

> > {Original Message removed}

2006\10\29@122953 by Bernd Rüter

flavicon
face
part 0 44 bytes
his is a multi-part message in MIME format.
part 1 1036 bytes content-type:text/plain; charset=ISO-8859-1; format=flowed (decoded 7bit)

Ken Ouellette schrieb:
> Actually I was looking into that, I am not 100% sure
> about the functionnality , I put
> ADCON1 = %10000000                
> ADCON0 = %00000001
> ADCON1 was put this way to make all port analog and
> taking Vdd and Vss as reference.
> ADCON0 has the bit 0 at 1 to turn on the A/D
> still not working
> I am not sure what the GO/DONE does, should it be at 1
>
> k


here my same posting as in the PicBasicPro-forum where you started the
same thread:

Hi K,

You can forget to set Register ADCON0, because it is complete done by PBP.

The 16F876A has 5 analog inputs. If you want to use all of them, you
should set the lower 4 bits of ADCON1 to "0000". Look at the datasheet !

You WROTE, you want to use 8 bit ad-input.
In your programm you USE 10-bit ad-input. Maybe you should define your
parameters.
Using 10-bit ad you have to choose right-justified results, because pbp
doesn't convert it. So put a "1" it the MSB of ADCON1!


part 2 478 bytes content-type:text/x-vcard; charset=utf-8;
(decoded 7bit)

begin:vcard
fn;quoted-printable:Bernd R=C3=BCter
n;quoted-printable:R=C3=BCter;Bernd
org:Promaxx;Entwicklung
adr;quoted-printable;dom:;;W=C3=BClferoder Stra=C3=9Fe 10;Hannover;Nds;30539
email;internet:@spam@bernd.rueterKILLspamspampromaxx.net
title:Dipl.-Ing.
tel;work:+49 511 3746207
tel;fax:+49 511 3746208
note:Meine Kontakte sammle und pflege ich in OpenBC: http://www.openbc.com/go/invite/3470477.7f1d19
url:http://www.promaxx.net
version:2.1
end:vcard



part 3 35 bytes content-type:text/plain; charset="us-ascii"
(decoded 7bit)

2006\10\29@133526 by Ken Ouellette

picon face
it is working now even with these changes
TRISA = %11111111          
ADCON1 = %11000000        
ADCON0 = %00000001

but the decimal value on the LCD do not go higher then
807. I did a Left jusified at the ADCON1 just to see
what would show, and I get more then 3 digits, so my
LCD is ok, I put it back to right justified. The
analog input is a light sensor, when I flash a led on
it it stays at 807. But on the voltmeter I know the
sensor is not saturated because it can go even higher
voltage output with a stronger light

k

--- Bernd Rüter <KILLspambernd.rueterKILLspamspampromaxx.net> wrote:

{Quote hidden}

> > -

2006\10\29@144313 by Austin

flavicon
face
>Ken Ouellette wrote:
>I am not sure what the GO/DONE does, should it be at 1

After you have the ADC module configured & turned on, set the
GO/~DONE bit to start the conversion.  The GO/~DONE bit
will then clear when the conversion is complete.

Austin



--- Mauricio Jancic <spamBeGoneinfospamBeGonespamjanso.com.ar> wrote:

{Quote hidden}

> > {Original Message removed}

2006\10\29@155112 by Ken Ouellette

picon face
it working now :)
the problem is the output decimal, it only goes up to
807. this is equivalent to a voltage of 3.7, and the
Vdd is at 5 volt so as the maximum input analog
voltage. why doesn,t  it go higher then 807
k


--- Austin <RemoveMEpiclistspamTakeThisOuTaustinm.net> wrote:

{Quote hidden}

> > > {Original Message removed}

2006\10\29@164510 by Jinx

face picon face

> 807. this is equivalent to a voltage of 3.7, and the
> Vdd is at 5 volt so as the maximum input analog
> voltage. why doesn,t  it go higher then 807

Ken,

807/1023 * 5 = 3.94

What source impedance and what acquisition time ?

2006\10\29@171744 by Ken Ouellette

picon face

yes thats was the problem, Actually my sensor specs do
not go higher then 3.6, oddly enough I calculated
4.98.
I changed the ADCON1 to have a reference voltage of 4
volt and implemented it. it now goes up to 1008, which
is better.

thanks for all the help

k


--- Jinx <RemoveMEjoecolquittEraseMEspamEraseMEclear.net.nz> wrote:

{Quote hidden}

> --

2006\10\29@193733 by Mauricio Jancic

flavicon
face
So you where playing with us when you said that the vdd was at 5V ? On a
previous mail you even mentioned that you used a voltmeter to test
everything...

Really, you should read the datasheets carefoully before continuing.

Mauricio

> {Original Message removed}

2006\10\29@210919 by Ken Ouellette

picon face
NO the Vdd was and is still at 5 volt.
My sensor input is also at 5volt, but the max output
of that sensor is only 4v, thats where the error was.
I was not trying to lead anyone into error

ken

--- Mauricio Jancic <RemoveMEinfospam_OUTspamKILLspamjanso.com.ar> wrote:

{Quote hidden}

> > {Original Message removed}

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