Results 1 to 6 of 6

Thread: small question about if?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Apr 2006
    Posts
    24

    small question about if?

    what dose mean this code

    If (B And &H80s) Then
    IIC_tx_bit_1()
    Else
    IIC_tx_bit_0()
    End If

    IIC_tx_bit_1() and IIC_tx_bit_0() are functions
    Last edited by vbnm; Apr 28th, 2006 at 03:02 AM.

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    105,468

    Re: small question about if?

    The AND in the expression is a bitwise AND. A bitwise AND means that you perform an AND on each individual pair of bits to get the corresponding bit in the result. That expression will evaluate to True if any of the corresponding bits in the two values are both set, e.g.

    0110 AND
    1001 =
    0000 => False

    0110 AND
    0100 =
    0100 => True

    A bit is only set in the result if the corresponding bit in both operands is also set. If the result is non-zero then it evaluates to True. You can also perform bitwise OR and bitwise XOR.

    In that code it basically means that if the first bit in B is set the execute the first method, otherwise execute the second method.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Apr 2006
    Posts
    24

    Re: small question about if?

    thanks a lot i have another problem could you help me please!!
    what dese mean this code

    SDA_value = MSComm1.CTSHolding

  4. #4
    Frenzied Member zuperman's Avatar
    Join Date
    Dec 2000
    Location
    Portugal
    Posts
    1,033

    Re: small question about if?

    Quote Originally Posted by vbnm
    thanks a lot i have another problem could you help me please!!
    what dese mean this code

    SDA_value = MSComm1.CTSHolding
    post all the code...with the module and procedure declarations, please...
    Help keep this forum clean: Remember to mark your thread as resolved Search before you post Remember to rate posts that help

    VS2010: Visual Studio 2010 Keybinding Posters
    Service Pack 1
    Tools: GhostDoc - automatically generates XML documentation comments
    NuGet package Manager PowerCommands IDE extensions
    Source Control: ankhsvn - integration for SVN
    Windows Shell Extension for Subversion

    Development Laptop: Intel Core i5 430M 2.26 GHz @ 2.53 GHz
    4096 MB, DDR3 PC3-8500F (533 MHz), Kingston ATI Mobility Radeon HD 5470 15.6 @ 16:9, 1366x768 pixel, HD LED LCD

    I follow:
    JoelOnSoftware - A weblog by Joel Spolsky, a programmer working in New York City, about software and software companies
    ScottGu's Blog - Scott Guthrie works for Microsoft as the Product Manager of the .NET Framework
    Portugal-a-Programar - Portuguese Developers Community
    .NET Rocks! - is a weekly Internet audio talk show for .NET Developers.

    Programming Languages:
    C#
    VB.NET JAVA PHP Javascript
    Other:
    XML
    HTML CSS JQuery SQL



    *** Proudly Portuguese ***

  5. #5
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    35,242

    Re: small question about if?

    Ya, the line as you have it assigns the value from MSComm1.CTSHolding to the variable SDA_value. Why that is being done is unclear from the code, just as it is unclear what either of those values actually are.
    My usual boring signature: Nothing

  6. #6
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    105,468

    Re: small question about if?

    Can I suggest that you keep each thread to a single topic? If you have an unrelated question you should ask it in a new thread. That helps to keep the forums more orderly and makes it easier to find the information you want when searching.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width