I’m Google-d out. So, dear friends at StackOverflow, is it possible to change an IO pin on at Atmel family microprocessor (say an Atmel 165) from input to output, or from output to tristate, or from output to tristate to input and any or all of those in reverse?
Parallel question: Are there Atmel programmers/languages that do or don’t support the “tools” to switch the IO pins? If I were to search Google for related information, does this subject (changing pin directions) have a name that is more searchable than “change input pin to output pin” +Atmel?
Yes, you can change the pin configuration at any time. I’ve never heard of a language that didn’t let you switch the pin configuration.
Just follow the procedures outlined in the chip documentation for how to change the pin configuration. You basically just write a value to the corresponding data direction register for that port. See section 12.4 of the data sheet. In C, it’s usually as simple as
DDRC = 0;to set all port C pins to inputs.The data sheet goes over the capabilities of each port and how to get them in sections 12.4.2 through 12.4.22.