Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] ATTiny13 bit_is_clear when resistor is not connected on the other end

Status
Not open for further replies.

strongdrink

Junior Member level 2
Joined
Sep 27, 2011
Messages
23
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Activity points
1,434
Hello all,

I am fooling around with the ATTiny13 inputs. My circuit basically consists of an LED attached to PB3, and a button+resistor coming from VCC to PB1.

My code uses "bit_is_clear(PINB, PB1);" to basically turn the LED on/off depending on the state on PB1.

Here is the problem.. when I have the resistor in (without the button being pushed) the LED goes high. If I take the resistor out, it goes low. This is where it gets weird... if I put ONE end of the resistor attached to PB1, and leave the other end sticking up in the air, the LED goes high.

Thanks for any help
 

I'm not sure of the exact configuration you have used but AVRs have pull up resistors in the input that you can enable so all you need is to enable this internal pull-up resistor in the input pin to keep the input at a high level as default and then connect the button from the input to the gnd so that it grounds the input when pressed, thats it , there is no need for any other resistor and no random input states either.

Alex
 

Do you know how one would accomplish that in C? Most of the tutorials are in asm :-/
 


Ok, I finally had time to work on this project again, and the internal pull-res's didn't work so well.. After adding external pull-down/up res's it works great now though, thanks
 

According to the datasheet the internal pullup has a value of 20K (min) to 50K (max).
It is very strange that the internal pullup can't work correctly with a button connected to the input.

Alex
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top