Binary operations

Hi all,
Okay im not very familiar with much binary operations, so I need a little help.  The problem that im having is the DAQ board im using has uses a 32 bit interface for digital I/O, and I need to be able to change  lines 8-22, depending on the decimal number and base the user enters and have that binary be in inverted logic.  For example if the user entered 486.6 with a step size of 0.05 the binary in regular logic would be 000000000 010011000000100 00000000 and in inverted logic 000000000 101100111111011 00000000 and I dont want the change of decimal affect any others lines of the code.  I think maybe for that I could just set a max limit for the decimal number to being 2^15-1, but not sure I can create this limit and shift in the binary in labview.  Any help would great, thanks.

dbartz,
Al of the logic primitives are polymorphic, meaning that you anc use them with numerical values. Set up your data as an unsigned 32 bit integer (U32). Use AND and OR functions to mask off the parts you want to change and the parts you want to protect. If you had 8-bit words (for a simplified example) and wanted to change bits 2, 3, and 4, you could do this:
let K = old data (example K = 10101010)
let P = new data (example P = 00111110) {Notice that P has non-zero values in bits other than 2, 3, 4}
let Mk = mask for old data (example Mk = 11100011), and
let Mp = mask for new data (example Mp = 00011100 = NOT Mk).
Then (K AND Mk) OR (P AND Mp) = data to write.
Using the example values above (K AND Mk) = 10100010, (P AND Mp) = 00011100, and data to write = 10111110.
Lynn

Similar Messages

  • In range and coerce binary operation

    How do I implment the "in range and coerce" function with binary operation?  I want to do that to make my fpga code more efficient.
    Kudos and Accepted as Solution are welcome!

    What exactly do you mean by "binary operation"?  I am assuming you are dealing with integers here to make life simple.
    The In Range portion is just a simple Less Than and a More Than with an AND ( x < UL && x > LL).  The Coerce portion would likely be best done with Select nodes based on the Less Than and the More Than comparisons.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • RS-232 binary operation

    Dear all,
    I am a researcher with commercial instrument.
    After communication with my technician, I got to know I have to do binary operation in RS-232.
    But I am not familiar with the binary operation.
    Could you please give me some solution about this by labview 6 or 7?
    I attah a part of the manual.
    *)please let me explain the meaning of the parameters.
    Host → Ecotec II: 5(start the communication), 5(length of the command, 5 bits),
    3 (RS-232 functional command), 0(parameter of the command), 13(checksum, 5+5+3+0).
    Very thank you for your attention.
    Any comments will be very helpful to me.
    Attachments:
    aaa.bmp ‏1129 KB

    Duplicate.
    Try to take over the world!

  • Binary Sytem / binary operation

    I need any references (websites/PDFs) explainning binary sytem and binary operations (conversion,subtraction,division..)
    thanx in advance

    hi,
    try these:
    http://mindprod.com/jglossbinary.html
    http://www.learnbinary.com/
    for the last one click start in the top banner to start the tutorial, it's shown in an applet so it might take time to load depending on your connection.

  • Binary Operation in PL/SQL

    How do I do binary operations like or/and/xor in pl/sql? Are there any built-in libraries?

    I believe NOT x = -x - 1So NOT 19 = -20andNOT -8 = 7Hope this helps,
    T.

  • How can i do bitwise (binary) operations (AND, OR, XOR)

    I need to do bitwise (binary) operations such as AND, OR, and XOR.  For example, how do I AND 10101000 with 11111000?

    for OR, with 10101000 in A1 and 11111000 in A2, try:
      =1×SUBSTITUTE(A1+A2,2,1)
    Result:  11111000
    and for XOR, try:
       =1×SUBSTITUTE(A1+A2,2,0)
    Result: 1010000  (missing leading 0)
    You can display missing leading zeros by setting the cell's Data Format to 'Numeral System' with Base set to 10 and Places to 8, or turn the result into a string with something like this (assuming the result is in A3):
         =RIGHT("0000000"&A3,8)
    SG

  • Binary operations in Java

    Hi,
    are there any binary operations in Java like '&' in C? I didn't found any information in the API description.
    Thank u.

    You didn't find them from the API since they are a feature of the language. Try the langspec instead: http://java.sun.com/docs/books/jls/second_edition/html/expressions.doc.html#5228

  • How to use/implement xor binary operator in oracle

    Hi,
    Like in VB and .Net we have a Binary operator/expression called Xor for the following
    logic....
    EXAMPLE:
    A Integer = 10
    B Integer = 8
    C Integer
    c = (A Xor B) OUTPUT is 2
    1010 (10 in Binary)
    1000 (8 in binary)
    0010 (result is 2 in binary)
    I want to implement the same logic in Oracle do we have any builtin operator function
    for this? If we dont have can anyone please try to code it. It will be very helpful and
    urgent.
    Thanks in Advance
    Reddy

    do we have any builtin operator functionfor this?
    Up to a point. Specifically, Oracle has a BITAND() function. With this it is possible to code our own BITOR and BITXOR functions. I'm glad to say I personally haven't had to worry about bits for over ten years, but Connor McDonald has posted a solution on Jonathan Lewis's FAQ site.
    Cheers, APC

  • Spamtrainer error - binary operator expected

    On 10.4 server, this error started showing up. No updates were installed. Hoping to fix this, I even installed updated spamtrainer. But it did not help.
    At the command line, I typed this:
    /usr/sbin/spamtrainer -p col -d
    (where col is the partition name)
    Starting spamtrainer...
    Training from user folders
    /usr/sbin/spamtrainer: line 1021: [: /Volumes/Users/user_name/Mails: binary operator expected
    /usr/sbin/spamtrainer: line 1028: [: /Volumes/Users/user_name/Mails: binary operator expected
    Either there is no mailbox called user/junkmail in the mailpartition col
    or it has never been fed with mail.
    /usr/sbin/spamtrainer: line 1050: [: /Volumes/Users/user_name/Mails: binary operator expected
    Either there is no mailbox called user/notjunkmail in the mailpartition col
    or it has never been fed with mail.
    Syncing SpamAssassin Database
    Displaying SpamAssassin Database Stats
    0.000 0 8860 0 non-token data: spam
    0.000 0 40718 0 non-token data: ham
    Deleting learned HAM and SPAM
    Done!
    Output produced by spamtrainer Version 1.8.5
    There are mailboxes junkmail and notjunkmail. Junkmail is always fed. I don't understand why it is going to /Volumes/Users/user_name/Mails and shouting "binary operator expected".
    Appreciate any help.
    Thanks !

    /etc/imapd.conf:
    admins: cyrusimap, serveradmin
    configdirectory: /var/imap
    partition-default: /var/spool/imap
    unixhierarchysep: yes
    altnamespace: yes
    servername: our_domain.net
    sievedir: /usr/sieve
    sendmail: /usr/sbin/sendmail
    lmtpdowncasercpt: 1
    tlscertfile: /etc/certificates/our_domain.crt
    logrollingdays: 1
    logrolling_daysenabled: true
    enablequotawarnings: yes
    lmtpover_quota_permfailure: yes
    tlskeyfile: /etc/certificates/our_domain.key
    popauthgssapi: yes
    popauthapop: yes
    imapauth_crammd5: yes
    imapauthgssapi: yes
    imapauthlogin: yes
    imapauthplain: yes
    tlscafile: /etc/certificates/our_domain.chcrt
    partition-col: /Volumes/Users/serveradmin/Mails
    Message was edited by: Chakravarthy Cuddapah

  • Java and binary operations (roll)

    Is there any roll operations in java?
    1011 rolled to the right would become 1101
    1011 rolled to the left would bcome 0111
    How can I accomplish this?

    Why do you need that?I'm making a huffman encoder and need binary paths. I shift individual paths into a long path, but when an individual path exceeds the total number of bits I need to store the highest bits into the remaining of the path. Its easier to mask the lower segment than the higher in a collection of bits, so I would like to roll the path to the high bits end up at the lower part of the path and then mask the path so it contains a correct number of bits and shift it into the remaining bits.
    example:
    current path - 10110010110010000
    path - 1000
    notice the three last bits (000). This is where I want to 'store' 1000. Since 1000 is four bits I need to take the 3 highest bits (100) store these and store the last bit in a new long path. I can mask the lowest by doing 'path &= ((int)Math.pow(2, bit) - 1)' but this is not possible with high bits.
    Nille

  • Byte - bit - binary operations

    hi everyone, i've got a couple of quick (i hope) questions.
    1. if i have a byte array:
    byte[] byteArray = new byte[100];
    and i wanted to add up all the 1s of each byte in byteArray, how would i do that? i know that a byte is 8 bits, so that could mean that each byte will add up to 8 at the most... but how do i do the actual adding-up?
    2. how do you add up bytes in the binary sense? meaning, if i wanted to add byteArray[2] to byteArray[3] in binary, how do you do that?
    so if byteArray[2] = 1000100 and
    if byteArray[3] = 0111010, how would i do the adding so that i get a byte that is 1111110 ?
    3. also, how do you check to see if, say, the 5th bit in byteArray[10] is a 0 or a 1?
    thanks everyone - i appreciate your help!

    hi everyone, i've got a couple of quick (i hope)
    questions.
    1. if i have a byte array:
    byte[] byteArray = new byte[100];
    and i wanted to add up all the 1s of each byte in
    byteArray, how would i do that? i know that a byte is
    8 bits, so that could mean that each byte will add up
    to 8 at the most... but how do i do the actual
    adding-up?
    for(int y = 0; y < 100; y++)
        for(int x = 0; x < 8; x++)
            if( byteArray[y] & (1 << x) )
                count++;
    2. how do you add up bytes in the binary sense?
    meaning, if i wanted to add byteArray[2] to
    byteArray[3] in binary, how do you do that?
    so if byteArray[2] = 1000100 and
    if byteArray[3] = 0111010, how would i do the adding
    so that i get a byte that is 1111110 ?byte b = byteArray[2] | byteArray[3];
    3. also, how do you check to see if, say, the 5th bit
    in byteArray[10] is a 0 or a 1?00010000
    76543210
    so byte b = 00010000
    if( b & (1<< 4) == 1 )
    //true if the bit is 1
    thanks everyone - i appreciate your help!

  • Execute external operating system command

    Hi Friends,
    I have a requirement to run a script file with extention '.PL' on the application server using ABAP.
    i have sample how to run it in XI.
    XI3.0 provides a very simple way of handling this using the "Operating System Command" in the File Adapter.
    I post my output file in the following folder,
    /usr/sap/sapout/test/
    The shell script is available in the following path,
    /usr/sap/bin/convert.pl
    The figure below explains as to how we call the shell script using "Operating System Command".
    File Acess parameters
          Target Directory      = /usr/sap/sapout/test/
          File Name Scheme = TestOutput.txt
    Processing Parameters
         File Construction Mode          = Add Time Stamp
         File Type                              = Binary
         Operating System Command = /usr/sap/bin/convert.pl %F
    I have to do the same thing in ABAP as it has been done for XI as mentioned in the above example.
    My operating system is UNIX.
    If any one can give me a sample it would be really helpful to me.
    Thanks in advance,
    Arundhathi.

    Hi Arundhati,
    You can run operating system commands from ABAP.
    e.g. If you want to change UNIX right for any file, you can use following code.
    lv_ucomm  = 'chmod a+rwx 123.txt'.
    CALL 'SYSTEM' ID 'COMMAND' FIELD lv_ucomm.
    whatever command you provide in Field parameter ( lv_ucomm in the above case ), ABAP run that command at operating system level.
    In your case, you can provide command in lv_ucomm to run script at operating system level.
    Hope it will help you.
    Regards,
    Naren

  • The operation priority question

    hi.
    i have one problem.
    may be i am not understand so well but...
    the operation priority of postfix increment is higher than the binary + operation priority and i have this problem.
    int p = 5;
    int b = p + p++ + p++;
    Sytem.out.println(b);i think that it must print "18".
    but i was surprised when it printed "16".
    what you think about this?
    Edited by: nuinisk on Feb 18, 2008 7:15 AM

    nuinisk wrote:
    hi.
    i have one problem.
    may be i am not understand so well but...
    the operation priority of postfix increment is higher than the binary + operation priority and i have this problem.
    int p = 5;
    int b = p + p++ + p++;
    Sytem.out.println(b);i think that it must print "18".
    but i was surprised when it printed "16".Higher priority doesn't mean it's executed first. The expression is evaluated left to right. Operator precence simply means where the parenthese would go.
    First it evaluates p, which is 5
    Next, it evaluates p++, which also has a value of 5. Remember, the value of x++ is x's original value. x getting incremented is just a side effect.
    Next it evaluates p++, which has a value of 6. A side effect is that p's value goes to 7, but the value of the expression is, by definition, p's value before that happens.
    5 + 5 + 6 = 16.

  • Left-shift operator used on byte values

    Hello,
    I'm reviewing some problems, and I need some help. I have a program that has some code like the following:
    byte y = 10; // 00001010 in binary
    byte result = (byte) (y << 1);
    System.out.println("result: " + result); // 20.  Ok.
    result = (byte) (y << 7);
    System.out.println("result: " + result); // 0.  Ok.
    result = (byte) (y << 8);
    System.out.println("result: " + result); // 0. Why???
    // I was expecting a shift of 0 bits because the
    // right-hand operand is equal to the number of
    // bits for the size of the result type--in this case
    // 8 bits for a byte.
    // 8 % 8 = 0 number of bits for the shift.
    result = (byte) (y << 6);
    System.out.println("result: " + result); // -128.  Ok.
    result = (byte) (y << 10);
    System.out.println("result: " + result); // 0.  Why???
    // Shouldn't it be 2 bits for the shift?
    // That is, 10 % 8 = 2.
    // I was expecting 40 as the the answer for this one.I understand that for binary operations that the operands will be promoted to at least int types before execution occurs, but I still don't see how it would make a difference for the left-shift operator. Any help and clarification on this will be appreciated. It would be helpful to see the binary representation of the the "result" variable for the ones that I'm asking about. Thanks in advance.

    result = (byte) (y << 8);
    System.out.println("result: " + result); // 0. Why???
    // I was expecting a shift of 0 bits because the
    // right-hand operand is equal to the number of
    // bits for the size of the result type--in this case
    // 8 bits for a byte.the result of (y << 8) is an int, not a byte. the byte "y" is promoted to int for the bit shift. so the int result of the bit shift is 00000000 00000000 00001010 00000000. when you cast that back to byte, the 24 leftmost bits get lopped off, and you're left with zero.
    hth,
    p

  • Help with operator precedence.

    I'm having trouble telling whether + and - signs are unary or binary in figuring out operator precedence. I understand that the unary makes things positive and negative and that the binary is addition and subtraction. here is an example from my notes.
    a + b > - c I I ! d && e == f - g % h. It says that the a+b is the first order of evaluation. Heres the full order is gives for the order of evaluation. (132948765) What I don't understand is how the first plus is unary and not binary because it seems to be addition, and I was under the influence that the unary+ is not used very much. Could someone clear this up. Thanks
    Edited by: javaguy84 on Oct 4, 2007 10:38 PM
    Edited by: javaguy84 on Oct 4, 2007 10:39 PM

    What I don't understand is how the first plus is unary and not binary because it seems
    to be additionYou're right the first plus is a binary operator - otherwise the "a" would be left stranded: unconnected to the rest of the expression.
    In trying to figure out why the plus is the first operator (first in order of operation I mean, not leftmost) it might be helpful to bear in mind: With binary operations (and other places) Java evaluates things left to right. The left hand operand will be completely evaluated before work starts on the right hand operand.
    This is in addition to operator precedence and parentheses.
    See if that helps figure out the order.
    jverd is correct this is a dumb question. It has as much to do with expressions and their evaluation as a crossword puzzle has to English literature. Its dumbness is not of your making, but you might like to raise with your teacher that view that expressions like this would be wrong even if they were correct.
    (Finally there isn't really an order completely defined for this expression because some of the subexpressions may - or may not - ever be evaluated.)
    Post back if you can't figure it out. But give your reasons. Ie list step by step how you think the expression would be evaluated.
    [Edit] Except that assignment operators are evaluated right to left!

Maybe you are looking for