Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
1 vote
1 answer
75 views

Cannot stop Microcontroller's Hardware Timer from running

I'm using an Atmel ATMega8 microcontroller to control a stepper motor. (Datasheet). Timer1 (a 16-bit hardware counter) is used in CTC mode to modulate an IO pin to provide the stepping signal to the ...
Wossname's user avatar
  • 656
0 votes
1 answer
54 views

How to make a circuit which can give divided voltage to ADC and can send a trigger pulse to INT0 when I press a button?

I connected 4 buttons to the ADC module of AVR-ATMega328p with different resistor values, To know which button is pressed this ...
in.yssh's user avatar
  • 45
0 votes
1 answer
119 views

AVR32 goes to unrecoverable exception when exiting interrupt routine

I'm using an ATUC128D3 microcontroller and have 5 switches connected to it. I have the GPIO interrupt configured to trigger on a falling edge and this works just fine. It enters the interrupt and the ...
Alex Jegers's user avatar
1 vote
1 answer
895 views

Simple AVR interrupts in C - How to cleanly stop and restart "INT0"?

I'm trying to use an ATTiny84's INT0 pin to detect a falling edge event on a 1 kHz signal. What is the correct way to temporarily halt this interrupt INT0, and then resuming it at a later time, ...
user882326721's user avatar
0 votes
1 answer
319 views

Faster Timer0 overflow than 2 ms on Attiny85

I'm trying to get a Timer0 overflow with an overflow every 500us, but can't find a solution to get it so low. I'm running the Attiny85 on its internal 1 MHz clock, so I know it is not gonna be the ...
jonas's user avatar
  • 309
0 votes
1 answer
75 views

Problem or misunderstand of ADATE bit on ATTiny45

I have 2 buttons connected to pulled-down ADC input. I want to trigger ISR(SIG_ADC) when ADC finishes conversion - this is working. If I start ADC using ...
filimonic's user avatar
  • 209
0 votes
1 answer
226 views

UART doesn't transmit all characters when using UDREn interrupt

Note: I am beginner :) MCU: Atemega328p In Method 1, I am using a UDRn data register empty interrupt once the transmit buffer is empty and inputting characters from ...
user13174343's user avatar
1 vote
2 answers
287 views

Does this interrupt improve performance even with while loop in ISR?

Note: I am a beginner :) MCU: Atmega328p Which program below burdens the CPU the least? Would it be a significant difference? Objective: to make a more "efficient" serial monitor by ...
user13174343's user avatar
0 votes
1 answer
231 views

Error Real Time Clock implementation AVR microcontroller

I want to create a real-time clock using ATmega328p microcontroller. The microcontroller's frequency is 1 MHz. So, I think I should use timer interrupts in CTC mode to generate interrupt every second. ...
manueld4722623's user avatar
-3 votes
3 answers
698 views

How to write own ISR handler [closed]

I am learning about AVR programming and I know we have to use avr/interrupt.h library to use interrupts. However, my main reason to learn AVR programming is to program without any library so I want to ...
Syed M Erdum Adnan's user avatar
3 votes
0 answers
430 views

ISR won't modify a global variable (IAR)?

First, some background on what I'm working on. I have a custom board with ATmega324A that I designed as part of a project I'm working on. Originally, software for the uC was written for GCC in Atmel ...
0xd4v3's user avatar
  • 109
0 votes
0 answers
121 views

AVR Interrupt: LED kept blinking and won't stop

Lately I realize I am still a newbie, when you can't blink a freaking LED properly. It's kinda sad. I try to simplify this LED code to the simplest form possible, and it still won't work properly. ...
user avatar
1 vote
1 answer
604 views

Where is Interrupt Vector Table stored in ATmega32A?

Given that Atmega32A has three types of memory : 1) SRAM. 2) Flash (Program memory). 3)EEPROM. In which section the Interrupt Vector Table is stored ?
Mohamed Atef's user avatar
0 votes
2 answers
115 views

AVR MCU Interrupt toggle a LED problem with 100 extra toggle

I am playing around with an AVR MCU. I am having trouble toggling a LED. It's being toggled faster than I have expected. It should be toggling at 500hz, but it's up to 600hz and not very stable. I ...
user avatar
0 votes
1 answer
170 views

in AVR, if i use .ORG 0 with the main program , where is the interrupt vector table and .INCLUDE file data go?

I am studying AVR from the book "the AVR microcontroller and Embedded system by Mohamed mazidi" and "atmega32A data sheet" in the book, it puts samples of cade which start like this ...
mr.Arrow's user avatar
2 votes
1 answer
618 views

Pullup Rise Time On AVR External Interrupt

Background I am designing a simple lamp dimmer using the Atmel ATTiny441 microcontroller. To this end, I have designed a very basic zero-cross detector which feeds the external interrupt pin (INT0) ...
MysteryMoose's user avatar
3 votes
1 answer
272 views

AVR diagram of functions calling, ISR and main loop share the same resource

I made a simple diagram of functions calls to illustrate the potential problem which bothering me a little. As you can see, my task_list (which is simple linked ...
bielu000's user avatar
  • 139
1 vote
2 answers
305 views

Where should be defined a device specific ISR when making a static library?

Suppose I want to make a static library (.a file), which contains an ISR. That library should be used by many AVR MCUs, but each device has different ISR vector name, so it cannot be defined in .c ...
Tekl7's user avatar
  • 13
0 votes
1 answer
82 views

Thread-Style Operation on Microprocessor

This is a general question about designing firmware for AVR microcontrollers, say, the AtMega16. I have a routine that I am running through several thousand times per second. The routine is entirely ...
Hackstaar's user avatar
  • 924
0 votes
0 answers
57 views

MEGA2560 only starts program after pressing RESET button multiple times

I am working on a program where I am controlling an MP3 player by using UART between my MEGA2560 and the MP3 player. The MEGA2560 sends serial commands to the MP3 player when external interrupts are ...
user164324's user avatar
0 votes
1 answer
266 views

USART ISR on TXC breaking delays from <util/delay.h>?

I am trying to work out USART ISR's on the ATmega 328P. So far I have got the USART rx and tx working. I have come across a strange issue when it comes to the UART ISR's, though. The ISR seems to ...
user avatar
2 votes
2 answers
1k views

Can't trigger AVR ADC Interrupt

I am using an Atmel's XPlained mini board with Atmega328PB. I am trying to use ADC interrupt, however I can't get it to fire. Here's the code that I have a problem with: ...
Anthropomorphous Dodecahedron's user avatar
0 votes
1 answer
721 views

Using UDRIE0 interrupt in ATmega168

I only have some limited knowledge in interrupts. This is what I understand about following ISR functions ISR(USART_RX_vect) will get called when a new data ...
Athul's user avatar
  • 241
3 votes
2 answers
2k views

Timer0 overflow interrupt does not work on ATtiny10

I am trying to use the Timer0 overflow interrupt to make a little project. I used such a timer in the ATtiny45 and it worked, but with ATtiny10 no result. So I tried an easy LED blinking program and ...
sepplhans's user avatar
  • 205
8 votes
3 answers
2k views

ATtiny13A - Can't generate software PWM with CTC mode

I'm trying to make a remote control RGB LED light using an ATtiny13A. I know the ATtiny85 is better suited for this purpose, and I know I might not eventually be able to fit the whole code, but for ...
Pouria P's user avatar
  • 320
0 votes
1 answer
561 views

Output Compare Interrupt does not work avr atmega

Hey I'm trying to do blinking led using interrupts on 16 bit timer. My atmega model is Atmega168A. Chip clock rate is 12Mhz. Here is my code: ...
bielu000's user avatar
  • 139
1 vote
1 answer
1k views

AVR pin change interrupt

I want to turn on LEDs 0, 1 and 2 when pinc1, pinc2 and pinc3 are triggered. Also, I want to use a pin change interrupt. Problem: only LED 1 is on. This is my code and I am using atmega328p and ...
Mourad's user avatar
  • 355
17 votes
6 answers
21k views

Avoiding global variables when using interrupts in embedded systems

Is there a good way of implementing communication between an ISR and the rest of the program for an embedded system which avoids global variables? It seems that the general pattern is to have a ...
user avatar
1 vote
2 answers
856 views

Unable to set Pin Change Interrupt on ATmega328p

so I am working on learning some AVR programming with the ATmega328p. I am trying to set up a pin change interrupt and this is the code I am running. However, the interrupt never seems to trigger. ...
Punchki's user avatar
  • 143
2 votes
3 answers
486 views

How to reduce the effect of electric lighter noise on Micro controller?

I am using a kind of electric lighter in my circuit in order to turn the fire on. And also i have used some sensors that alert in danger by sending a signal to the MCU (ATmega 32) interrupt. The ...
Mohammad Reza Hasanpour's user avatar
1 vote
2 answers
543 views

USART ISR keeps repeating 4 times

Hi, ​I'm having a problem with the USART_RX_vect interrupt of the ATMega 328p. The receiving works fine and I'm able to evaluate the sent bits (so it's not due to the baudrate) but everytime I send a ...
Ardupi de's user avatar
0 votes
2 answers
2k views

Measuring the frequency of a square wave with input capture Atmega328 avr

I am currently measuring the frequency of a square wave using input capture on the atmega328p. Once it detects the frequency, I have the code lighting up one LED above a certain cutoff (i.e. about 150 ...
Abcde's user avatar
  • 1
0 votes
1 answer
965 views

atmega328p watchdog keeps restarting

I have AVR Atmega328p which I want to blink for 5 secs every 16 secs (to test the watchdog interrupts). I have the following code, which keeps restarting, and the last line is: ...
gabi's user avatar
  • 343
1 vote
0 answers
695 views

Reuse I2C SCL or SDA Pins to signal interrupt

In an I2C network, I am using an AVR microcontroller (AtMega328p) as a Master and I hooked it up to multiple sensors as Slaves, such as the TMP102, SI1145, MPU9250, among others. All of these sensors ...
Mihai Galos's user avatar
1 vote
2 answers
3k views

Blinking led using interrupts in AVR

I want to learn how to work with interrupts and I have done my first try. I have done a very simple circuit based on ATtiny13. There's a led in PB1 and a button in PB3. When the button is pressed, ...
Salva's user avatar
  • 59
2 votes
1 answer
2k views

AVR: why each Interrupt Vector occupies two instruction words

During my study of Atmega328 datasheet I found that each interrupt vector occupies two addresses and after searching i can not find why that. That is a screen shot from atmega328p datasheet page 82
M Y's user avatar
  • 239
0 votes
2 answers
2k views

Delay doesn't work (avr attiny 26, delay.h)

I am trying to learn how to write programs to microcontroller, and started with very simple things like LED blinking with given frequency, or controlled by button. However, I have problems with using ...
Antonio's user avatar
  • 103
2 votes
2 answers
752 views

Unexplained interrupt behavior in AVR ATMEGA324P Timer Counter ISR

I have an ATMEGA324P controlling a dual motor driver circuit. I'm using the 16-bit Timer Counter 1 in Phase and Frequency Correct mode to create (2) PWM outputs using the ICR1 as the TOP value and the ...
Neelix's user avatar
  • 365
0 votes
1 answer
229 views

MCU (Atmega644p) PWM without interrupts

I have an Atmega644p which is connected over SPI to a MCP2515 can-controller. In the MCU I use time based interrupts to send messages to the can-controller, which he translates and sends onto the ...
TMJ's user avatar
  • 51
0 votes
0 answers
294 views

How can I echo characters from UART0 to UART1

I am looking for a good tutorial or help in working with two UART's at the same time. I have UART1 connected to a BT modem and UART0 connected to a cell modem. I want to be able to have good two way ...
Eddie's user avatar
  • 135
1 vote
3 answers
1k views

ATmega1284P int0 interrupt sw0

I want to toggle the LED3 of the microcontroller when the button SW0 is pressed. I developed this code but it is not working and I dont know what is wrong. I search in the documentation and many foros ...
Ana Lasheras's user avatar
2 votes
2 answers
2k views

Missed Interrupt Problem with Attiny85

I'm trying to use an Attiny85 (digispark) to wake another controller from sleep (an ESP8266). The Attiny is connected to an IR receiver which has an active low output. Basically I have connected an ...
localhost's user avatar
  • 302
2 votes
1 answer
1k views

Atmega328P Watch Dog Timer - Delay Issue

I am trying to give delay of 0.5 seconds on 13 pin of the arduino using Watch Dog timer interrupt, the code complies and works fine but the led is blinking so rapidly that it seems like it is ...
Mayank Pal's user avatar
1 vote
1 answer
1k views

Timer1 on ATtiny85 not working as expected

I am trying to use Timer1 on the ATtiny85 (Adafruit Trinket) to blink an LED every second. The prescaler value is 1024, and the compare register value is 28. I loop through this 279 times to get a ...
Suba Thomas's user avatar
  • 1,399
6 votes
4 answers
5k views

Multithreading on AVR

If I have an AVR micro controller and have an ISR coming up about every 100 micro seconds or so, can I change the stack pointer in the ISR and then fake multi threading? Psuedo code: ...
DarthRubik's user avatar
1 vote
1 answer
637 views

AVR ATmega: can I trigger external interrupt by setting corresponding INTF flag bit?

I'm writing a C program for ATmega64A which has a INT0 ISR. This ISR should be executed in case of INT0 falling edge OR if the TIMER3 goes overflow. To avoid doubling the code I'd like to trigger ...
Roman Matveev's user avatar
0 votes
1 answer
971 views

Timer causes UART problem

I have a problem, found on both ATMEGA1284P and ATMEGA2560. I have set a 16-bit timer in CTC (tried both Timer1 and Timer5) to give an interrupt every 1ms so I can increment a 32-bit volatile time ...
Johis's user avatar
  • 247
0 votes
2 answers
950 views

Modifiying variable inside of Interrupt vector. AVR

My question is again about modifying variables inside the ISR. If the variable used only inside of ISR, I don't have to declare it as volatile, right? After some researching, I figured out that ...
DaurenD's user avatar
  • 81
0 votes
1 answer
91 views

AVR MCU running @ 32.7Khz Low speed LED multiplexing problem interrupt

Works fine with internal 8mhz, but when change to 32.7Khz, the multiplexing led display is not working properly (it's flashing very randomly). is this the limit of low clock speed or is there a ...
user avatar