cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP Security Notice: CVE-2026-109618 and CVE-2026-109619

    JMP promptly initiated a review of its products, services, and relevant infrastructure for exposure to CVE-2026-109618 and CVE-2026-109619.

    Our assessment of JMP products has not identified exposure to these vulnerabilities. Where remediation was required within supporting environments, appropriate security updates and controls have been applied and validated.

    We have identified no evidence of successful exploitation or unauthorized access to JMP systems or customer information associated with these vulnerabilities.

    JMP continues to monitor the issue and relevant vendor guidance. No action is required by JMP customers at this time.

  • Don’t miss your chance to experience Discovery Summit Europe at our best available rate! Early bird registration through 31 Oct.
  • Graph Builder Toolbar streamlines interactive graphing. Creates shortcuts on Report and GraphBuilder Helpers toolbars. Download and install the extension.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
RayE
Level III

Need a script to read a single bit in am 8 bit code

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.

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

much appreciated.

Ray

RayE_0-1650657381584.png

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
Craige_Hales
Super User

Re: Need a script to read a single bit in am 8 bit code

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:

 

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.

 

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).

 

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.

 

Another possibility might be numeric from -128 to 127 if the transfer somehow thinks the MSB is a sign bit.

Craige

View solution in original post

RayE
Level III

Re: Need a script to read a single bit in am 8 bit code

Thanks Craige

you gave the idea to use SUBSTR() function and I tested it out with random columns Test1,2,3

dt << New Column ("Extract_Bit5", formula(SUBSTR(:Test1, 5, 1)));
dt << New Column ("Extract_Bit7", formula(SUBSTR(:Test2, 1, 1)));
dt << New Column ("Extract_Bit0", formula(SUBSTR(:Test3, 8, 1)));

 

results

RayE_0-1650670513451.png

 

View solution in original post

3 REPLIES 3
Craige_Hales
Super User

Re: Need a script to read a single bit in am 8 bit code

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:

 

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.

 

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).

 

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.

 

Another possibility might be numeric from -128 to 127 if the transfer somehow thinks the MSB is a sign bit.

Craige
RayE
Level III

Re: Need a script to read a single bit in am 8 bit code

here is actual example of columns (smaller dataset) with each column's info, the decimal column is Numeric and Binary column is a Character.

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.

I do use this formula to convert from Dec to Binary

dt << New Column ("RegRead_Binary", formula(decimalToBinary = Hex(:RegRead, Base(2), Pad To(3))));

 

Thanks again

 

RayE_0-1650668481724.png

 

RayE
Level III

Re: Need a script to read a single bit in am 8 bit code

Thanks Craige

you gave the idea to use SUBSTR() function and I tested it out with random columns Test1,2,3

dt << New Column ("Extract_Bit5", formula(SUBSTR(:Test1, 5, 1)));
dt << New Column ("Extract_Bit7", formula(SUBSTR(:Test2, 1, 1)));
dt << New Column ("Extract_Bit0", formula(SUBSTR(:Test3, 8, 1)));

 

results

RayE_0-1650670513451.png

 

Recommended Articles