Lecture#02 Arduino Uno — Circuitry Inside
Atmega328p Generic IO Port Operation
Published in
2 min readJul 3, 2018
For the first time ever you will understand the Arduino Circuitry.
After much research, a whole course of microcontrollers, here are our findings, based on The CSE P567 — Computer Science and Enginner of the University of Washington.
Lecture number two video: Arduino Pin Circuitry;
Or in Google Slides(w/context):
See also this well-attended article:
Video Transcription:
Arduino pin circuitry under the hood how does the input and output signals work: Each board pin consists of three register bits DDXn, PORTxn and PINxn.Here we will demonstrate an output signal to an LED and input signal
generated by the push of a button by the user; To set the PINx input
we must write 0 on DDRx register; clock it; flip-flop outputs low; value zero turn off the buffer; And now suppose the user presses the button; the signal travels across the bus... goes through synchronizer... until it reaches the data bus; you can read the direction by the buffer DDRx; you can read Pxn directed by PINregister or by the register itself; There you have it! the Pxn is now input; To set the Pxn to output we must write ONE on the DDRxn register; clocks it; flip-flop goes high; ONE forces the buffer to enable; And now suppose the user sends a logical 1, Clocks it; Now the signal travels across the bus through the buffer and light the LED connected to the pin (Pxn);
You can read the direction by the buffer DDRx; you can read Pxn directly by PINxn register or by the register itself;
And there you have it ! the pin is now output; Pin input port control pull-upsif what we want is to enable pull-up register...
First the mode must be input so DDRxn equal 0; clock it then you have 0 here and 1 here; then let's disable the PUD by writing 0 to it's register; this register is set by the hardware on Power On Reset; you have one here; and finally write logic 1 to PORTxn; Clocks it; and now you have ONE here ONE here; ZERO here; now pull up register are enabled;Congratulations!
There you have it!Here is the summary: if 0 then input is 1 then output; again if 0 it input and if one it output. There have it !Here is this source from the datasheet: http://ww1.microchip.com/downloads/en/DeviceDoc/ATmega328_P%20AVR%20MCU%20with%20picoPower%20Technology%20Data%20Sheet%2040001984A.pdfand here is the Washington University lecture
slides, page 46 49:https://courses.cs.washington.edu/courses/csep567/10wi/lectures/Lecture6.pdfThere you have it!Bye for now!
References & Credits