All Questions

Tagged with
0
votes
1answer
68 views

(Noob question) Placing parts of a byte in different (parts of) registers

Background: I'm trying to get a gLCD working with an Atmega328p. I got it to work quite easily, but there was one catch: the library that I found, used portB for the datapins. This was unacceptable, ...
0
votes
0answers
40 views

Cannot Disable AVR ATmega32 Watchdog

I'm writing a code to enable and disable the watchdog timer in ATmega32. I'm using the function in the datasheet that disables the wdt. Also, I'm toggling led in the beginning of the code to know if ...
1
vote
2answers
70 views

SPI between ATmega32 and ATmega328 is not working

I have been trying to accomplish connecting ATmega32 and ATmega328 using SPI Hardware connections: ...
1
vote
2answers
349 views

Atmega32 ADC Value not accurate

I was trying to simulate on proteus ADC with potentiometer and get the reading to control dc motor with PWM it's working but the problem is the ADC value not accurate. ADCH reach max value before ...
1
vote
1answer
229 views

UART with PC : Reciving absurd characters in PC

I am working on a project using Atmega16 micro-controller of AVR family. I am using UART for my project. I need to send data to my PC AT 9600 baud rate via an USB-TTL converter and view the data using ...
0
votes
1answer
2k views

AVR 10ms timer with 8MHz clock

I want to generate a 10ms timer using ATMEGA32. The crystal used is 8MHz. Is this calculation correct TCNT0 value is correct.The prescaler value i used is 1024. is the calculation and the value 78 ...
1
vote
2answers
362 views

avr-gcc float macro error

When I try to compile some code with macro definition at the following definition # define _SPEED_FACTOR0 0.9 //or any float value I get the error floating ...
1
vote
2answers
1k views

clock frequency confusion

I am using an atmega16 micro controller with a 12MHz external crystal oscillator. But I came to know that the internal clock frequency is 1MHz I need to calculate UBRR value for serial communication. ...
0
votes
2answers
415 views

Atmega 16 - Timer0 with interrupt

In this code the one LED is glowing at one pin PC0 with flash every 50 ms. It has XTAL of 16 MHz. With CPU frequency 16 MHz, even a maximum delay of 16.384 ms can be achieved using a 1024 prescaler. ...
0
votes
1answer
382 views

ADC neglects input voltage (ATMega32)

In the following AVR code, why do I always see the same voltage for all pins of port A? I am using ATMega32. BTW, when I am grounding some pins of port A I do not see any change in the output. It ...
-1
votes
1answer
987 views

atmega32 is working OK but atmega32A is NOT!

I have a board which there is an LCD on it and I want to show some lines in the LCD. I have a broken-pin Atmega32 which the broken pins didn't used for LCD, I have written a simple code which just ...
1
vote
1answer
429 views

AVR SPI2X has no effect

I've got an ATMega88A configured to run on internal 8MHz clock: lfuse = 0xE2 hfuse = 0xDF efuse = 0x01 F_CPU defined as 8000000 This in confirmed in the 'real ...
2
votes
1answer
918 views

AVR program code location

I'm working with an ATmega328P and I wanted to interface with the flash memory writing data to it with the macros provided by avr-libc. This is the memory map for my chip: ATmega memory map http://...
0
votes
1answer
1k views

Writing flash on ATmega328

I have struggled to understand this code but I can't understand the little endian for loop. Why is it necessary? And how could I read the page back? One byte at a time as an array? Is it even possible?...
1
vote
1answer
742 views

ATmega128 Extended I/O

This is my fist time working with a "bigger" micro controller, ATmega128. So far I've worked with ATmega328, ATmega8 etc. Reading through the datasheet, I didn't understand couple of points That ...
3
votes
2answers
3k views

Interrupt Management - Large AVR Projects

This is for the more experienced one's out there. I am currently involved with a large AVR project (using ATMega328) and it's getting confusing with respect to interrupts. The project involves ...
2
votes
1answer
769 views

Number must be positive and less than 64

Im working with an ATMEGA328P, making a bit of USART code. I used asm linked with C, with no less than 7 building errors. All those were same "Number must be positive and less than 64". Yes, I have ...
3
votes
1answer
837 views

Using a variable as array index - Optimization Bug?

I discovered a bug in my code which only turns up if avr-gcc optimization is used. Can somebody explain whats the problem here? I'm aware that there are several smart ways to achieve some PWM, but ...
2
votes
3answers
8k views

Blinking LED with ATMega8 won't blink

As I'm a complete novice, I thought I'd start with something really simple: making a led blink. According to several websites, this is something everyone should be able to do... Hmmm... In my case, ...
3
votes
1answer
319 views

LED remains off on ATmega16

I wrote this simple program: #include <avr/io.h> int main(void) { DDRA = 0xff; PORTA = 0xff; while(1) { } } When I program it to my brand new ...
6
votes
1answer
4k views

Programming an ATmega1284p with Arduino IDE and internal RC Oscillator?

I'd like to program an ATmega1284p with my AVR Dragon and the Arduino IDE. So far I have installed mighty1284p (http://maniacbug.wordpress.com/2011/11/27/arduino-on-atmega1284p-4/), after writing my (...
1
vote
1answer
123 views

How to flash error if a macro is not defined in program

I want my program to flash compile time error like "LCD_PORT not defined" if it is not defined in program itself. For that I modified the header file like this ...
1
vote
1answer
2k views

Pointer Size using eeprom.h with ATmega328p in AVR-GCC

I am working on a project that randomly reads and writes large blocks of data from EEPROM, based on user input. I have used the EEPROM before, but I never really thought about this. In the operations ...
1
vote
2answers
9k views

Converting from int to string for AVR ATmega32

I am trying to read data from the ADC and display it on a HD44870 compatible LCD with an ATmega32. As the data from the ADC is a 10-bit unsigned integer, the LCD expects a string, some conversion is ...
3
votes
2answers
6k views

ATMega8 - PORT C - Digital Output Issue

What I am trying to do is set pin PC0 of PORT C as output to light an LED. The code I am using for that is: ...
6
votes
3answers
4k views

Setting pin to high in function instead of main, not full voltage output?

I have a function which turns on a LED by setting PB1 to HIGH. The light from the LED is barely visible. If I set PB1 to HIGH in my main function the light from the LED is as bright as it should be. ...
4
votes
2answers
2k views

Accessing data past 64k boundary on atmega1280

I need to be able to store and refer to constant data arrays which must be placed after the 64k boundary in the atmega1280. How do I create the correct data structure, and then access it for the ...
3
votes
1answer
2k views

PB7, PD7 (on ATMega32) won't work when pull ups enabled. Also PC6 and PC7 don't show output

I am making 16*16 keypad(on PORTB and PORTD) with ATMega32 using proteus 6.9 and AVRstudio5. My problem is PB7 and PD7 won't work when pull ups on those pins are enabled. Here PD7 is output, so no ...