Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
2 votes
1 answer
15k views

Use AVR Timer1 for Compare Interrupt AND PWM at same time

Is it possible to use Timer1 on an ATMega to generate a compare interrupt on OCR1A and PWM output on OCR1B? I've tried with similar to the following, but neither work with everything I've tried. <...
Adam Haile's user avatar
  • 1,623
2 votes
1 answer
958 views

AVR Interrupt "Interference"

I'm currently working on receiving signals from an RC remote. I have used pins A8 to A15 on my Arduino Mega board. The ports and interrupts are setup with the help of this code: ...
Boren's user avatar
  • 23
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
2 votes
1 answer
1k views

Valid use of ISR_NOBLOCK

I am using two timer interrupts: TIMER0_OVF triggered every 12 ms, with its ISR only polling a pin, conditionally setting a flag and incrementing a value, so it ...
Torsten Römer's user avatar
2 votes
1 answer
1k views

Attiny10 not triggering timer overflow interrupt while simulation (Atmel Studio 6)

I have problems simulating the timer overflow in Atmel Studio 6. The code is for an Attiny10 and looks like below. As far as I know I set all the neccessary bits to enable the counter (which works in ...
milkpirate's user avatar
2 votes
1 answer
2k views

How to implement a synchronization signal with AVR (attiny45)?

In pseudocode I want to do following: ...
Juha's user avatar
  • 188
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
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
2 votes
0 answers
993 views

AVR interrupt setup seems to stop program execution

On ATMEGA168PA I have problems with interrupt-driven character reception over UART. When I include the line setup_interrupt() it seems that program execution stops ...
Reidar Gjerstad's user avatar
2 votes
1 answer
620 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
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
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
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
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
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
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
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
1 vote
1 answer
1k views

AVR: Interrupt build error

I am trying to learn how to use interrupts for a project using an Attiny85. I have written a simple program from what I have learned from tutorials. However when I try to build the program in Atmel ...
Daveythewavey19's user avatar
1 vote
1 answer
255 views

AVR- state change of a pin to generate an interrupt [closed]

I need to produce external interrupt whenever there is a change in state of a pin. When the pin goes from high impedance state to ground or from ground to high impedance state, an interrupt must be ...
gzix's user avatar
  • 403
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
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
1 vote
1 answer
3k views

AVR bootloader interrupt issue

For a quite while, I've been using an avr ATmega324PA controller and Atmel studio to write the programs. we wrote a TCP bootloader. It works fine without any interrupt. Later we did add an external ...
gzix's user avatar
  • 403
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
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,409
1 vote
1 answer
643 views

Interrupts in AVR

I'm using an atmega328 on AVR. I haven't done any coding yet but I am planning. How I will do so in my head. So I want to be able to wake up the ATmega328 via a button press, and go to sleep after I'...
Shang Lin Chua's user avatar
1 vote
1 answer
695 views

Can't get AVR pin change interrupt to work

I'm trying to get a pin change interrupt on an Attiny2313 to work but i'm stuck, the interrupt is not triggering. I'm using the following code in main(): ...
Mervin's user avatar
  • 209
1 vote
2 answers
3k views

Determine input frequency of square wave w/ ICR in Atmega328p

I'm trying to obtain the input frequency of a square wave using the input capture register of an Atmega328p. So far, it works sporadically -- which is to say, when I input a 75 kHz square wave, the ...
user3753934's user avatar
1 vote
1 answer
10k views

Stop timer set new value and start again AVR (Interrupt)

I have AVR MCU. I am playing with timer now. What I need ? I have timer counting up with some frequency. In each interrupt I am incrementing variable, and somewhere I need to check value of this ...
solderingiron's user avatar
1 vote
1 answer
1k views

How to detect which timer interrupt called callback when using ASF?

I have a general function, which gets passed among others a timer. It initializes the timer using common callback function: ...
varesa's user avatar
  • 639
1 vote
1 answer
354 views

Atmega169PA interrupt source

Is there a simple way of determining which module causes an interrupt on an ATmega169PA? I have 3,000 units executing the same code and there were 10 units that executed my ISR(BADISR_vect) handler ...
Baforeale's user avatar
1 vote
2 answers
3k views

Multiplexing AVR (ATMega328) PWM within Interrupts

I'm trying to take 3 common anode RGB LEDs and hook up the cathodes of each to three of the PWM outputs on an ATMega328p and then in an ISR, multiplex between them all. The problem I'm running into ...
Adam Haile's user avatar
  • 1,623
1 vote
1 answer
896 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
1 vote
0 answers
696 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
0 votes
1 answer
2k views

Atmega2560 Usart Interrupt problem

When I send any data from serial port, RX pins are flashing but ISR is not running. Here is my code. ...
Zgrkpnr's user avatar
  • 360
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
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
1 answer
2k views

Atmega Microcontroller interrupt delay function on button press

I am using Atmega32A and I have 2 LEDs. Here's step by step what I want to do When the MCU is powered, I have one LED lit (PC0) When click on a button (PD6) the second LED at (PC1) is lit and the ...
Ezio_'s user avatar
  • 153
0 votes
3 answers
1k views

AVR-C turning led off after number of blinks with interrupts

so what I am trying to do is that I am trying to make the led blink for a certain number of times before it turns off. I want to avoid using delays so I tried utilizing the interrupt and I also used a ...
Redrachet2's user avatar
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
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
2k views

AVR TWI/I2C Not Responding [closed]

I use Twi module of AVR Atmega168 to talk to DS1307. <...
Babu James's user avatar
0 votes
1 answer
2k views

AVR Atmega8 USART and ADC and PWM

I have created 2 different PWMs using timer 1 and 2 on ATmega8, that is used to control a linear motor. I'm using a hall effect sensor to detect changes in voltage as the linear motor moves left and ...
subz's user avatar
  • 623
0 votes
1 answer
320 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
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
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
0 votes
3 answers
201 views

How to get equal number of clock cycles before ISR on an AVR

While writing a time critical piece of code for an Attiny13, I figured I could use the rising edge of an input as a trigger to read in some self clocking data. However, the number of clock cycles ...
Douwe66's user avatar
  • 1,726
0 votes
1 answer
321 views

Saving the last value used in an ISR

I am using a level-triggered interrupt. During the interrupt OCR1A increases and the servo moves. I want to save each value of OCR1A when the pin returns to its previous level. So far I have only been ...
user3052614's user avatar
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