J
Jean Tabel
- Jan 1, 1970
- 0
Hi,
I am experimenting for the fist time with PB0 connected to a LED
and PB1 configured (?) as an input.
PB1 is directly connected to the GND, and I was assuming the LED
would stay on until I would connect it directly to VCC.
But I am executing outp (0x00, PORTB).
When this line is commented out, the LED stays on.
void main (void)
{
outp (0x01, DDRB); // PB0 output, PB1 input
outp (0x01, PORTB); // LED on PB0 set to on
for (; {
if (inp(PINB) & 0x02 != 0) {
// logical 1 in PB1 - setting LED on PB0 to off
outp (0x00, PORTB);
}
}
}
I tried to activate the pull-up internal resistor for PB1 by writing
0x03 into PORTB instread of 0x01, but this dis not change
anything.
Since I am basically a software guy, I must probably be missing
something very, very trivial.
Any clue anybody ?
Thanks in advance,
Jean Tabel
I am experimenting for the fist time with PB0 connected to a LED
and PB1 configured (?) as an input.
PB1 is directly connected to the GND, and I was assuming the LED
would stay on until I would connect it directly to VCC.
But I am executing outp (0x00, PORTB).
When this line is commented out, the LED stays on.
void main (void)
{
outp (0x01, DDRB); // PB0 output, PB1 input
outp (0x01, PORTB); // LED on PB0 set to on
for (; {
if (inp(PINB) & 0x02 != 0) {
// logical 1 in PB1 - setting LED on PB0 to off
outp (0x00, PORTB);
}
}
}
I tried to activate the pull-up internal resistor for PB1 by writing
0x03 into PORTB instread of 0x01, but this dis not change
anything.
Since I am basically a software guy, I must probably be missing
something very, very trivial.
Any clue anybody ?
Thanks in advance,
Jean Tabel