<?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 Need a script to read a single bit in am 8 bit code in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Need-a-script-to-read-a-single-bit-in-am-8-bit-code/m-p/481581#M72582</link>
    <description>&lt;P&gt;Hi, I have been trying to find a way to read one bit in an 8-bit code (column RegRead) to be used to create a new column.&lt;/P&gt;&lt;P&gt;I can't seem to know to do it. in this example below, I am trying to ready bit[3], can someone help with it&lt;/P&gt;&lt;P&gt;much appreciated.&lt;/P&gt;&lt;P&gt;Ray&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RayE_0-1650657381584.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/41985iD9146655CC70B4C8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RayE_0-1650657381584.png" alt="RayE_0-1650657381584.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 10 Jun 2023 23:47:31 GMT</pubDate>
    <dc:creator>RayE</dc:creator>
    <dc:date>2023-06-10T23:47:31Z</dc:date>
    <item>
      <title>Need a script to read a single bit in am 8 bit code</title>
      <link>https://community.jmp.com/t5/Discussions/Need-a-script-to-read-a-single-bit-in-am-8-bit-code/m-p/481581#M72582</link>
      <description>&lt;P&gt;Hi, I have been trying to find a way to read one bit in an 8-bit code (column RegRead) to be used to create a new column.&lt;/P&gt;&lt;P&gt;I can't seem to know to do it. in this example below, I am trying to ready bit[3], can someone help with it&lt;/P&gt;&lt;P&gt;much appreciated.&lt;/P&gt;&lt;P&gt;Ray&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RayE_0-1650657381584.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/41985iD9146655CC70B4C8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RayE_0-1650657381584.png" alt="RayE_0-1650657381584.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:47:31 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Need-a-script-to-read-a-single-bit-in-am-8-bit-code/m-p/481581#M72582</guid>
      <dc:creator>RayE</dc:creator>
      <dc:date>2023-06-10T23:47:31Z</dc:date>
    </item>
    <item>
      <title>Re: Need a script to read a single bit in am 8 bit code</title>
      <link>https://community.jmp.com/t5/Discussions/Need-a-script-to-read-a-single-bit-in-am-8-bit-code/m-p/481602#M72583</link>
      <description>&lt;P&gt;Is that what the data looks like in a JMP data table? Is the column a character column or a numeric column? There are at least 3 different possibilities:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the data is already characters, "1" and "0", then the substr() function should be able to grab the 5th character (assuming the leading "0" characters are present.) Test carefully; if you call the LSB bit 0 vs bit 1 changes the answer, and substr starts at 1, not 0.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the value is a number, weirdly showing a base 10 number that looks like a base 2 number, (1) you might want to re-import it as character or (2) you might use mod(floor(RegRead/1000),2).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the value is a number between 0 and 255, you might use mod(floor(RegRead/8),2). Divide by 8 shifts the bit pattern three places to the right, floor throws away the fraction, mod-2 is 1 for odd answers when the LSB is 1.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another possibility might be numeric from -128 to 127 if the transfer somehow thinks the MSB is a sign bit.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Apr 2022 21:19:22 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Need-a-script-to-read-a-single-bit-in-am-8-bit-code/m-p/481602#M72583</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2022-04-22T21:19:22Z</dc:date>
    </item>
    <item>
      <title>Re: Need a script to read a single bit in am 8 bit code</title>
      <link>https://community.jmp.com/t5/Discussions/Need-a-script-to-read-a-single-bit-in-am-8-bit-code/m-p/481606#M72585</link>
      <description>&lt;P&gt;here is actual example of columns (smaller dataset) with each column's info, the decimal column is Numeric and Binary column is a Character.&lt;/P&gt;&lt;P&gt;I am interested in the Binary column only; the LSB will change from 0 to 1 based on test data collected and programming of each register.&lt;/P&gt;&lt;P&gt;I do use this formula to convert from Dec to Binary&lt;/P&gt;&lt;P&gt;dt &amp;lt;&amp;lt; New Column ("RegRead_Binary", formula(decimalToBinary = Hex(:RegRead, Base(2), Pad To(3))));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RayE_0-1650668481724.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/41986i23FE0BB95405829A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RayE_0-1650668481724.png" alt="RayE_0-1650668481724.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Apr 2022 23:12:34 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Need-a-script-to-read-a-single-bit-in-am-8-bit-code/m-p/481606#M72585</guid>
      <dc:creator>RayE</dc:creator>
      <dc:date>2022-04-22T23:12:34Z</dc:date>
    </item>
    <item>
      <title>Re: Need a script to read a single bit in am 8 bit code</title>
      <link>https://community.jmp.com/t5/Discussions/Need-a-script-to-read-a-single-bit-in-am-8-bit-code/m-p/481608#M72586</link>
      <description>&lt;P&gt;Thanks Craige&lt;/P&gt;
&lt;P&gt;you gave the idea to use&amp;nbsp;SUBSTR() function and I tested it out with random columns Test1,2,3&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt &amp;lt;&amp;lt; New Column ("Extract_Bit5", formula(SUBSTR(:Test1, 5, 1)));
dt &amp;lt;&amp;lt; New Column ("Extract_Bit7", formula(SUBSTR(:Test2, 1, 1)));
dt &amp;lt;&amp;lt; New Column ("Extract_Bit0", formula(SUBSTR(:Test3, 8, 1)));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;results&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RayE_0-1650670513451.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/41987i921E5AAC71A70547/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RayE_0-1650670513451.png" alt="RayE_0-1650670513451.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2022 12:53:18 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Need-a-script-to-read-a-single-bit-in-am-8-bit-code/m-p/481608#M72586</guid>
      <dc:creator>RayE</dc:creator>
      <dc:date>2022-04-25T12:53:18Z</dc:date>
    </item>
  </channel>
</rss>

