Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Bit shifting


  • Please log in to reply
3 replies to this topic

#1 Ellen

Ellen

    Advanced Member

  • Members
  • PipPipPip
  • 65 posts
  • LocationRotterdam, Netherlands

Posted 09 September 2012 - 08:19 AM

How do I write this in VB, it's from a arduino site. In Arduino ReadByte &= ~(1 << 7); thank you, Ellen

#2 nakchak

nakchak

    Advanced Member

  • Members
  • PipPipPip
  • 404 posts
  • LocationBristol, UK

Posted 09 September 2012 - 10:31 AM

hi ellen



The bb bitwise operators are listed here http://msdn.microsof...a(v=vs.80).aspx
that should help in translating the arduino c to vb

Nak.

#3 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 724 posts
  • LocationBerkshire, UK

Posted 09 September 2012 - 01:21 PM

Hi Ellen,

The visual basic bit shift operator is here: << operator

The visual basic bit-wise not "~" appears to be "Not": Logical and bitwise not

So I think you can write something like this:

a = Not(b << c)

I did not spot an &= equivelant, I guess you have to write it long hand!

a = a And Not(1 << 7)

Hope this helps - Paul (who is not a VB expert)
If I'm wrong, tell me so I can edit the post.

EDIT: removed semicolon. (thanks supra)

#4 supra

supra

    Advanced Member

  • Members
  • PipPipPip
  • 210 posts
  • LocationOntario, Canada

Posted 10 September 2012 - 10:58 AM

remove colon
a = a And Not(1 << 7);


to


a = a And Not(1 << 7)

BTW, I can even converted frm proteus, mplab, mikroC/mikroBasic to VB.Net




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.