All Questions
32 questions
1
vote
2
answers
77
views
How to get an ATtiny24A MCU into sleep mode?
I am experiencing somewhat a peculiar phenomenon. I am trying to get an ATtiny24A into sleep mode. I had a working code before, but through revisions and testing of other parts of my program it seems ...
0
votes
1
answer
79
views
Compiler Truncates Interrupts Vectors of ATmega328PB in Eclipse AVR Plugin
I would normally use Eclipse avr-gcc plugin and (avr-gcc compiler from zaks https://blog.zakkemble.net/avr-gcc-builds) to develop firmware for AVR MCU.
The MCU ATmega328PB has extra timers (3,4), SPI1,...
2
votes
2
answers
114
views
Saturating addition optimization in avr-gcc
I am programing for ATtiny13 and I have to do a lot of saturating additions.
Trying to optimize them, it seems that avr-gcc just doesn't know how to optimize anything at all. All of this was tried ...
-2
votes
1
answer
185
views
How to verify the TIMER2 overflow frequency in AVR ATmega328P?
I have configured the timer2 of ATmega328P in normal mode and overflow at 10000Hz. My code is given below. I was trying to verify the frequency. So I just toggle a pin PB5 on every overflow interrupt....
0
votes
1
answer
132
views
Program behaves differently at different optimisation levels
I have written a simple program to familiarise myself with a new MCU. However, my program does not run correctly at optimisation level -O3.
I am using Microchip Studio (Version 7.0.2594) (formerly ...
4
votes
1
answer
191
views
Sending mutiple characters using USART1 on an atmega4809 results in 0xFF to be send
Solution:
Turns out it did not have anything to do with the USART. The problem was in the Makefile. I reused a Makefile I have been using for atmega328p and atmega2560 for a long time. But this ...
1
vote
2
answers
149
views
Register access suppresses otherwise possible optimization (avr-gcc)
The following code contains a simple example for e.g. an avr128da32 MCU.
One can access a SFR via the old macros like VPORTA_DIR or via a structure mapping like VPORTA.DIR.
#include <avr/io.h>
#...
0
votes
2
answers
608
views
Error in headerfile - stdint.h in codeblocks while building AVR PROJECT
I'm getting a error in stdint.h file, while building the AVR project. Here I'm trying to simulate different driving modes in a car such as comfort, eco and sports mode. I never thought I would get ...
4
votes
2
answers
577
views
Why AVR-GCC compilers append a "clr r1" line after multiplication?
I am trying to check how AVR-GCC compiler compiles for multiplication?
Input c code:
unsigned char square(unsigned char num) {
return num * num;
}
Output assembly code:
square(unsigned char):
...
0
votes
2
answers
506
views
AVR uint8_t doesn't get correct value
I have a uint8_t that should contain the result of a bitwise calculation. The debugger says the variable is set correctly, but when i check the memory, the var is always at 0. The code proceeds like ...
3
votes
1
answer
851
views
why the number of vector of INT0 is 1 not 2 as datasheet?
I am using an ATmega32 to do interrupt
when i trying to do driver of external interrupt 0 , faced me a problem
Interrupt Vectors Table in ATmega32
Interrupt Vectors code in ISR(vector)
In iom32.h ...
0
votes
1
answer
1k
views
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 ...
1
vote
0
answers
1k
views
Using All Interrupt Vector Of A Timer
Purpose
I'm doing some timer experiment on atmega328.
I'm attempting to use every interrupt (except OVF).
Trying to make timer1 act likes 3 individual timers.
This might comes in handy when ran out ...
0
votes
2
answers
1k
views
ATmega8 - Compile and link C and Assembly-files with one Makefile
I'm playing around with the ATmega8 and Assembly.
So I came to the point where it would be nice to have a Makefile, which looks through the folder, grabs every *.S, *.c and *.cpp file, link and ...
0
votes
2
answers
169
views
Same function within different files returns different results
I'm currently writing a library for learning purposes and I've run into a weird problem.
So,
1. I have a function in the main body (main.c) that reads the DDRAM address of an LCD.
2. I move the exact ...