How could these program compiled?

17 posts / 0 new
Last post
Ghulam Mustafa
knowledgeseeker's picture
Offline
Joined: 21/06/2012
Posts: 11
Points: 45
How could these program compiled?

hello,

I am new to AVR, pls inform me how could the programs code given on your website could be compiled and how could their hex file be generated.

If any tutorial of this is present pls also give its link

thanks

Amrith
amrith's picture
Offline
Joined: 23/04/2012
Posts: 224
Points: 1000

Hello Mustafa,

Use AVRStudio4 for compiling the code given on Engineer garage for AVR microcontroller. Google AVRStudio4 user guide for tutorial & procedures.

Ghulam Mustafa
knowledgeseeker's picture
Offline
Joined: 21/06/2012
Posts: 11
Points: 45

Thanks alot

I have programmed the AVR, http://www.engineersgarage.com/embedded/avr-microcontroller-projects/adc-circuit but LED's are flashing continously, while when i switch them to Gnd all are Off, and when Vcc is supplied all are High.

While when connected to Pot, they flash with different values.

What might be the problem now?

Ghulam Mustafa
knowledgeseeker's picture
Offline
Joined: 21/06/2012
Posts: 11
Points: 45

Thanks alot,

I compiled and burn the program on the chip, i am facing a problem that the LED present at the output are continously blinking if i provide some voltage on the adc pin, otherwise if i connect this pin to VCC or GND, they are continously high or low.

Pls guide what could be the problem now.

Thanks again

AJISH ALFRED
ajishalfred's picture
Offline
Joined: 10/01/2012
Posts: 793
Points: 3605

 

Hi Ghulam,

I think there is some issues with the reference voltage to the ADC. Have you connected the pin32 (adc reference) to VCC as shown in the circuit?

Well, try this also. Remove the capacitor and directly connect the reference pin to VCC.

Ghulam Mustafa
knowledgeseeker's picture
Offline
Joined: 21/06/2012
Posts: 11
Points: 45

I tried it all but the program is not running. Also when i simulated the circuit in Proteus it is working correctly, while not on the bread board.

Also another simple circuit has the same problem

Pls guide what migt be the problem and how it could be resolved.

Thanks

Amrith
amrith's picture
Offline
Joined: 23/04/2012
Posts: 224
Points: 1000

Hi Gulam,

1. what external oscillator you are using. Kindly mention.

2. Give the capacitors values used at external oscillator.

3. check with your harware connections, if possible share your schemtic to verify.

Ghulam Mustafa
knowledgeseeker's picture
Offline
Joined: 21/06/2012
Posts: 11
Points: 45

Fuse bits settingHello,

I am using the following cofiguration for the atmega16 controller.

I think that the last reason may be this issue.

Kindly check and inform if this is the main issue.

Thanks

 

Ghulam Mustafa
knowledgeseeker's picture
Offline
Joined: 21/06/2012
Posts: 11
Points: 45

Hello Amrith

Thanks for replying, i have mentioned the link which i am following to develop the circuit. Actually i doesnt contain any external oscillator.

Thanks

Amrith
amrith's picture
Offline
Joined: 23/04/2012
Posts: 224
Points: 1000

Hi Ghulam,

I have gone through the link mentioned by you, i think external oscillator is missing in the circuit between pin no. 12 & 13 & there is no internal oscillator enabled in the code. Suggest you to put an oscillator with value 8Mhz and try.

Amrith
amrith's picture
Offline
Joined: 23/04/2012
Posts: 224
Points: 1000

Please correct me if i'm wrong any where.

Ghulam Mustafa
knowledgeseeker's picture
Offline
Joined: 21/06/2012
Posts: 11
Points: 45

Thanks very much

Two thinks to ask before implementing.

1- this program was simulated on Proteus and was running well without the oscillator

2- Is there any prblem in the fuse bits

Pls reply so that i may implement it now

Ghulam Mustafa
knowledgeseeker's picture
Offline
Joined: 21/06/2012
Posts: 11
Points: 45

I have added 4Mhz crystal now, but still facing the same error.

I have tried some other program which is running correctly.

So the problem, i think is in the code. http://www.engineersgarage.com/embedded/avr-microcontroller-projects/adc-circuit

Kindly check it and inform me, why the ports are continously blinking.

Thanks

Ghulam Mustafa
knowledgeseeker's picture
Offline
Joined: 21/06/2012
Posts: 11
Points: 45

i think that the coder has send all the 10 bits to port b this is the reason that the port is flashing. What do you ppl think?

Ghulam Mustafa
knowledgeseeker's picture
Offline
Joined: 21/06/2012
Posts: 11
Points: 45

An important observation:

When the input voltages are less than 2V this error doesnt occour!

Ghulam Mustafa
knowledgeseeker's picture
Offline
Joined: 21/06/2012
Posts: 11
Points: 45

Hello,

I have found this program and is working wel for AVR ATmega16 for ADC conversion and wanted to share

 

I found it in Avr Microcontroller's Book by Mazidi
.INCLUDE "M16DEF.INC"
LDI R16,0xFF
OUT DDRB,R16
OUT DDRD,R16
LDI R16,0
OUT DDRA, R16
LDI R16,0x87
OUT ADCSRA,R16
LDI R16,0xC0
OUT ADMUX, R16
 
READ_ADC:
SBI ADCSRA,ADSC
KEEP_POLING:
SBIS ADCSRA,ADIF
RJMP KEEP_POLING
SBI ADCSRA,ADIF
IN R16,ADCL
OUT PORTB,R16
IN R16,ADCH
OUT PORTD,R16
RJMP READ_ADC
 
Amrith
amrith's picture
Offline
Joined: 23/04/2012
Posts: 224
Points: 1000

Hi Ghulam,

Strange issue. I'm working on it, will let you know if any solution found. Till then keep trying to solve it.

Login or register to post comments
You are here