AVR-GCC is part of the GNU Compiler Collection (GCC) collection of open source compilers that targets the popular AVR microntroller produced by Atmel. It supports both the C and C++ languages.
1
vote
1answer
50 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 ...
0
votes
2answers
77 views
Arithmetic Overflow ATmega328
I have written the following function to calculate the current timestamp (since 00h Jan 1 1900). The output I get is:
...
2
votes
2answers
83 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 ...
3
votes
1answer
57 views
avr-gcc timer overflow interrupt handler in inline assembly
My current project involves producing 200KHz PWM waveforms using timer 1 in fast PWM mode. I would like to increment a 16-bit counter every time the timer overflows (every 5μS)
...
3
votes
1answer
66 views
AVR USART Random Behaviour
I seem to be getting random character in my USART output with an ATMEGA8
uart.c
...
2
votes
1answer
92 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 ...
1
vote
0answers
95 views
Mystery while driving a NeoPixel Ring (WS2812) with a GEMMA (ATtiny85)
I am working with an Adafruit GEMMA and NeoPixel Ring 16 LEDs (ATtiny85 and 16 WS2812 leds) and trying to get a program to light the LEDs according to my "pattern" structure below, representing R, G, ...
2
votes
1answer
54 views
avr-gcc _delay_ms timings are off; ISP to blame?
I just built an AVRISP with an old Arduino Nano (ATmega328p), and I tried to flash a simple blink program onto an ATmega328 (non-picopower). The first time I flashed the program, everything worked out ...
3
votes
1answer
130 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
1answer
403 views
How to store array of values in EEPROM of ATmega16 and then read it in sequence
I have this program in which I can store a single value in EEPROM. Can I store an array of values in EEPROM? How?
...
0
votes
1answer
112 views
How to store OCR1A value in ATmega16
I am working on a robotics project. Using timers in ATmega16, I am controlling servo motors.
By incrementing the value of OCR1A I am manipulating the servo motor. After getting the desired position of ...
1
vote
1answer
186 views
Understanding Program Size - ATMega328P
I am interested in finding out the memory usage of my code running on an ATMega328P (16 MHz) using the avr-size utility bundled with WinAVR 20100110. Using the ...
1
vote
2answers
713 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, ...
2
votes
1answer
165 views
AVR ISR causes unexpected behavior
Using avr-gcc 4.8.0 and avr-libc 1.8.0 on Arch Linux. Trying to get UART RX interrupts working on an ATtiny2313 with this simple code which should echo the received byte:
...
2
votes
1answer
58 views
AVR:LDI instruction
In 8bit-avr instruction set, instruction LDI is defined as LDI Rd,K;
For example LDI R16,$10; and it takes 1 cycles to complete.
In the same document i read that we can change register Rd specific ...
0
votes
0answers
55 views
GLCD t6963 auto write problem
I am trying to send data to a 128x240 display driven by t6963 in autowrite mode by ATMega128 under AVR-GCC.
the code gets stuck when checking DAWRDY bit ( to see if the driver is ready for receiving ...
4
votes
3answers
512 views
'bit' type for AVR Microcontroller programming
I have written a code for 8051 microcontroller, where I used bit type, something like this:
...
0
votes
1answer
173 views
Problem changing system clock frequency
I have an ATtiny85 and I'm trying to set the clock to 8 MHz. I have read the data sheet and some discussions on how to do this but am not having any luck getting it to work. I have included my code ...
1
vote
1answer
106 views
How to change PORTx register in other place of program?(Codevision & AVR-GCC)
I have a question related to AVR microcontrollers using AVR-GCC and CodeVision:
Normally we set the port related registers inside the main function using DDRx/PORTx registers, for example like this:
...
3
votes
1answer
129 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 ...
1
vote
1answer
233 views
AVR-GCC: Ports Undeclared when compiling
My Setup
I'm running Ubuntu 12.10, and I want to be able to use gcc and avrdude to compile and program my ATmega328.
I followed this Ladyada tutorial: Ladyada AVR Tutorial
Everything installed ...
2
votes
3answers
638 views
Short String overflows.text area on ATtiny85, Arduino IDE
I'm using the Arduino IDE with arduino-tiny (https://code.google.com/p/arduino-tiny/) on an ATTIny85. My code is maxing out the RAM, or so it seems:
Adding a ...
1
vote
2answers
589 views
Minimum files for Atmega1284p AVR-GCC?
does someone have the minimum setup (ie. a 1284p Makefile and an example blink.c) for an ATMega1284p and AVR-GCC? I seem to be ...
5
votes
1answer
1k 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
73 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
647 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
2k views
AVR GCC : Global / Static Array not getting initialized properly
Im having problem with global arrays in my C code. What i am trying to do is to use a display buffer (array of 8 uint8_t with each uint8_t representing a row) to light up the leds in 8x8 led matrix ...
4
votes
2answers
123 views
Global Array Size Affects Clock Frequency Only On Linux (avr-gcc)
I am having the most peculiar problem. When the size of a global array changes, it alters the clock frequency of the ATmega164a. This is on Linux. When compiled on Windows, this problem doesn't occur ...
0
votes
3answers
756 views
Serial communication in Atmega128
I want to send some string to PC via serial port. In cute com (software) its displaying the string but with some chars missing. Also some hex numbers are appended at the start and end of the string. ...
1
vote
2answers
211 views
ATMega16: Run a subroutine for a limited time
I have a problem on ATMega16. I can't seem to be able to make a subroutine run for a set amount of time. Here is the code:
...
1
vote
1answer
2k 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 ...
-1
votes
1answer
477 views
Merge 2 chars from UART and convert into HEX value [closed]
I receive two characters from the UART:
char UD[2] = {'B','8'}
I need convert this into a hexadecimal value, like:
...
3
votes
3answers
2k views
Fastest moving averaging techniques with minimum footprint
I have tried few running averaging techs for smoothing the change in ADC data in AtMega48 for controlling lights(PWM) when rotating a pot(ADC).
The filters (pseudo codes):
Moving average:
...
3
votes
1answer
281 views
Easiest way to get rid of __clz_tab in winavr compiled code?
I've ported a program from the arduino environment to a makefile build using winavr, which, in turn, is based on avr-gcc (just like arduino).
However, my program started crashing, and after some ...
1
vote
3answers
592 views
Documentation on `avr-as`
I'm starting learn AVR microcontrollers. But my OS is Linux. I have installed avr-binutils with avr-as. But I can't find ...
3
votes
2answers
3k 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
1k 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.
...
3
votes
1answer
2k views
How do I create a static library for the AVR Atmega328p?
I am attempting to create a library much like the Arduino in C.
I have tried in the past and although I have lost the code, I remember simply getting loads of undefined references to functions ...
2
votes
2answers
539 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 ...
4
votes
1answer
843 views
Modifying Interrupt Vector Table of Atmega32
A project that I'm working on involves a cycle accurate interrupt service routine. This routine is written in AVR Assembly where I just wrote:
...
4
votes
1answer
1k views
Overflow interrupt firing only once
I've run into an issue where, it appears, my interrupt only fires once, then simply refuses to fire again on my ATMega32U2. I have the following (stripped down) code:
...
3
votes
1answer
784 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 ...
1
vote
3answers
2k views
AVR: problem with inline assembler
WinAVR seems to produce a lot of useless code, e.g. for following C method
ISR(INT0_vect) {
TCCR1B = 0x09;
}
it produces (...
3
votes
4answers
729 views
Excessive AVR static RAM usage with mixed-type math operations
I've narrowed down an issue in my code which creates an extra 260 bytes of static RAM usage:
...
0
votes
1answer
776 views
avr-gcc(4.4.2)/avr-libc linker issues
So this seems to be a generic issue. "libc.a" is associate with some sort of incompatibility with floating point math and/or the correct library used.
I've added the "-lm" as suggested on the forums, ...
0
votes
1answer
219 views
Mac based AVR development issue
Ok, so I reinstalled my development enviroment on the mac using the latest build of avr-gcc (4.4.2), avr-libc and avrdude from the Fink project.
Problem is when compiling I keep on getting a linker ...
5
votes
2answers
2k views
Macros V/S inline functions while programming for avr-gcc
I have been doing my first serious work of programming these days. I have been exposed to a lot of code by different developers. One thing I find confusing is how do these developers decide when to ...