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
0
votes
1 answer

Modify the return address of function on avr

I have mixed C code with assembler to understand task switching on AVR. This is only for my personal academic use and I know there is freeRTOS but I want to understand. At the moment I'm struggling on how the return address is stored on the…
Gustavo
  • 919
  • 11
  • 34
0
votes
2 answers

Generating output with 20% duty cycle using only one counter

If i have micro with no PWM module , how to generate output of duty cycle (20%) on pin 1 , and output with duty cycle(80) on pin2 using one counter and interrupt not polling.
W.Wafi
  • 11
  • 2
0
votes
1 answer

Combine macro definition in order to obtain multiple definition at once [avr C++]

Sorry for my lack in knowledge about preprocess code and macro definition, but i'm trying to work on #define macros in order to make more efficient my avr code. I want to develop a driver routine to manage a 1-wire digital thermometer. My purpose is…
Buzz
  • 1,102
  • 1
  • 9
  • 24
0
votes
1 answer

How to calculate distance travelled by Robot in avr

Here, I want to calculate distance travelled by robot in atmega 2560? I know the formula distance = Wheel's circumference * motor's rotation in rpm. But I am not getting how to apply this formula for the following problem. What is the approximate…
0
votes
1 answer

Assembler loop does not execute properly

I've created a simple assembler subroutine (asmFunction) that is supposed to toggle the output of PORTD every 10 ms. Here is the assembler source code : #define __SFR_OFFSET 0 #include .section .text ; Defines a code…
Bill2462
  • 81
  • 10
0
votes
1 answer

Why setting uart to double speed mode when gives the right output and normal mode with same baud rate doesn't in atmega32?

To get right output I had to set U2X bit to one and when I set it to zero and change value of UBRR Register the output makes no sense. I checked that I'm using right values from datasheet table but it doesn't give right output at U2X=0. my .h…
Hussien Mostafa
  • 159
  • 2
  • 18
0
votes
1 answer

How can I port IAR AVR assembly smac_24 to GCC?

I'm trying to use the IIR filter from application note AVR223, which is written in the IAR dialect of AVR assembly. The main reason being that in C you can only do full 32*32=32 bits multiplications. So I'm especially interested in the following…
Pepijn
  • 4,145
  • 5
  • 36
  • 64
0
votes
1 answer

performing logical NOT based on configurable data

I would like to configure my switch input type as either active high or active low. I wrote below code and I know it will not work because I when I multiply by 0, nothing works. One way is to write code to check ACTIVE LOW using if statement and…
Rajesh
  • 1,085
  • 1
  • 12
  • 25
0
votes
1 answer

Why I can't use SRAM to store my data?

I wrote this simple blinking light program for Arduino Micro: void main() { *((volatile unsigned char *)(0x27)) = 128; volatile unsigned char x = 0; volatile unsigned char y = 0; volatile unsigned char z = 0; start: *((volatile unsigned…
user983447
  • 1,598
  • 4
  • 19
  • 36
0
votes
1 answer

Using I2C_master library AVR

I am using I2C_master library for AVR, Communication works fine, but I have little problem, how can I get data. I am using this function uint16_t i2c_2byte_readReg(uint8_t devaddr, uint16_t regaddr, uint8_t* data, uint16_t length){ devaddr += 1; if…
0
votes
1 answer

AVR linker scripts: why start data memory at 0x60?

I don't have much experience with linker scripts, so maybe I'm just misunderstanding something here. The LD linker script for the ATmega32u4 (avr5.x) specifies that data memory (SRAM) starts at 0x800060. I know that 0x800000 is just a special offset…
David Brown
  • 35,411
  • 11
  • 83
  • 132
0
votes
1 answer

Confused about dtostrf function

I am currently working on a personal AVR project and wrote a function for transmitting a double to my serial LCD screen using UART. For this, I convert a double into a char array and then transmit it char by char, serially. What confuses me is what…
Shibalicious
  • 288
  • 2
  • 4
  • 14
0
votes
2 answers

ATtiny85 I2C SSD1306 screen not working

I have been on this issue for more than 3 days now after I got my SSD1306 I2C in the mail. I have a Tiny Programmer from Sparkfun, which I use with a breadboard. This is my pin layout: pin2-->SDA, pin3-->SCL. The documentation on the SSD1306 Arduino…
0
votes
1 answer

Most efficient linear interpolation using integer fraction

I’m playing around with Direct digital synthesis wavetables on an Atmega328. Given an 8-bit fractional value F, and two 8-bit values A, B, what would be the most efficient way to calculate the linear interpolated value between A and B? I can think…
0
votes
1 answer

Error while using custom library "undefined reference" [AVR]

I am using Eclipse in order to program a PID line follower robot. The microcontroller used is an Atmega328P. For that, I am using one QTR-8RC IR sensor, by Pololu and two modified servos for continuous rotation. I and my partner decided to use the…