Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

help required 16F690 ADC

Status
Not open for further replies.

mastero

Member
OSCCON = %01110000
ADCON0 = %10000001
ADCON1 = %00010000


ANSEL = %01110111
ANSELH = %00001100

TRISA = %00000111
TRISB = %00110000
TRISC = %00000111

Define ADC_CLOCK = 3
Define ADC_SAMPLEUS = 50


Dim a2d_0 As Word
Dim a2d_1 As Word
Dim a2d_2 As Word
Dim i As Byte

Define SEROUT_DELAYUS = 5000

WaitMs 1

For i = 20 To 0 Step -1

Adcin 0, a2d_0 'get the voltage from a2d_0

WaitMs 5
Serout PORTC.6, 9600, "FIRST: ", a2d_0, CrLf

WaitMs 5

Adcin 1, a2d_1 'get the voltage from a2d_1
WaitMs 5
Serout PORTC.6, 9600, "SECOND: ", a2d_1, CrLf

WaitMs 5
Adcin 2, a2d_2 'get the voltage from a2d_2
WaitMs 5

Serout PORTC.6, 9600, "THIRD: ", a2d_2, CrLf

Next i

End


PIC16F690 8MHZ INTERNAL OSC

Hello cant get the ADC result what am i missing any idea ?

regards
mastero
 
What's not working... What results are you getting... If you are printing a number to the serial port you need to put a "#" infront of the number so th compiler knows you want to change to ascii..

Code:
Serout PORTC.6, 9600, "THIRD: ", #a2d_2, CrLf
 
My bad :(

Knew i was missing something small ..

One quick question i want to read a voltage from the input 0~5vdc

and compare it with another input so should i store the data as ASCII ?

thanx

mastero
 
Doesn't matter how you store it.... But comparing integers is easier than comparing strings ... So do the comparison as integers...

Shifting integers out the serial port is easy as well... So my answer is to store as integers..
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top