Skip to content

Analog to Digital Conversion: How to disable digital input buffer? #92

Answered by SpenceKonde
btribley asked this question in Q&A
Discussion options

You must be logged in to vote

It's done via PORTx.PINnCTRL register. - but the point of doing that is to reduce unnecessary power consumption on pins doing analog stuff or which are not in use and are floating (floating pins drain a huge amount of power in sleep mode on the modern AVRs. I swear it was never this bad on the classic AVRs. - but if you're trying to save power you do what you gotta do.)

To write registers.... you just write to them, like they were a variable:

// If I know that nothing was configured on PIN_PD0 and wanted tojust disable it:
PORTD.PIN0CTRL= PORT_ISC_INPUT_DISABLE_gc;;
// that assumes that nothing else is set on that register, or if it is, that we want to unset it. A more cautious approach w…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by btribley
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants