Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic 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.

Register Log in

2 BIG problems concerning AVR

Status
Not open for further replies.

abouras

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!!!
 

Gomez

Full Member level 2
Joined
Feb 12, 2002
Messages
125
Helped
10
Reputation
20
Reaction score
3
Trophy points
1,298
Activity points
1,006
It's possible, the power from crystal is to smal (smal crystal)? You can make a oscillator with external chip.

Gomez
 

luben111

Advanced Member level 1
Joined
Mar 2, 2002
Messages
490
Helped
111
Reputation
223
Reaction score
107
Trophy points
1,323
Location
UK
Activity points
3,885
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
 

cancel

Full Member level 5
Joined
May 27, 2001
Messages
251
Helped
15
Reputation
30
Reaction score
4
Trophy points
1,298
Activity points
1,878
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
 

majim

Newbie level 6
Joined
May 5, 2002
Messages
14
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
30
There may be only one time ADC interrupt, then it can not interrupt.Try to use requiry mode or Continue ADC mode.
 

revolt

Full Member level 2
Joined
Feb 3, 2002
Messages
121
Helped
4
Reputation
6
Reaction score
1
Trophy points
1,298
Activity points
1,008
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.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top