NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Support Forum » NerdKit Startup User Guide Bitwise Arithmatic pg 70 -

February 06, 2010
by Ralphxyz
Ralphxyz's Avatar

Having problems with the logic of the various switch positions. Humberto from support@nerdkit.com has been helping me with this, but I still do not know if the "problem" I am seeing is actually a problem or is just the way the MCU and the programming works.

What switch sequence do I use to get the total of 2?

Well I have the total of 2 showing but it does not make any sense to me that knows little. Picture1

To see a whole series of switch settings and the results that few if any make sense.

Pictures (live 9:00 a.m. - 9:00 p.m. e.s.t)

Why would I need 100 100 to get the total 2?

Is it the way the MCU handles the switch positions and this is to be expected?

Is it the Programming and by changing the programming I could get a logical sequence by switch position?

Humberto caught a wiring mistake but now this.

Thanks, Ralph

February 06, 2010
by N3Roaster
N3Roaster's Avatar

If memory serves, that project uses the pull up resistors in the MCU and the other side of the switch is connected to ground, so when a switch is closed, the connection pulls the pin down and you get a 0 when you read the state of the pin. When the switch is open (in the off position) you get a 1 when reading that pin. In your picture, switches 3 and 6 are in the off position, so that's 001 + 001, not 100 + 100. And since 1 + 1 = 2, that's the result you're getting. My proposed fix would be look at the breadboard from the opposite side (that is, with the numbers on the switch at the top). To get 100+100, you would set switches 1 and 4 to the off position. That should get you 4+4=8.

February 06, 2010
by Ralphxyz
Ralphxyz's Avatar

Thank you, I figured it was my perspective, I mean this stuff gotta work right.

"When the switch is open (in the off position) you get a 1 when reading that pin."

"switches 3 and 6 are in the off position, so that's 001 + 001, not 100 + 100"

Picture1 9:00 - 9:00 e.s.t.

Humberto had said that PCO (DP1) was the "significant bit of the first number in our code".

But I did not comprehend what he was saying.

By turning the breadboard around, as you suggest, so that PD1 is to the left it works!

That's great thank you so much, geesch perspective perspective.

Ralph

Post a Reply

Please log in to post a reply.

Did you know that you can connect a computer keyboard to your microcontroller? Learn more...