There is pwm:

TCCR1A = 0; TCCR1B = 0; ICR1 = PWM_PERIOD; TCCR1A = (1 << WGM11); TCCR1B = (1 << WGM13) | (1 << WGM12) | (1 << CS10); tccrOff = TCCR1A; TCCR1A |= (1 << COM1A1); tccrOn = TCCR1A; OCR1A = PWM_PULSE_DEFAULT; 

There is a port management function output (); and the time module DS1307 ( DS1307RTC.h library is used ).

Chip atmega328p, quartz at 8 MHz.

It is necessary to run the output () function continuously in the program loop to display data on the display.

The problem is that when output () is in the program loop, then when polling the time module, flicker and voltage drawdown occur at the time of the poll. How can the output () function be run in the background from the main program loop and not control other pins (since the function itself controls pins through the ports), for example, through a timer?

  • Is it possible to start the timer OCR0A or OCR2A without pin control, with an interval of 1ms? - NickSan

1 answer 1

Just need to add another microcontroller. One will be engaged in service functions, the other is responsible for the user interface.

  • I have neopixels on the patterns on one pattern, we are plinging the controller and a bunch of other tasks, can one really not do one thing? Everything works, except for this nuance. - NickSan
  • That is not critical. - Vanyamba Electronics
  • Critical, because it is not possible to put a second Atmega. I have already done so, but this is a completely different story ... - NickSan
  • Uncritical, because you are making a device for those who are not ready to pay for 2 atmega. Where did the old woman, who wants to keep up with technological progress, have 250 rubles? - Vanyamba Electronics
  • Nonsense, I said there is no possibility to put a second Atmega. - NickSan