Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 183691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T15:09:39+00:00 2026-05-11T15:09:39+00:00

I am working on a little Hardware interface project based on the Velleman k8055

  • 0

I am working on a little Hardware interface project based on the Velleman k8055 board.

The example code comes in VB.Net and I’m rewriting this into C#, mostly to have a chance to step through the code and make sense of it all.

One thing has me baffled though:

At one stage they read all digital inputs and then set a checkbox based on the answer to the read digital inputs (which come back in an Integer) and then they AND this with a number:

i = ReadAllDigital cbi(1).Checked = (i And 1) cbi(2).Checked = (i And 2) \ 2 cbi(3).Checked = (i And 4) \ 4 cbi(4).Checked = (i And 8) \ 8 cbi(5).Checked = (i And 16) \ 16 

I have not done Digital systems in a while and I understand what they are trying to do but what effect would it have to AND two numbers? Doesn’t everything above 0 equate to true?

How would you translate this to C#?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T15:09:40+00:00Added an answer on May 11, 2026 at 3:09 pm

    I think you ‘ll have to translate it to this:

    i & 1 == 1  i & 2 == 2  i & 4 == 4  

    etc… This is using the bitwise AND operator.

    When you use the bitwise AND operator, this operator will compare the binary representation of the two given values, and return a binary value where only those bits are set, that are also set in the two operands.

    For instance, when you do this:

    2 & 2

    It will do this:

    0010 & 0010 

    And this will result in:

     0010  0010 &----  0010 

    Then if you compare this result with 2 (0010), it will ofcourse return true.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 123k
  • Answers 123k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You can use Array.Copy() to copy elements from one array… May 12, 2026 at 12:59 am
  • Editorial Team
    Editorial Team added an answer IB will recognise the IBOutlets defined in the superclass. You… May 12, 2026 at 12:59 am
  • Editorial Team
    Editorial Team added an answer To use O(n) memory and O(n) performance, create a stack;… May 12, 2026 at 12:59 am

Related Questions

I am a single developer working on a project for my company. I use
I am working on a little Perl module and for some reason I had
I am working on a little pinball-game project for a hobby and am looking
I am working on a small AIR desktop application and I have some configuration

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.