Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

2 BIG problems concerning AVR

Status
Not open for further replies.

abouras

Member level 2
Member level 2
Joined
Dec 21, 2001
Messages
44
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
330
I have two major problems and i really need anyone's help

1) I can't make ADC of 8535 to convert right. I have tried the sample program of BASCOM AVR and i have tried some of my routines but with no result. I connected AREF to AVCC and both with one resistor 100OHM to VCC and with one capacitor to GND. Also i have connected AGND to GND. I tried to give some sample voltages directly to the ADC using a potentiometer or using an LM741 buffer. NO RESULT!!!. Also when i connected the ADC input directly to GND i got Value 0 and when i connected it to VCC i got value 1023. I couldn't take intermediate values. WHAT THE F.....CK IS WRONG???????

2) I want to make an RTC with 8535 so i connected a 32768 crystal to TOSC1 and TOSC2. The crystal seems that it is not oscillating. What is wrong? The crystal is (32768, 13HCJ-30, 96-26). Do i have to connect any external capasitors or something else????


Any help is welcome

PLEASE HELP ME!!!
 

It's possible, the power from crystal is to smal (smal crystal)? You can make a oscillator with external chip.

Gomez
 

Hi,

If the ADC has several channels such problem could appear if there is no time to settle down the voltages.

I mean, if you measure channel 1 then 2 and so on , then you need time after you select the channel to charge the internal capacitors of ADC. Only after that time you can start the conversuion. If you dont' do this, then you read wrong values like in your case - they are somehow connected wuth input voltage, but they are not what you want.

Regards
Luben
 

adc

hi .. i am doing lots of adc measurements with mega103/128 without any problem. HW problems can be:
- too big clock rate for ADC .. check register settings and datasheet .. in this case the result can be very inaccurate
- problems with power decoupling .. apply abt 100k capacitor as close as possible to chip between gnd and vcc, gnd and avcc and gnd and avref.
I did not meet any other problems besides of these.
second proble: i do not knopw for 35 but for megaXXX you need jut connect crystal to pins .. not caps aor anything else

regards

cancel
 

There may be only one time ADC interrupt, then it can not interrupt.Try to use requiry mode or Continue ADC mode.
 

I'm using the ADC of the 8535 with these settings:

AREF = VCC
AGND = GND

I use channel 0 for measurement

My code:

void adc_init(void)
{
ADMUX=0x00; // ADC0 selected
ADCSR=ADCSR|(1<<ADEN)|(1<<ADFR)|(1<<ADSC)| (0x07); // ADC enable, Prescaler =2 , freerun
}

Getting Data:

char addl,addh;
while ( !(ADCSR & (1<<ADIF)));
ADCSR|=(1<<ADIF);
addl=ADCL; // get low data
addh=ADCH; // get high data

......

is in written in C but I hope it will help you
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top