Enabling internal pull-ups on AVR's

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

Post Reply
organetic
Posts: 7
Joined: Tue Jul 29, 2014 6:45 pm
Has thanked: 1 time
Contact:

Enabling internal pull-ups on AVR's

Post 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!

User avatar
STibor
Posts: 263
Joined: Fri Dec 16, 2011 3:20 pm
Has thanked: 116 times
Been thanked: 113 times
Contact:

Re: Enabling internal pull-ups on AVR's

Post 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.

organetic
Posts: 7
Joined: Tue Jul 29, 2014 6:45 pm
Has thanked: 1 time
Contact:

Re: Enabling internal pull-ups on AVR's

Post 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!

Kenrix2
Flowcode v5 User
Posts: 211
Joined: Tue Feb 19, 2013 9:51 pm
Has thanked: 72 times
Been thanked: 177 times
Contact:

Re: Enabling internal pull-ups on AVR's

Post 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.
Attachments
pullup_resistors.fcfx
(4.36 KiB) Downloaded 493 times

User avatar
STibor
Posts: 263
Joined: Fri Dec 16, 2011 3:20 pm
Has thanked: 116 times
Been thanked: 113 times
Contact:

Re: Enabling internal pull-ups on AVR's

Post by STibor »

This is how I did it.
Attachments
inter_pull_up_3.fcfx
(4.92 KiB) Downloaded 562 times

Post Reply