Questions tagged [avr]

AVR refers to two families of either 8- or 32-bit RISC microcontrollers

The AVR is a modified Harvard architecture 8-bit RISC single chip microcontroller which was developed by Atmel in 1996. The AVR was one of the first microcontroller families to use on-chip flash memory for program storage, as opposed to One-Time Programmable ROM, EPROM, or EEPROM used by other microcontrollers at the time.

External links:

2299 questions
5
votes
8 answers

1k of Program Space, 64 bytes of RAM. Is 1 wire communication possible?

(If your lazy see bottom for TL;DR) Hello, I am planning to build a new (prototype) project dealing with physical computing. Basically, I have wires. These wires all need to have their voltage read at the same time. More than a few hundred…
Earlz
  • 62,085
  • 98
  • 303
  • 499
5
votes
3 answers

AVR Analog Comparator + Internal Pullup?

I have what I hope is a simple question pertaining to the Atmel AVR microcontrollers. So I want to use the ATTiny85's Analog Comparator to determine if a signal is above or below a threshold. This signal is normally "floating" and pulled toward…
vicatcu
  • 5,407
  • 7
  • 41
  • 65
5
votes
2 answers

How do I use arduino libraries with standard C code

I am using Eclipse kepler for AVR development. The code that I have is C (Open Source), and I've gotten it adjusted so it runs perfectly. My target is an ATmega2560, in the form of an arduino mega2560. Using the arduino board is strictly for…
ThesQuid
  • 59
  • 1
  • 3
5
votes
1 answer

Clang compile for AVR/ARM?

I'd like to cross-compile Clang for run on ARM devices and compile for ARM mcu (Cortex M3) or ATmega AVR mcus. Is Clang able to do it? UPDATE: i've found llvm-avr backend for LLVM 3.5: https://github.com/sushihangover/llvm-avr Is anyone except me…
4ntoine
  • 19,816
  • 21
  • 96
  • 220
5
votes
3 answers

Can GCC optimize methods of a class with compile-time constant variables?

Preamble I'm using avr-g++ for programming AVR microcontrollers and therefore I always need to get very efficient code. GCC usually can optimize a function if its argument are compile-time constants, e.g. I have function pin_write(uint8_t pin, bool…
user1150105
5
votes
2 answers

"no 'operator++(int)' declared for postfix '++' [-fpermissive]" on enums

I have got the enum enum ProgramID { A = 0, B = 1, C = 2, MIN_PROGRAM_ID = A, MAX_PROGRAM_ID = C, } CurrentProgram; Now, I am trying to increment CurrentProgram like this: CurrentProgram++, but the compiler complains: no…
HerpDerpington
  • 3,751
  • 4
  • 27
  • 43
5
votes
1 answer

Clang + AVR Compilation error: '=w' in asm

I got this error below and I can not find a solution. Does anybody know how to fix this error? rafael@ubuntu:~/avr/projeto$ clang -fsyntax-only -Os -I /usr/lib/avr/include -D__AVR_ATmega328P__ -DARDUINO=100 -Wno-ignored-attributes -Wno-attributes…
5
votes
3 answers

Sublime Text Build System with multiple commands

First off I would like to say that I am new to sublime text editor and I love it. I have no experience with JSON, however it does not seem difficult at all. I am trying to write a build system that will call a bash script that will move a makefile…
Jesse
  • 901
  • 1
  • 9
  • 25
5
votes
9 answers

I'd like to move on to µC programming, but I have absolutely no idea where to start from

I've been thinking quite some time about 'moving on' to MCU programming, but the problem is I've never worked with any microcontrollers or similar. As I've been told, AVR and PIC are the most common microcontrollers among hobbyists, and apparently…
Hoffa
  • 279
  • 1
  • 8
5
votes
2 answers

AVR programming, interrupt handling

I develop a C application with atmega168a-pu and interrupts. I use the following interrupts: ISR(TIMER0_COMPA_vect); ISR(TIMER0_COMPB_vect); ISR (TIMER2_COMPA_vect); ISR(SPI_STC_vect); ISR(TIMER1_COMPA_vect); ISR (PCINT1_vect); and my code looks…
Johan Elmander
  • 497
  • 2
  • 6
  • 11
5
votes
1 answer

DDS Interpolation - 8bit Atmel AVR ASM to 12 bit DAC

I just completed a DDS project, on an Atmel AVR employing ASM, and have come to the conclusion that an 8 bit look-up table and 8 bit DAC create too much quantization distortion at low frequencies; for lack of better wording, I'm getting a sine wave…
Ted LED
  • 81
  • 4
5
votes
4 answers

Programming a PWM in an Arduino Mega ATmega2560 micro-controller

I'm trying to enable a PWM on an Arduino Mega (ATmega2560), but I'm facing to some issues. First, I'm trying to program this in Ada. I desire to use the three Timer3 channels with FastPWM, so I wrote procedure Main is begin -- Nullify Timer3…
Rego
  • 1,118
  • 1
  • 18
  • 40
5
votes
2 answers

In an avr tiny, how is data meant to be stored in sram initialized when the microcontroler is powered up?

First some background. In an avr tiny, data can be stored in the registers, in the sram, in the eeprom or in the program space. Register and sram are volatile storage while the eeprom and program space are not. (ie: data stay when not powered.) When…
user1443332
  • 341
  • 2
  • 5
4
votes
1 answer

Must AVR programs always start with a relative jump instruction?

All example AVR programs I've ever seen start with code such as the following: .org $0000 rjmp Reset ; ... Reset: ; Start of program If I'm not making use of any interrupts can I do without the rjmp and start the program at $0000?
Matthew Murdoch
  • 30,874
  • 30
  • 96
  • 127
4
votes
3 answers

Unexpected float behaviour in C with AVR atmega8

I've been trying to figure out why I cannot get a sensible value from multiplying an unsigned int with a float value. Doing something like 65535*0.1 works as expected but multiplying a float with a uint from memory creates mad values. I have a…
regomodo
  • 644
  • 3
  • 9
  • 18