Page 1 of 1

Enabling internal pull-ups on AVR's

Posted: Wed Jul 30, 2014 5:13 pm
by organetic
Can someone tell me how to enable the internal pull up resistors in ATmega328p chips?

I'm trying to avoid C at the moment... any way to do that graphically?

Cheers!

Re: Enabling internal pull-ups on AVR's

Posted: Wed Jul 30, 2014 7:04 pm
by STibor
Write down the following C code.

Code: Select all

PORTB = (1<<PB7)|(1<<PB6)|(1<<PB5)|(1<<PB4)|(1<<PB3)|(1<<PB2)|(1<<PB1)|(1<<PB0);
(All B port pull up)
And input flowchart pull-up into the port bits.

Re: Enabling internal pull-ups on AVR's

Posted: Thu Jul 31, 2014 12:16 am
by organetic
Thx for your fast reply STibor.

I wrote down the code and I've inserted it at the beginning of the flowchart, after the "BEGIN" flowchart icon.

I just don't understand what you mean by "input flowchart pull-up into the port bits."

Do you mean to simply use inputs as normal by defining a single bit from port B?

Cheers!

Re: Enabling internal pull-ups on AVR's

Posted: Thu Jul 31, 2014 9:01 pm
by Kenrix2
If you need to program the registers in a micro, which is required to do what you need, without using the 'Insert C Code' icon you could try this method. Define a Flowcode variable in Supplementary Code... to be the register you need to use and then add that variable to the Project explorer. You can then perform calculations on that register just like you would any other variable.
More information is here: http://www.matrixtsl.com/mmforums/viewt ... 26&t=14096
I wrote a simple example for that chip using this method however, I have never used an ATMEGA micro so I can't test it or even check to see if it compiles. Hopefully it will work.

Re: Enabling internal pull-ups on AVR's

Posted: Fri Aug 01, 2014 3:58 pm
by STibor
This is how I did it.