Trim a single bit from a byte?

OK so im a mechanical guy, not a programming guy so lets start there.  I just learned how hexadecimals work and have limited experience in LABview.  I have been searching this topic for days, maybe its just my vocabulary but I havent found anything.
I need to analyze a signal coming from a CAN system.  I dont have the can device yet but I'm accessing position sensors on the system.  They come in as 8-bit hexadecimal messages.  I am currently simulating this message as a string in LABview so i can get one part of my program ready.  The manufacturer has given me example code that requires concatenating two bytes but I only need 3 of the bits to be concatenated. (one needs the last bit trimmed and the other 2 need the first bit trimed.)  I have already concatenated the two bytes necessary but cannot figure out how to get rid of an individual bit.  I need to do this as hex values to get the proper measurements.  I know my programming grammar is probably a bit off so let me give you an example.
Example String of Hex Values
03 23 F6 21 B4 C4 74 F6
The first sensor requires bits 3 &4 (21 & b4)
In this case they are required to be in the order 4,3 and drop the first bit to receive 421 as the needed hex value.  So far I have made an input string to simulate the incoming CAN message with that 8bit hex values.  I then use string subset to isolate the individual bytes and finally concatenate to get them in the correct order and end up with B421.  I cannot figure out how to drop the "B" bit or replace with a zero.  I can only replace the full byte.
Is there an easier way to do this.  I plan to use the example VI to receive the CAN messages which outputs to a string, hence why I am using strings.
Thank you in advance for the help.  I am going crazy trying to figure this out.
Also if any other details are necessary please let me know

jpc335 wrote:
I was told by the manufacturer that the 3 bit hexadecimal string can then be converted into usable numbers.  So if its faster/easier to replace the first byte with a 0 or turn it into a 3 bit hex string.  Either will work.
You want to break yourself of this misuse of bit ASAP.  A bit is a single 1 or 0.  Hex requires 4 bits to find the values.  The purpose of hex is to reduce the number of bits you must write out so things are easier to read.
0000 - 0
0001 - 1
1010 - A
1111 - F
When you have two hex digits, you have 8 bits, or a byte.  You're talking about two entirely different conversations when you ask how to extract a bit or a byte.  It's generally easier to pull out the byte.
You'll also want to be careful with words like "third."  You're not looking for the third byte.  You're looking for the fourth byte.  WIth zero-indexing, it could be the byte at index 3.  But, you're creating confusion when you use third to mean fourth.
In terms of solving your problem, it sounds like you're going to have a string of characters.  At this point, it's relatively meaningless to view them as hex.  The environment sees them as a string and will operate on them as such.  You can use string parsing VIs to remove the parts of the string you don't care about.  If the format always looks like what you showed us, it wouldn't be hard to traverse through the string by looking for spaces.  From there, you'd need to worry about whether you need the values to be in a numeric type or if string is still sufficient.  But, you should handle splitting off only the string values representing the two bytes you're worried about.  Once you can do that, you can take the next steps.

Similar Messages

  • Getting bits of a byte

    I'm searching for an easy methode to get a bit of a byte. Is it possible to act on a single bit of a byte maybe in a way like the following:
    byte myvar = (byte) 15;
    boolean mostsig = mybit.BIT7;
    and upside down
    byte myvar;
    myvar.BIT6 = true;
    I searched the whole day but fund only solutions for integers. I don't want to go a long way by converting to an int and then to a String of bits ....
    thx very much [alibaba]

    thx I allready read the BitSet thing but it wasn't helpful because there is no function implemented to load a whole byte inside. But the bitmasking was good
    thank you!!!
    have fun [alibabashack]
    don't wonder about alibabashackweb
    alibabashackweb = alibabashack
    I just had some probs I think a bug in the forum caused this. now I have an account and two screen names^^

  • OPC data tag-single bit

    I am trying to read OPC data tags using LabView 6.0
    For bit data, the tag list says 1=ON, 0=OFF
    What data type should I use to read and write a single bit?
    I have tried I8 and boolean, but neither seem to work.

    Here is the read tag byte data as viewed from the OPC server explorer.
    The send tag is similar structure.
    Again I can use data socket to read (or write)the entire byte, but I don't
    know how to address individual bits
    Attachments:
    OPC Byte and Bit-read.JPG ‏94 KB
    OPC Byte and Bit-write.JPG ‏83 KB

  • How to restore a single table from a DP Export from a different schema?

    Environment:
    Oracle 11.2.0.3 EE on Solaris
    I was looking at the documentation on DP Import trying to find the correct syntax to import a single table from a DP Export of a different schema.
    So, I want to load table USER1.TABLE1 into USER2.TABLE1 from a DP Export.
    Looking at the REMAP_TABLE options:
    REMAP_TABLE=[schema.]old_tablename[.partition]:new_tablename
    OR
    REMAP_TABLE=[schema.]old_tablename[:partition]:new_tablenameI can't see where to specify the target schema name. The examples had the new table name residing in the same schema with just a new name.
    I looked at the REMAP_SCHEMA but the docs say that will import the entire schema into the new schema and I only want one (1) table.
    Any suggestions are most welcome!
    -gary

    I thought I tried that combination and it seemed to me that the REMAP_SCHEMA somehow over-rode the TABLES= parameter >and started loading all the objects.If it does fail (and it should not) then please post the details here and I will try to see what is happening.
    Let me get back into the sandbox and try it again. I admit I was in a bit of a hurry when I did it the first time.We are all in a hurry, no worries. If it fails, please post the details and the log file.
    Does it make any sense that one parameter would override another?No, this should never happen. We have tons of checks to make sure the job can't have multiple meanings. For example, you can't say
    full=y schemas=foo --- Which do you want, a full export or a list of schema exports, etc.
    Your suggestion was the first thing I thought would work.This should work. If not, please post the log file with the command and the results.
    Dean
    Thanks again for the help and stay tuned for my new attempt.
    -gary

  • I need to add a single field from with_item table . need to write select query with reference to company code , account doc no , fiscal year

    I need to add a single field from with_item table . need to write select query with reference to company code , account doc no , fiscal year

    Hi Arun ,
    Can you explain little bit more ??
    what is account doc no? 
    what are the transactions should be displayed in your output??
    -Rajesh N

  • Streaming multi bit rate and single bit rate

    I'm trying to simplify my setup.  Sometimes I need to stream multi bit rate and sometimes I need to stream single bit rate.  This is due to the internet connections I'm sending from sometimes have poor upstream and multi-bit rate is too much bandwidth to send... So....  We resort to single bitrate.  As I understand my encoder and server settings are different for each of these...  I created a single and multi-bitrate profile for Adobe Media Encoder.  That was simple enough.  My question/concern is in regards the server settings.  I would like to have a server setting for multi-bitrate and a setting for single bit rate.  My goal is to void making changes  on the server.  I simply want to load the desired Adobe Media Encoder Profile.  So, do I need to create a dedicated event for single bitrate?  Below is the syntax I send to my server from Adobe Live Encoder.  Instead of using 'liveevent' for my event would I just give it a different name?  Does this stand true for my .m3u8 files?  I'm confused to how to name differnet event/streams.... 
    livestream%i?adbe-live-event=liveevent&adbe-record-mode=record

    Hi,
    When you use a setting like: livestream%i?adbe-live-event=liveevent then the encoder expects multibitrate streams (the %i is replaced by a number so the streams published will be livestream1, livestream2 and livestream3). You cannot use the same setting in the encoder for single stream. Instead you'll have to use livestream?adbe-live-event=<event_name>. You could create a new event under the same application.
    Hope this helps. Let me know if you have any other queries.
    Thanks,
    Apurva

  • 32 bit integer to byte

    Hi All,
    i convert 32 bit integers to bytes , and this works fine with a small problem.
    when i print the bytes i get 0 for 00 and A for 0A and so on, i use the method below to put the "0" , but it isn't the best way to handle with bytes
    String  tChar;
    String tOut;
    for(int id = 0; id < mSendByteArray.length; id++){
    tChar=Integer.toHexString(mSendByteArray[id] & 0x0FF).toUpperCase();
    tOut = (tChar.length() < 2 ? "0" + tChar : tChar).toUpperCase();
    System.out.println(tOut);
    }can anybody please help
    best regards

    Create an int from the bytes and format that as a hex string, adding on as many extra zeros as necessary?
    You could always build up a char[8] and fill it by bit-shifting and masking your int to fill it with 0-F values. This is essentially all Integer.toHexString does and it's not so special that you couldn't just reimplement it in a utility method yourself.
    Extending NumberFormat to do this would be a tidy approach but perhaps not "optimal".
    Hope this helps.

  • Single bit error in X2200 and rebooting frequently

    I have X2200 M2 server rebooting frequently with single bit error with amber led in the memory with one cpu location but if i swap that error will go and there is no amber led system is running fine but frequently i am getting same issue.
    I am using the applications simulators like hspice64, spectre, ultrasim64
    system configuration is linux rhel 4 update 4 32gb memory.
    is it a bug or any hardware compatibility issue is there in that application or box kindly let me know.
    my mail id [email protected]

    Upgrade the ilom and BIOS frimware to latest if its low . Run PC check utility by downloading from www.sun.com and if the problem remains the same log a ticket with Sun for further investigating . collect the logs from ILOM and IPMI prior to logging the ticket .
    Ravi

  • How to download a single file from abs cvs (community)?

    As a little edit of soloport's ingenious script for downloading single packages/directories from ABS instead of downloading everything, this is absget.
    #!/bin/bash
    # Downloads a single package from CVS CURRENT (much like ABS)
    # Requires one or two arguments, one which specifes the CVS path (e.g. kernels/kernel26)
    # and the other who specifies the repository (defaults to "arch")
    # Creates a local DIR, for example, where DIR=kernel26 in kernels/kernel26
    if [ "$BASH_ARGC" ]; then
    [ "$2" ] && REPOS="$2" || REPOS="arch"
    export CVSROOT=:pserver:anonymous:[email protected]:/home/cvs-$REPOS
    DIR="$1"
    declare -a ARY
    declare -i NUM
    ARY=( `echo $DIR | sed 's/// /g'` )
    NUM=${#ARY[*]}-1
    PKG=${ARY[$NUM]}
    echo DIR="$DIR", PKG="$PKG", REPOS="$REPOS"
    [ "$REPOS" = "arch" ] && cvs -z3 co -r CURRENT -d $PKG arch/build/$DIR
    [ "$REPOS" = "extra" ] && cvs -z3 co -r CURRENT -d $PKG extra/$DIR
    [ "$REPOS" = "unstable" ] && cvs -z3 co -r CURRENT -d $PKG unstable/$DIR
    rm CVS CVSROOT -R 2>/dev/null
    exit 0
    else
    echo "not enough arguments"
    exit 1
    fi
    As you maybe can see, it's missing a line for community. Whenever I try to test this method with the community dir (/home/cvs-community) I get this error:
    $ export CVSROOT=:pserver:anonymous:[email protected]:/home/cvs-community
    $ cvs -z3 co .
    no such user anonymous in CVSROOT/passwd
    cvs seems to authenticate in a different way than cvsup does, I've tried for hours to get this working (even with the help of wireshark), but with no luck. Can anyone help?

    byte wrote:This could be a hint: http://cvs.archlinux.org/cgi-bin/viewcv … vsroot=AUR (not "Community")
    yes, but I don't know how  to access it without using abs or viewcvs

  • How to find whether a text is single bit or double bit?

    Hi All,
      We have a requirement to restrict the user from entering any double bit characters in a text field. Words in English and numbers can be allowed. If anything apart from this, an error message needs to be given. Is anybody aware of how we can find if a character entered is a double bit or not?
    Thanks in advance.
    Saritha

    Hi,
    try this code.
    REPORT abc.
    PARAMETERS: p_text(10) TYPE c.
    CONDENSE p_text.
    IF NOT p_text+1 IS INITIAL.
      MESSAGE 'Error: Enter single bit' TYPE 'E'.
    ENDIF.
    IF NOT ( p_text CA sy-abcde OR p_text CA '0123456789' ).
      MESSAGE 'Please enter alpha numeric' TYPE 'E'
    ENDIF.

  • Javax.crypto.spec.SecretKeySpec seems to ignore the last bit in every byte

    Hi All,
    I am having a problem with the SecretKeySpec class in JCE 1.2.2. I am using DES as algorithm, and a 8 byte long key. I am passing a hex array of 16 characters (each 2 representing a byte) and create a byte array of length 8 from that hex array. For example, the following "A12C3D4E5F6A7B8E" is equivalent to a byte array, having the values of the bytes (in signed byte) [-95, 44, 61, 78, 95, 106, 123, -114]. It works perfectly but what I observed is, if one of the bytes looks like "5E" and I change it to "5F," the code still works, the encrypted text using the key created with "5E" key is decrypted correctly using the "5F" key. It doesn't work if the byte is "E5" and I change it to "F5," and this led me to think that the SecretKeySpec implementation ignores the last bit of every byte (uses just the high 7 bits.)
    Anybody came accross this before? Any help appreciated.
    THanks,
    Marius

    As I said, "every implementation I'm aware of ignores them". They're not used during en/decryption, they exist only to provide (marginal) evidence that the key might have been mangled in-transit. Many implementations just skip that step. Note that i'm not saying this is a good thing - it's just been my experience.
    The 64-bit quntity you're playing with is NOT "the key" - the DES key is the 56 bits that do not include the parity bits. Ignoring the parity-bits doesn't yield more keys that will do the same decryption, since the parity bits aren't used by DES itself.
    The net? Don't worry about it. It's the 56 bits that are the important ones.
    Grant

  • Extracting single shot from project library

    I have just converted a vhs vid. tape onto a dvd using imovie and idvd, all successfully but I wanted to extract a single shot from the project to use for an outside application. I have got as far as extracting the shot and it is now in the project library as an additional frame but I cant figure how to transfer it to another application so that I can use it for other purposes, any help please ?
    Regards,
    Colin

    11woodchip wrote:
    ... lol its an age thing . ...-
    naw, me 50+ either ... the nomenclatura is a bit weird, its own lingo ...-
    for iM11 advice is a lot more complicated, because Apple switched some internal stuff from 09>>11.
    you need a (free) 3rd party tool, Mpeg Streamclip
    • ctrl-click on the clip, which contains the future freeze
    • choose Reveal in Finder
    • open that clip with your new tool Mpeg Streamclip
    • select your frame, you need solo
    • choose 'Export Frame' ...

  • How do you create a BitSet from a Byte (or byte)?

    I have a byte and would like to know the binary values of each 8 bits in the byte. I have read the javadoc on BitSet, but cannot figure out how to create a BitSet from a byte, so that I can identify the value of each 8 bits of the byte.
    Does anyone know how to create a BitSet from a byte OR is there another simpler way to print the bit values contained in a byte?

    I found a reference that prints the binary rep. of a byte.
    Integer.toBinaryString(aByte & 0xff));

  • DIMM 4 has single-bit error

    This is an Warning message that got on the Embedded Lights Out manager of an X2200M2 server:
    "DIMM 4 has single-bit error"
    I also have a orange flashing light on front of the server.
    What does it mean exactly ?

    Glance through this forum thread from May 2006:
    http://forum.java.sun.com/thread.jspa?forumID=830&threadID=5097092
    Then use your contract login to Sunsolve and read the following Infodocs:
    70361
    79928
    74049

  • How can I restore a single image from an aperture time machine backup, do I have to restore the entire library? that does not make sense

    I hope there has been found a more efficiant solution for this,  how can I restore a single image from an aperture time machine backup, I really hope I don't have to restore the entire library? that does not make sense
    any suggestions?

    Did you try browsing your backups in the Finder ?  That is, do not go and "Enter Time Machine".  Instead, navigate to your Time Machine backup via Finder and then manually go to the time period (by folder name) you are looking for ... when you find your Aperture library you can then "Show Package Contents" and find the Master you are looking for.

Maybe you are looking for

  • Is there a way to view our contacts when offline o...

    I am not at home, but I need a phone # off my contact list. Is there a way to view my contact from my account? Since our contact are on a server, you'd think that would be possable.... but then again, we're talking about skype here.... not much commo

  • A black bar appeared at the bottom of the new window after I drag a tab out.

    this is actually an issue back in the mavericks safari, but the problem was somehow solvable and was not appearing every time. after upgrading to Yosemite, this problem appears every time. The problem is : when I have several tabs, then I drag a tab

  • Oracle Enterprise Manager Serices is not Starting Up!

    Hi, I am Using Oracle 10g Database Release 2 on Windows 2003 Server Enterprise Edition. My Service Name of Em is "OracleDBConsoleSIPDB" this Services is Not Starting Up after restarting the Server. Please Adivce me, what are the thinks has to bee Che

  • How to get the real name of a sender ?

    When I receive a message under JavaMail, I want to get the real name of the sender but when I do a getFrom() I received a string like : =?iso-8859-1?q?Julien=20Dupont?= <[email protected]> But I only want the real name... How can I do to recover only

  • Which hard drive config is the best for an existing system?

    Hy there, We have this system: DELL PRECISION T3500 64 BITS CPU INTEL XEON W3520 2.67GHZ  266 MHZ 4 CORE - 12 GB RAM NVIDIA GEFORCE GTS450 MATROX RTX2 - 5.1.2.8 PREMIERE PRO CS5 (5.02) WINDOWS 7 PRO SYSTEM HD 500 MB With this HD config: B: EXPORT (pa