{"id":754,"date":"2017-05-26T10:26:04","date_gmt":"2017-05-26T10:26:04","guid":{"rendered":"https:\/\/ibex.tech\/embedded\/?p=754"},"modified":"2024-07-17T17:01:58","modified_gmt":"2024-07-17T16:01:58","slug":"assembler-3","status":"publish","type":"post","link":"https:\/\/ibex.tech\/embedded\/microchip\/pic18\/xc8-compiler\/issues-xc8-compiler\/assembler-3","title":{"rendered":"Assembler"},"content":{"rendered":"\n<h4 class=\"wp-block-heading\">ISSUE &#8211; Destination and RAM access bit specified<\/h4>\n\n\n\n<p>This used to be requried&nbsp;for asm code when you wanted to tell it the ,d and ,a bits of the instruction:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\nnear static unsigned char uc_asm_irq_temp;\t\t\/\/ near qualifier specifies access RAM\nnear static unsigned char uc_asm_irq_temp1;\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>\n\t\tmovlw\t0xcb\n\t\taddwf\t_uc_asm_irq_temp,f,c\t\t\t\/\/(1 = file register, 0 = access ram)\n\t\tmovlw\t0xf3\n\t\taddwfc\t_uc_asm_irq_temp1,f,c\t\t\t\/\/(1 = file register, 0 = access ram)\n<\/code><\/pre>\n\n\n\n<p>In a classic Microchip &#8220;lets make life difficuilt for programmers step&#8221; the 1 and 0 values the PIC device datasheets specify for these bits can&#8217;t actually be used, so, f and c have to be used instead, \u00a0However now they don&#8217;t seem to work either (2017-05) and to get the instructions above to work properly we have to change them to this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\n\t\tmovlw\t0xcb\n\t\taddwf\t_uc_asm_irq_temp\n\t\tmovlw\t0x63\n\t\taddwfc\t_uc_asm_irq_temp1\n<\/code><\/pre>\n\n\n\n<p>So the full code in our heartbeat timer which works is now:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\n\t\t#asm\n\t\tGLOBAL _uc_asm_irq_temp\n\t\tGLOBAL _uc_asm_irq_temp1\n\t\t\/\/Reset timer for next rollover\n\t\tmovff\tTMR0L,_uc_asm_irq_temp\t\t\t\/\/read_current_timer_value (read low byte loads high byte)\n\t\tmovff\tTMR0H,_uc_asm_irq_temp1\n\t\tmovlw\t0xcb\n\t\taddwf\t_uc_asm_irq_temp\n\t\tmovlw\t0x63\n\t\taddwfc\t_uc_asm_irq_temp1\n\t\tmovff\t_uc_asm_irq_temp1,TMR0H\t\t\t\/\/Store new value (high byte first)\n\t\tmovff\t_uc_asm_irq_temp,TMR0L\n\t\t#endasm\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>ISSUE &#8211; Destination and RAM access bit specified This used to be requried&nbsp;for asm code when you wanted to tell it the ,d and ,a bits of the instruction: In a classic Microchip &#8220;lets make life difficuilt for programmers step&#8221; the 1 and 0 values the PIC device datasheets specify for these bits can&#8217;t actually [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[125,66],"tags":[],"class_list":["post-754","post","type-post","status-publish","format-standard","hentry","category-assembler5","category-issues-xc8-compiler"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/posts\/754","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=754"}],"version-history":[{"count":4,"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/posts\/754\/revisions"}],"predecessor-version":[{"id":1527,"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/posts\/754\/revisions\/1527"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/media?parent=754"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/categories?post=754"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/tags?post=754"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}