PDA

View Full Version : What's up with my HomeWork board?



Thomas C.
01-28-2010, 12:24 AM
In the "What's a Microcontroller?" workbook for the HomeWork board, there is an exercise on pages 76-78 using the Pushbutton. I built the circuit in Figure 3-6, connected power, wrote the program on page 78 exactly, and something is still wrong: whenever I run the program, IN3 always equals 1, regardless if I'm pushing the button or not.

I took apart the circuit and rebuilt it, and the same thing happens - IN3 always equals 1 in the debug window. Finally I took everything off the board and ran the program, and IN3 keeps coming up as 1.I can take a picture also and upload it here if needed.

Is there something wrong with the board, or could I have possibly damaged it?

Post Edited (Thomas C.) : 1/27/2010 4:32:12 PM GMT

Mike Green
01-28-2010, 01:13 AM
It's possible there's something wrong with the board. An easy way to tell is to use a different I/O pin. Wire up the circuit in Figure 3-6, but use I/O pin # 7 or # 0 and change the IN3 to IN7 or IN0 and see what happens. If it works with a different I/O pin, then pin # 3 may have a problem.

Do check the wiring again. You might have made a mistake there. Also, try a different set of holes in the breadboard area. Try the identical layout, but shift everything upwards 3 rows. There might be something wrong with the breadboard.

Note that, if an I/O pin is not connected to anything, then its state (0 or 1) could be anything. That's why the circuit has a 10K resistor connected to Vss and the I/O pin. That forces the default I/O pin state to be zero.

sylvie369
01-28-2010, 01:24 AM
You could also check your circuit with a voltmeter. Unplug the end of the 220 ohm resistor from P3, and attach it to the positive lead of the voltmeter. Attach the other lead to ground (VSS).
You should get 0V when you're not pushing the button, and right around 5V when you are pushing it. If that's not happening, your wiring isn't right.

Thomas C.
01-28-2010, 09:35 AM
I think I figured out what the problem was - I might have the pushbutton in the wrong way. Should the writing above the pushbutton be facing the right of the board, or the VDD/VIN/VSS holes? When I had it facing the VDD/VINVSS, that's when INx always equaled 1. When I rotated it 90 degrees clockwise, it worked like it should.

sylvie369
01-28-2010, 12:30 PM
Been there, done that. I find those pushbuttons confusing, and I'm still doing them by trial and error.

I'm glad to hear it wasn't the Homework board.