<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to AND the accumulator in 8-bit Microcontrollers</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/How-to-AND-the-accumulator/m-p/177075#M12484</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ghost,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You misunderstand, " AND PTAD, PTBD" is not a valid instruction in the S08. It should be giving you a syntax error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The AND instruction ONLY works with the accumulator. To AND the immediate value $AA to the accumulator, the instruction would be " AND #$AA". To AND the contents of memory to the accumulator, the instruction would be "AND &amp;lt;address&amp;gt;", regardless of whether &amp;lt;address&amp;gt; is flash, ram or a port. There is no instruction to AND directly to memory or a port.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;----&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Oops: I see Peg and I cross-posted.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 26 Oct 2011 05:49:29 GMT</pubDate>
    <dc:creator>rocco</dc:creator>
    <dc:date>2011-10-26T05:49:29Z</dc:date>
    <item>
      <title>How to AND the accumulator</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/How-to-AND-the-accumulator/m-p/177073#M12482</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a GT16A, HCSO8 familly.&lt;/P&gt;&lt;P&gt;I want to AND the accumulator.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ANDing two ports is easy. eg: AND PTAD, PTBD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But How do you AND the accunulator with a value (eg: #$AA) or with value in memory or with a port?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Oct 2011 05:22:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/How-to-AND-the-accumulator/m-p/177073#M12482</guid>
      <dc:creator>theGhost</dc:creator>
      <dc:date>2011-10-26T05:22:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to AND the accumulator</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/How-to-AND-the-accumulator/m-p/177074#M12483</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello the Ghost,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The AND instruction ALWAYS AND's with the accumulator!&lt;/P&gt;&lt;P&gt;The example you show is not valid.&lt;/P&gt;&lt;P&gt;One way to perform your example is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;LDA PTAD&lt;/P&gt;&lt;P&gt;AND PTBD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your other question would be:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;LDA #$AA&lt;/P&gt;&lt;P&gt;AND PTAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the instruction from the manual:&lt;/P&gt;&lt;PRE&gt;AND Logical AND ANDOperation A ← (A) &amp;amp; (M)Description Performs the logical AND between the contents of A and the contents ofM and places the result in A. Each bit of A after the operation will be thelogical AND of the corresponding bits of M and of A before the operation.Condition Codesand BooleanFormulae:V: 0ClearedN: R7Set if MSB of result is 1; cleared otherwiseZ: R7&amp;amp;R6&amp;amp;R5&amp;amp;R4&amp;amp;R3&amp;amp;R2&amp;amp;R1&amp;amp;R0Set if result is $00; cleared otherwiseSource Forms,AddressingModes, MachineCode, Cycles, andAccess DetailsV H I N Z C0 1 1 — — ↕ ↕ —SourceFormAddr.ModeMachine Code HCS08CyclesAccessOpcode Operand(s) DetailAND #opr8i IMM A4 ii 2 ppAND opr8a DIR B4 dd 3 rppAND opr16a EXT C4 hh ll 4 prppAND oprx16,X IX2 D4 ee ff 4 prppAND oprx8,X IX1 E4 ff 3 rppAND ,X IX F4 3 rfpAND oprx16,SP SP2 9ED4 ee ff 5 pprppAND oprx8,SP SP1 9EE4 ff 4 prppFreescale Semiconductor, IFreescale Semiconductor, Inc.For More Information On This Product,Go to: &lt;A href="http://www.freescale.com" rel="nofollow noopener noreferrer noopener noreferrer" target="_blank"&gt;www.freescale.com&lt;/A&gt;nc&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:26:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/How-to-AND-the-accumulator/m-p/177074#M12483</guid>
      <dc:creator>peg</dc:creator>
      <dc:date>2020-10-29T09:26:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to AND the accumulator</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/How-to-AND-the-accumulator/m-p/177075#M12484</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ghost,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You misunderstand, " AND PTAD, PTBD" is not a valid instruction in the S08. It should be giving you a syntax error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The AND instruction ONLY works with the accumulator. To AND the immediate value $AA to the accumulator, the instruction would be " AND #$AA". To AND the contents of memory to the accumulator, the instruction would be "AND &amp;lt;address&amp;gt;", regardless of whether &amp;lt;address&amp;gt; is flash, ram or a port. There is no instruction to AND directly to memory or a port.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;----&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Oops: I see Peg and I cross-posted.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Oct 2011 05:49:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/How-to-AND-the-accumulator/m-p/177075#M12484</guid>
      <dc:creator>rocco</dc:creator>
      <dc:date>2011-10-26T05:49:29Z</dc:date>
    </item>
  </channel>
</rss>

