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
4 answers

((void(*)(void))0)() is Exit function?

I was trying to write my own boot loader on Atmel AVR Microcontroller. I have referred one of the code base from github. I would like to thank for the code base to ZEVERO At primary level I understand the code base. but at line 224 I found a…
Vardhman Patil
  • 517
  • 6
  • 22
0
votes
1 answer

What does "expected '=', ',', ';', 'asm' or '__attribute__' before 'char'" mean? AVR

// Sting for the Name extern const PROGMEM char name[]; //Data structure of the Heap typedef struct { AllocStrategies strategy; uint16_t size; MemAddr start; MemDriver* driver; const PROGMEM char name[]; }Heap; expected '=', ',', ';',…
eddy
  • 73
  • 8
0
votes
1 answer

Assembly executing ButtonClick state only once

I'm working on a simple button-led project using Atmega2560 microcontroller. I have a problem with the buttons. When I click the button, main loop stops working and button function keeps running infinite times as long as I'm pressing the button.…
Dentrax
  • 574
  • 8
  • 22
0
votes
0 answers

AVR LED Example

I have the following code for testing an LED: configGlobal.h #define F_CPU 1000000UL #define setBit(sfr, bit) (_SFR_BYTE(sfr) |= (1 << bit)) #define clearBit(sfr, bit) (_SFR_BYTE(sfr) &= ~(1 << bit)) #define toggleBit(sfr, bit) …
sesc360
  • 3,155
  • 10
  • 44
  • 86
0
votes
1 answer

AVR ATMEGA328p BAUD Rate Error / No Serial Connection

I cannot get my serial connection running to test my AVR chip. I currently assume it is because of the F_CPU value, but I am not 100% sure. The manual error i defined for #error Systematischer Fehler der Baudrate größer 1% appears when loading the…
sesc360
  • 3,155
  • 10
  • 44
  • 86
0
votes
2 answers

How is recursion possible in AVR Assembly?

I can't seem to wrap my head around recursion in Assembly Language. I understand how it works in higher level languages, but I don't understand how it is possible in assembly when the return value cannot be passed directly to the function. I'm…
0
votes
1 answer

ESP8266 reboot loop in "memcpy_P" function

I'm trying to modify code that was initially designed for Trinket board (ATTiny85). It compiles properly for ESP8266-12E board (NodeMCU1.0). But unit is rebooting when loading image to memory. Lines with: memcpy_P(palette, imagePalette, 2 *…
Keralots
  • 1
  • 1
0
votes
1 answer

TWI on ATMega 2560 wait's in infinity loop

I get some stupid error's if I want to try initialise the connection from the TWI master to the bus. The start condition will be send but the processor waits in the infinity loop bevor starting to send the slave address to the bus. I also have…
FoxPixel
  • 101
  • 5
0
votes
1 answer

Questions about registers in Assembly Language

For code like: ;; Data definitions go here .section .data n1: .byte 12 n2: .byte 34 n3: .byte 21 n4: .byte 10 result: .space 1 ;; Code definition goes here .section .text .global main main: push R17 ldi R26, lo8(n1) …
승기유
  • 133
  • 9
0
votes
1 answer

AVR 8 bit timer - what to do when compare value doesn't fit in register?

Recently, I started programming the Atmega328P in pure c/c++, without all the arduino libraries and arduino IDE. I want to blink an LED at a rate of 1Hz (1 sec. on, 1 sec. off). Unfortunately, I can only use Timer0, an 8-bit timer. The mcu has a…
user7353781
  • 155
  • 2
  • 10
0
votes
2 answers

ATTiny 13 wake up from sleep mode

I'm trying to put my ATTiny into sleep mode and than wake it up. I use this code to put it to sleep: void go_to_sleep(){ is_sleeping = true; RED_HIGH; YELLOW_HIGH; GREEN_HIGH; sleep_enable(); sei(); sleep_cpu(); sleep_disable(); } Than I use…
Piotr Konopacki
  • 85
  • 1
  • 2
  • 7
0
votes
1 answer

Uart issue in Atiny167 Controller

i am trying to get an data over uart of Attiny167,in interrupt mode at baud rate of 57600 but when i debug the programme i only receive CR & LF no data i am receiving why is it happening in this controller below is my code: #define CPU_CLOCK_FREQ…
pranjal khanduri
  • 351
  • 1
  • 3
  • 16
0
votes
2 answers

32-Bit variable shifting in 8-bit MCU

I'm using 32-bit variable for storing 4 8-bit values into one 32-bit value. 32_bit_buf[0]= cmd[9]<<16 | cmd[10]<<8| cmd[11] <<0; cmd is of unsigned char type with data cmd [9]=AA cmd[10]=BB cmd[11]=CC However when 32-bit variable is printed I'm…
Vinod kumar
  • 67
  • 1
  • 11
0
votes
1 answer

Transmission using SPI in AVR

When will SPIF bit in SPSR will reset after transmission of data Suppose void SPITransmit(uint8_t data) { SPDR = data; while(!(SPSR & (1<
Ganesh S
  • 21
  • 1
  • 4
0
votes
2 answers

pgm_read_ and PROGMEM - unexpected behaviour

I made a program that plays a song (using buzzer) saved in array: (...) //function which plays a single note void playNote(int8 wavelength, int duration) { if (wavelength != 1) { OCR0A = wavelength; /* set pitch */ SPEAKER_DDR |=…
Mariusz
  • 25
  • 1
  • 5