<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Атомарный доступ к переменным</title>
		<description>Discuss Атомарный доступ к переменным</description>
		<link>https://chipenable.ru/index.php/programming-avr/item/16-atomarnyy-dostup-k-peremennym.html</link>
		<lastBuildDate>Wed, 08 Apr 2026 03:15:09 +0000</lastBuildDate>
		<generator>JComments</generator>
		<atom:link href="https://chipenable.ru/index.php/component/jcomments/feed/com_k2/16.html" rel="self" type="application/rss+xml" />
		<item>
			<title>САБ says:</title>
			<link>https://chipenable.ru/index.php/programming-avr/item/16-atomarnyy-dostup-k-peremennym.html#comment-3488</link>
			<description><![CDATA[да, верно]]></description>
			<dc:creator>САБ</dc:creator>
			<pubDate>Wed, 27 Nov 2013 08:05:12 +0000</pubDate>
			<guid>https://chipenable.ru/index.php/programming-avr/item/16-atomarnyy-dostup-k-peremennym.html#comment-3488</guid>
		</item>
		<item>
			<title>Evgeniy says:</title>
			<link>https://chipenable.ru/index.php/programming-avr/item/16-atomarnyy-dostup-k-peremennym.html#comment-3486</link>
			<description><![CDATA[Теперь понятно. Т.е. мы восстанавливаем весь SREG только ради флага I? Если восстанавливать не весь SREG, а только флаг I, то суть от этого не поменяется, так? (просто это дольше, чем SREG целиком?)]]></description>
			<dc:creator>Evgeniy</dc:creator>
			<pubDate>Tue, 26 Nov 2013 09:55:23 +0000</pubDate>
			<guid>https://chipenable.ru/index.php/programming-avr/item/16-atomarnyy-dostup-k-peremennym.html#comment-3486</guid>
		</item>
		<item>
			<title>САБ says:</title>
			<link>https://chipenable.ru/index.php/programming-avr/item/16-atomarnyy-dostup-k-peremennym.html#comment-3485</link>
			<description><![CDATA[Потому что может находиться внутри такого же блока. И после окончания вместо тупого включения прерываний восстанавливает их состояние на момент начала блока. Такой блок может находиться внутри функции, которая может в свою очередь вызываться откуда угодно и все будет работать корректно.]]></description>
			<dc:creator>САБ</dc:creator>
			<pubDate>Tue, 26 Nov 2013 08:55:15 +0000</pubDate>
			<guid>https://chipenable.ru/index.php/programming-avr/item/16-atomarnyy-dostup-k-peremennym.html#comment-3485</guid>
		</item>
		<item>
			<title>Evgeniy says:</title>
			<link>https://chipenable.ru/index.php/programming-avr/item/16-atomarnyy-dostup-k-peremennym.html#comment-3484</link>
			<description><![CDATA[Объясните почему это более грамотный вариант, пожалуйста?]]></description>
			<dc:creator>Evgeniy</dc:creator>
			<pubDate>Tue, 26 Nov 2013 07:01:11 +0000</pubDate>
			<guid>https://chipenable.ru/index.php/programming-avr/item/16-atomarnyy-dostup-k-peremennym.html#comment-3484</guid>
		</item>
		<item>
			<title>SeNiMal says:</title>
			<link>https://chipenable.ru/index.php/programming-avr/item/16-atomarnyy-dostup-k-peremennym.html#comment-2349</link>
			<description><![CDATA[Объясните, пожалуйста, зачем нужно сохранять SREG перед запретом прерываний и восстанавливать его снова перед разрешением прерываний. Об этом везде пишут, но не понятно когда может измениться SREG, если прерывания запрещены.]]></description>
			<dc:creator>SeNiMal</dc:creator>
			<pubDate>Sun, 30 Dec 2012 12:24:04 +0000</pubDate>
			<guid>https://chipenable.ru/index.php/programming-avr/item/16-atomarnyy-dostup-k-peremennym.html#comment-2349</guid>
		</item>
		<item>
			<title>Pashgan says:</title>
			<link>https://chipenable.ru/index.php/programming-avr/item/16-atomarnyy-dostup-k-peremennym.html#comment-1717</link>
			<description><![CDATA[Да, так многие делают. Более грамотный вариант с сохранением и восстановлением регистра SREG
unsigned char save = SREG;
cli();
.. ..какой то код
SREG = save;]]></description>
			<dc:creator>Pashgan</dc:creator>
			<pubDate>Wed, 21 Sep 2011 20:39:18 +0000</pubDate>
			<guid>https://chipenable.ru/index.php/programming-avr/item/16-atomarnyy-dostup-k-peremennym.html#comment-1717</guid>
		</item>
		<item>
			<title>Garoldy says:</title>
			<link>https://chipenable.ru/index.php/programming-avr/item/16-atomarnyy-dostup-k-peremennym.html#comment-1530</link>
			<description><![CDATA[Можно ли защищать участки кода от прерываний, помещая их между функциями cli(); и sei(); в WinAVR ?]]></description>
			<dc:creator>Garoldy</dc:creator>
			<pubDate>Tue, 14 Jun 2011 07:22:03 +0000</pubDate>
			<guid>https://chipenable.ru/index.php/programming-avr/item/16-atomarnyy-dostup-k-peremennym.html#comment-1530</guid>
		</item>
		<item>
			<title>Pashgan says:</title>
			<link>https://chipenable.ru/index.php/programming-avr/item/16-atomarnyy-dostup-k-peremennym.html#comment-613</link>
			<description><![CDATA[Нет, не делает. Вот в этой статье написано, что происходит при вызове функции - http://chipenable.ru/index.php/programming-c/52-isr-calling-function.html]]></description>
			<dc:creator>Pashgan</dc:creator>
			<pubDate>Sun, 12 Sep 2010 19:25:18 +0000</pubDate>
			<guid>https://chipenable.ru/index.php/programming-avr/item/16-atomarnyy-dostup-k-peremennym.html#comment-613</guid>
		</item>
		<item>
			<title>Guest says:</title>
			<link>https://chipenable.ru/index.php/programming-avr/item/16-atomarnyy-dostup-k-peremennym.html#comment-608</link>
			<description><![CDATA[ Возможно глупый вопрос, но разве обычная, не мониторная, функция не делает то-же самое - сохраняет SREG и запрещает прерывания?]]></description>
			<dc:creator>Guest</dc:creator>
			<pubDate>Tue, 07 Sep 2010 14:35:41 +0000</pubDate>
			<guid>https://chipenable.ru/index.php/programming-avr/item/16-atomarnyy-dostup-k-peremennym.html#comment-608</guid>
		</item>
		<item>
			<title>Guest says:</title>
			<link>https://chipenable.ru/index.php/programming-avr/item/16-atomarnyy-dostup-k-peremennym.html#comment-411</link>
			<description><![CDATA[Файл util/atomic.h P.S. Всетаки имя файла вписывал, просто оно в угловых скобках не отображается. Если админ может подправить мой первый пост, то удалите уточняющие.]]></description>
			<dc:creator>Guest</dc:creator>
			<pubDate>Sun, 23 May 2010 09:34:55 +0000</pubDate>
			<guid>https://chipenable.ru/index.php/programming-avr/item/16-atomarnyy-dostup-k-peremennym.html#comment-411</guid>
		</item>
		<item>
			<title>Guest says:</title>
			<link>https://chipenable.ru/index.php/programming-avr/item/16-atomarnyy-dostup-k-peremennym.html#comment-410</link>
			<description><![CDATA[в пред идущем посте не вписал имя файла для включения. Файл .]]></description>
			<dc:creator>Guest</dc:creator>
			<pubDate>Sun, 23 May 2010 09:31:22 +0000</pubDate>
			<guid>https://chipenable.ru/index.php/programming-avr/item/16-atomarnyy-dostup-k-peremennym.html#comment-410</guid>
		</item>
		<item>
			<title>Guest says:</title>
			<link>https://chipenable.ru/index.php/programming-avr/item/16-atomarnyy-dostup-k-peremennym.html#comment-409</link>
			<description><![CDATA[Как видно из примеров, код приведен для компилятора IAR. В WinAVR подобная проблема решается включением файла , в котором определены макросы для реализации атомарного доступа. например так : ..... ATOMIC_BLOCK(AT OMIC_RESTORESTA TE) { // блок кода с запрещенными прерываниями } ....]]></description>
			<dc:creator>Guest</dc:creator>
			<pubDate>Sun, 23 May 2010 09:29:27 +0000</pubDate>
			<guid>https://chipenable.ru/index.php/programming-avr/item/16-atomarnyy-dostup-k-peremennym.html#comment-409</guid>
		</item>
		<item>
			<title>Guest says:</title>
			<link>https://chipenable.ru/index.php/programming-avr/item/16-atomarnyy-dostup-k-peremennym.html#comment-171</link>
			<description><![CDATA[Проблема возможна и с восьмибитной переменной. Операция вроде system_timer -= 100 компилится в несколько ассемблерных инструкций и в основном коде также может быть прервана между чтением system_timer и записью результата. --------- Есть еще один способ чтения многобайтовых асинхронных счетчиков (без запрета прерываний) - считать переменную два раза и сравнить все байты кроме младшего. Если байты в копиях равны - берем последнее считанное значение, если не равны - считываем до тех пор, пока в двух последних считанных значениях байты не будут равны. Младший байт счетчика между чтениями может успеть измениться без переноса, поэтому он в проверке не участвует.]]></description>
			<dc:creator>Guest</dc:creator>
			<pubDate>Fri, 05 Feb 2010 12:39:08 +0000</pubDate>
			<guid>https://chipenable.ru/index.php/programming-avr/item/16-atomarnyy-dostup-k-peremennym.html#comment-171</guid>
		</item>
	</channel>
</rss>
