PDA

View Full Version : 16F676 Help?



vicce
- 4th August 2005, 09:55
dear friends,

I am using a 16f676 and I need help to configure the begin of the program.
I will use porta.0 and porta.1 as analogical and the remaining as digital.
I will use internal oscillator without master clear.

friends help-me in these initial configurations

thank you very much,

vicente de paula neto(Sao Paulo-Brazil)

excuse my terrible English.

Acetronics2
- 4th August 2005, 12:35
Hi, Vicce

Everything you need is here : http://www.farnell.com/datasheets/41570.pdf

or from Microchip main site : http://ww1.microchip.com/downloads/en/DeviceDoc/40039c.pdf

Alain

mister_e
- 4th August 2005, 13:53
I don't want to soud like a broken record but...
To get some example, begin a search with
PORTA AND ADCON => this will lead you to some configuration
Configuration AND fuse => this will lead you to the FAQ on a excellent thread who'll teach you how to find/use PIC fuses (internal osc and such)

Later if you still need some tips, just send what you have tried.

vicce
- 4th August 2005, 17:01
friends,

this is writing for a 16f873 and it is exactly this that I need for a 16f676

Define ADC_BITS 10 ;Set number of bits in result
Define ADC_CLOCK 3 ;Set clock source (3=rc)
Define ADC_SAMPLEUS 50 ;Set sampling time in uS

TRISA = %11111111
ADCON1 = 4 ;Set PORTA analog and right justify result
OPTION_REG = $7f ; Enable PORTB pullups

in the place (pull-up) portb to configure for porta

in advance thankful.

mister_e
- 4th August 2005, 20:43
in the place (pull-up) portb to configure for porta
There's no Pull-up on PORTA. Must use external one wich is always the best pratice... well IMHO.

AND PIC16F676 have internal comparator on PORTA, as i thought, so you must add
CMCON=7
to the top of your code
CMCON=7, click,CMCON=7, click,CMC, click,CMCON, click,CMCON=7, click...

AND, the last one, ADCON1, is not the one you need to set A/D channel. You need to set ANSEL
<img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=406&stc=1">

rhino
- 5th August 2005, 05:26
There's no Pull-up on PORTA. Must use external one wich is always the best pratice... well IMHO.
Although I agree an external pull-up is better....

TFM states...."Each of the PORTA pins, except RA3, has an individually configurable weak internal pull-up."