PDA

View Full Version : Doubts with 18LF6720



Pimentel
- 20th April 2009, 23:26
I need help with 18LF6720, because my project works only when the 19 and 20 pins (AVDD and AVSS) are without conection. I do not using analog features in my circuit.
I would like also a sample of configuration fuses and basic registers (most important as CMCON, ADCON1...) to analyze.
Somebody has know how about 18LF6720, a program sample to help me?

Thanks

Pimentel

Charles Linquis
- 21st April 2009, 05:19
This is part of my header




DEFINE OSC 40
' Set for 40Mhz operation
DEFINE NO_CLRWDT 1
DEFINE _18F8722 1

DEFINE HSER_RCSTA1 90H
DEFINE HSER_TXSTA1 24H

DEFINE HSER_RCSTA2 90H
DEFINE HSER_TXSTA2 24H

DEFINE HSER_CLROERR 1
DEFINE HSER2_CLROERR 1

DEFINE CCP1_REG PORTC
DEFINE CCP1_BIT 2
DEFINE LOADER_USED 1 ' Bootloader
Define USE_LFSR 1
DEFINE ADC_BITS 12
DEFINE ADC_CLOCK 6
DEFINE ADC_SAMPLEUS 8
DEFINE Pulsin_MAX 18000
DEFINE I2C_SLOW 1




TRISA = %11111111 '
TRISB = %00111111 '
TRISC = %10111111 '
TRISD = %01100111 '
TRISE = %11111111 '
TRISF = %11111111 '
TRISG = %00000100 '
TRISH = %00111111 '
TRISJ = %00011100 '


ADCON2 = %10000110 ' Right justify 10 bit output, Clock = Fosc/64
ADCON1 = %00010101 ' Set Vref on RA3, 9 chan A/D (AN0-AN8)
ADCON0 = %00000001

PSPCON = %00000000 ' No PSP
MEMCON = %10000000 ' No External Memory
CMCON = %00000111 ' No Comparator used, turn it off

T0CON = %10001000 ' Timer0 ON, no prescaler 100nSec/Count

CCPR1L = %00010000
CCPR1H = %00000000 ' Initialize to 0, PWM register

PR2 = $7F ' PWM register,78 Khz@40Mhz, 9 bits

T2CON = %00000100

Pimentel
- 23rd April 2009, 00:05
Thanks Charles,

I will to study it. Maybe my problem is ADCON2. I go to read the datasheet again for more details. Thanks again.
And about pins 19 and 20. Do you now if is necessary to conect to VDD and VSS with analog features disable (all pins as diigital I/O)?

Pimentel

mister_e
- 23rd April 2009, 05:50
ALL Vdd, Vss (or relabelled of) available HAVE to be connected, unless, you run into problem, that's for sure. You can even blow your chip... yup, life is cruel sometimes ;)