how to enable internal pull ups resistors ?

General discussion on mikroC PRO for AVR.
Post Reply
Author
Message
public2010
Posts: 94
Joined: 05 May 2009 18:31
Location: Somewhere in Europe

how to enable internal pull ups resistors ?

#1 Post by public2010 » 28 Apr 2020 18:44

I read the mikroC for AVR documentation and saw an example for the PIC MCU, but I can't figure out how I could do that with the mikroC for AVR. For example, in the case of an Atmega328 I would like to activate the pull-up resistors at the PD2 and PD3 pins and I don't know how to do that !! Please, can you give me an example code?

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: how to enable internal pull ups resistors ?

#2 Post by filip » 04 May 2020 07:31

Hi,

Please have a look at the ATmega328 datasheet (http://ww1.microchip.com/downloads/en/D ... asheet.pdf), section 13. :
If PORTxn is written logic one when the pin is configured as an input pin, the pull-up resistor is activated. To switch the
pull-up resistor off, PORTxn has to be written logic zero or the pin has to be configured as an output pin. The port pins are
tri-stated when reset condition becomes active, even if no clocks are running.
Regards,
Filip.

public2010
Posts: 94
Joined: 05 May 2009 18:31
Location: Somewhere in Europe

Re: how to enable internal pull ups resistors ?

#3 Post by public2010 » 17 May 2020 13:47

Thanks. I've seen this in the datasheet in the meantime.

Post Reply

Return to “mikroC PRO for AVR General”