Forum > Embedded - AVR
What to change ModePortA, to enable internal pull-ups
pascalbythree:
Hello for AVR forum responders,
Does anybody know what to change about this code to open a port in output mode, but then to enable the internal pull-ups ?
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure ModePortA(Pin: byte; Value: Boolean); begin if Value then begin DDRA := DDRA or (1 shl pin); end else begin DDRA := DDRA and not (1 shl pin); end; end;
let say like this attachment, but then in Freepascal Syntax
Using FPC on the attiny26
Thank you and greets Wouter van Wegen
pascalbythree:
Check this out:
https://www.avrfreaks.net/s/topic/a5C3l000000LqTsEAK/t193570
pascalbythree:
Jay ! Jay !Jay ! Jay !Jay ! Jay !Jay ! Jay !Jay ! Jay !Jay ! Jay !Jay ! Jay !Jay ! Jay !Jay ! Jay !Jay ! Jay !Jay ! Jay !Jay ! Jay !Jay ! Jay !Jay ! Jay !Jay ! Jay !Jay ! Jay !Jay ! Jay !Jay ! Jay !Jay ! Jay !Jay ! Jay !Jay ! Jay !Jay ! Jay !Jay ! Jay !Jay ! Jay !Jay ! Jay !Jay ! Jay !Jay ! Jay !Jay ! Jay !Jay ! Jay !Jay ! Jay !Jay ! Jay !Jay ! Jay !Jay ! Jay !Jay ! Jay !Jay ! Jay !Jay ! Jay !Jay ! Jay !Jay ! Jay !Jay ! Jay !Jay ! Jay !Jay ! Jay !Jay ! Jay !Jay ! Jay !Jay ! Jay !Jay ! Jay !Jay ! Jay !Jay ! Jay !Jay ! Jay !Jay ! Jay !Jay ! Jay !
It got to work!:
DDRB := 0;
PORTB := 255;
DDRA := 0;
PORTA := 255;
Thank you for your time.
Incase problems i will be back soon !
ccrause:
For the basics of I/O access on AVR also see https://wiki.lazarus.freepascal.org/AVR_Embedded_Tutorial_-_Simple_GPIO_on_and_off_output
pascalbythree:
Does anybody know how to enable internal pull-up resistors pin by pin ? 8-)
Check:
https://microchipdeveloper.com/8avr:ioports
I need to set PORTB3 and PORTB6 as input mode with internal pull ups enabled.
I need to set PORTA0 and PORTA1 and PORTA2 and PORTA3 as output mode with internal pull ups enabled.
I need to set PORTA7 and PORTA6 and PORTA5 and PORTA4 as output mode with internal pull ups disabled.
second question:
How to write 0xFF in FPC-AVR source code, so it compiles ? Do i need a character on the left ?
Greets, PascalByThree
Navigation
[0] Message Index
[#] Next page