<?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>ColdFire/68K Microcontrollers and ProcessorsのトピックRe: Problems with 'bit set' operation on the MCF52233</title>
    <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Problems-with-bit-set-operation-on-the-MCF52233/m-p/173339#M6581</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;Eqqman wrote:&lt;BR /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;...if I compile&lt;/P&gt;&lt;P&gt;bset #1, 40000000 or&lt;/P&gt;&lt;P&gt;bclr #1, 40000000&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get a compile error 'illegal addressing mode'.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;The tables provided with the full documentation of BSET and BCLR show that combination of addressing modes is NOT permitted. A register must be involved, either the bit number in a source register, or the destination in a data register or through an address register.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To atomically set/clear a bit at a byte address, you can put the bit number in a register, e.g.:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;moveq #1,r0&lt;/P&gt;&lt;P&gt;bset.b r0,40000000&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or the address in an address register:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;lea 40000000,a0&lt;/P&gt;&lt;P&gt;bset.b #1,(a0)&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If the target location is 32 bits, you can use "and" and "or" instructions to make atomic changes with the mask/value in a source register. For a 16-bit I/O port, I don't think atomic is possible with coldfire.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 20 Apr 2009 20:56:55 GMT</pubDate>
    <dc:creator>bkatt</dc:creator>
    <dc:date>2009-04-20T20:56:55Z</dc:date>
    <item>
      <title>Problems with 'bit set' operation on the MCF52233</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Problems-with-bit-set-operation-on-the-MCF52233/m-p/173338#M6580</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'm trying to replace some of the macros that get created by the MCF52233 compiler with atomic operations.&amp;nbsp; For example, I'm using things like&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;MCF_PIT0_PCSR |= 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But this compiles into numerous instructions.&amp;nbsp; I need to be able to set this bit in a single instruction.&amp;nbsp; Looking through the instruction set, I see that subq, addq, and bset all have the same allowable format of '#&amp;lt;data&amp;gt;,&amp;lt;ea&amp;gt;x'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So if I try to compile&lt;/P&gt;&lt;P&gt;subq #1, 40000000&lt;/P&gt;&lt;P&gt;addq #1, 40000000&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;everything is fine, but if I compile&lt;/P&gt;&lt;P&gt;bset #1, 40000000 or&lt;/P&gt;&lt;P&gt;bclr #1, 40000000&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get a compile error 'illegal addressing mode'.&amp;nbsp; So it is not clear to me why this same mode works for some commands and not others when they all allegedly accept it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 19 Apr 2009 07:06:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Problems-with-bit-set-operation-on-the-MCF52233/m-p/173338#M6580</guid>
      <dc:creator>Eqqman</dc:creator>
      <dc:date>2009-04-19T07:06:09Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with 'bit set' operation on the MCF52233</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Problems-with-bit-set-operation-on-the-MCF52233/m-p/173339#M6581</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;Eqqman wrote:&lt;BR /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;...if I compile&lt;/P&gt;&lt;P&gt;bset #1, 40000000 or&lt;/P&gt;&lt;P&gt;bclr #1, 40000000&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get a compile error 'illegal addressing mode'.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;The tables provided with the full documentation of BSET and BCLR show that combination of addressing modes is NOT permitted. A register must be involved, either the bit number in a source register, or the destination in a data register or through an address register.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To atomically set/clear a bit at a byte address, you can put the bit number in a register, e.g.:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;moveq #1,r0&lt;/P&gt;&lt;P&gt;bset.b r0,40000000&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or the address in an address register:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;lea 40000000,a0&lt;/P&gt;&lt;P&gt;bset.b #1,(a0)&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If the target location is 32 bits, you can use "and" and "or" instructions to make atomic changes with the mask/value in a source register. For a 16-bit I/O port, I don't think atomic is possible with coldfire.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Apr 2009 20:56:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Problems-with-bit-set-operation-on-the-MCF52233/m-p/173339#M6581</guid>
      <dc:creator>bkatt</dc:creator>
      <dc:date>2009-04-20T20:56:55Z</dc:date>
    </item>
  </channel>
</rss>

