{"id":6992,"date":"2017-11-11T13:13:14","date_gmt":"2017-11-11T13:13:14","guid":{"rendered":"http:\/\/blog.bachi.net\/?p=6992"},"modified":"2017-11-11T13:42:34","modified_gmt":"2017-11-11T13:42:34","slug":"arduinoavr-atomic-instruction-mutex-semaphore","status":"publish","type":"post","link":"https:\/\/blog.bachi.net\/?p=6992","title":{"rendered":"Arduino\/AVR Atomic Instruction \/ Mutex \/ Semaphore"},"content":{"rendered":"<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nArduino\\hardware\\arduino\\avr\\cores\\arduino\\Arduino.h\r\nsei()  ==&gt; interrupts()\r\ncli()  ==&gt; noInterrupts()\r\n\r\noder \u00fcber das Macro:\r\n\r\nATOMIC_BLOCK(ATOMIC_RESTORESTATE)\r\n{\r\n  \/\/ Do some atomic operation inside here\r\n}\r\n\r\n<\/pre>\n<h3>avr-libc<\/h3>\n<p><a href=\"http:\/\/www.nongnu.org\/avr-libc\/user-manual\/group__avr__interrupts.html\">avr\/interrupt.h: Interrupts<\/a><br \/>\n<a href=\"http:\/\/www.nongnu.org\/avr-libc\/user-manual\/group__util__atomic.html\">util\/atomic.h: Atomically and Non-Atomically Executed Code Blocks<\/a><\/p>\n<h3>Arduino<\/h3>\n<p><a href=\"https:\/\/www.arduino.cc\/reference\/en\/language\/functions\/external-interrupts\/attachinterrupt\/\">attachInterrupt()<\/a><br \/>\n<a href=\"https:\/\/www.arduino.cc\/en\/Reference\/NoInterrupts\">noInterrupts()<\/a><br \/>\n<a href=\"https:\/\/www.arduino.cc\/en\/Reference\/Interrupts\">interrupts()<\/a><br \/>\n<a href=\"https:\/\/create.arduino.cc\/projecthub\/reanimationxp\/how-to-multithread-an-arduino-protothreading-tutorial-dd2c37\">ow to &#8220;Multithread&#8221; an Arduino (Protothreading Tutorial)<\/a><\/p>\n<h3>Portable<\/h3>\n<p><a href=\"https:\/\/github.com\/wizard97\/SimplyAtomic\">github.com\/wizard97\/SimplyAtomic<\/a>: Simple Arduino portable atomic macros (Portable: AVR, ARM, ESP8266, ESP32)<\/p>\n<h3>learn.adafruit.com<\/h3>\n<p><a href=\"https:\/\/learn.adafruit.com\/multi-tasking-the-arduino-part-1\/overview\">Multi-tasking the Arduino &#8211; Part 1<\/a><br \/>\n<a href=\"https:\/\/learn.adafruit.com\/multi-tasking-the-arduino-part-2\/overview\">Multi-tasking the Arduino &#8211; Part 2<\/a><br \/>\n<a href=\"https:\/\/learn.adafruit.com\/multi-tasking-the-arduino-part-3\/overview\">Multi-tasking the Arduino &#8211; Part 3<\/a><\/p>\n<h3>Questions<\/h3>\n<p><a href=\"https:\/\/stackoverflow.com\/questions\/5111393\/do-interrupts-interrupt-other-interrupts-on-arduino\">Do interrupts interrupt other interrupts on Arduino?<\/a><\/p>\n<h3>occam-pi<\/h3>\n<p><a href=\"http:\/\/pop-users.org\/occam-pi\/\">occam-pi in a nutshell<\/a><br \/>\n<a href=\"https:\/\/en.wikipedia.org\/wiki\/Occam_(programming_language)\">occam (programming language)<\/a>, concurrent programming language that builds on the communicating sequential processes (CSP) process algebra<br \/>\n<a href=\"http:\/\/concurrency.cc\/\">concurrency.cc &#8211; Parallel programming for the rest of us<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Arduino\\hardware\\arduino\\avr\\cores\\arduino\\Arduino.h sei() ==&gt; interrupts() cli() ==&gt; noInterrupts() oder \u00fcber das Macro: ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { \/\/ Do some atomic operation inside here } avr-libc avr\/interrupt.h: Interrupts util\/atomic.h: Atomically and Non-Atomically Executed Code Blocks Arduino attachInterrupt() noInterrupts() interrupts() ow to &#8220;Multithread&#8221; an Arduino (Protothreading Tutorial) Portable github.com\/wizard97\/SimplyAtomic: Simple Arduino portable atomic macros (Portable: AVR, ARM, ESP8266, ESP32) learn.adafruit.com [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-6992","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts\/6992","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6992"}],"version-history":[{"count":11,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts\/6992\/revisions"}],"predecessor-version":[{"id":7003,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts\/6992\/revisions\/7003"}],"wp:attachment":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6992"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6992"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6992"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}