{"id":504,"date":"2014-09-08T10:36:42","date_gmt":"2014-09-08T10:36:42","guid":{"rendered":"https:\/\/ibex.tech\/c\/?p=504"},"modified":"2022-02-17T10:13:11","modified_gmt":"2022-02-17T10:13:11","slug":"variables","status":"publish","type":"post","link":"https:\/\/ibex.tech\/c\/c\/memory\/variables","title":{"rendered":"Variables"},"content":{"rendered":"<h4>\nVolatile &#8211; Variables Which Can Be Altered In Interrupts<br \/>\n<\/h4>\n<p>\nEnsure these variables are declared with the &#39;volatile&#39; keyword so the compiler knows the variable can be changed in an interrupt. &nbsp;This can be a classic cause of very strange bugs where you can&#39;t understand why your&nbsp;release code seems to&nbsp;be&nbsp;getting locked up, say,&nbsp;on a while loop but its actually because the compiler has assumed a varaible you are testing cannot change outside of the local function and created the assemlber code in a way which ignores the change occuring in an interrupt.\n<\/p>\n<pre>\r\n<code>\r\nvolatile BYTE my_10ms_timer;\r\nextern volatile BYTE my_10ms_timer;\r\n<\/code><\/pre>\n<p>\n&nbsp;\n<\/p>\n<p>\n&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Volatile &#8211; Variables Which Can Be Altered In Interrupts Ensure these variables are declared with the &#39;volatile&#39; keyword so the compiler knows the variable can be changed in an interrupt. &nbsp;This can be a classic cause of very strange bugs where you can&#39;t understand why your&nbsp;release code seems to&nbsp;be&nbsp;getting locked up, say,&nbsp;on a while loop [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"class_list":["post-504","post","type-post","status-publish","format-standard","hentry","category-memory"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/c\/wp-json\/wp\/v2\/posts\/504","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/c\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/c\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/c\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/c\/wp-json\/wp\/v2\/comments?post=504"}],"version-history":[{"count":3,"href":"https:\/\/ibex.tech\/c\/wp-json\/wp\/v2\/posts\/504\/revisions"}],"predecessor-version":[{"id":507,"href":"https:\/\/ibex.tech\/c\/wp-json\/wp\/v2\/posts\/504\/revisions\/507"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/c\/wp-json\/wp\/v2\/media?parent=504"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/c\/wp-json\/wp\/v2\/categories?post=504"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/c\/wp-json\/wp\/v2\/tags?post=504"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}