{"id":1518,"date":"2024-05-14T15:35:20","date_gmt":"2024-05-14T14:35:20","guid":{"rendered":"https:\/\/ibex.tech\/embedded\/?p=1518"},"modified":"2024-05-14T15:35:21","modified_gmt":"2024-05-14T14:35:21","slug":"pic16-sleep","status":"publish","type":"post","link":"https:\/\/ibex.tech\/embedded\/microchip\/pic16\/xc8-compiler-pic16\/sleep\/pic16-sleep","title":{"rendered":"PIC16 Sleep"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>\t\/\/----- GO TO SLEEP -----\n\n\t\/\/Do anything you need to reduce power before you sleep\n\t\t\t\n\t\/\/Setup IRQ pins that will wake us when a button is pressed\n\tINTERRUPT_GlobalInterruptDisable();\n\tIOCBN = 0b00111000;\t\t\/\/RB5:R3 will wake us when any is pulled low\n\tIOCBF = 0x00;\t\t\t\/\/Clear any IOC occurred flags\n\tINTCONbits.IOCIE = 1;\t\t\/\/Enable Interrupt On Change interrupts (we won't actually jump to an IRQ handler)\n\n\t\/\/GO TO SLEEP HERE\n\tSLEEP();\n\n\t\/\/--- WOKEN UP FROM SLEEP ---\n\tIOCBN = 0x00;\t\t\t\t\/\/Clear Interrupt On Change IRQ enables\n\tINTCONbits.IOCIE = 0;\n\tINTERRUPT_GlobalInterruptEnable();\n\t\t\t<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[124],"tags":[],"class_list":["post-1518","post","type-post","status-publish","format-standard","hentry","category-sleep"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/posts\/1518","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/comments?post=1518"}],"version-history":[{"count":1,"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/posts\/1518\/revisions"}],"predecessor-version":[{"id":1519,"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/posts\/1518\/revisions\/1519"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/media?parent=1518"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/categories?post=1518"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/tags?post=1518"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}