DOC PREVIEW
SJSU ME 106 - Microcontroller Fundamentals

This preview shows page 1-2-3-4-25-26-27-52-53-54-55 out of 55 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 55 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 55 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 55 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 55 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 55 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 55 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 55 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 55 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 55 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 55 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 55 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 55 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Microcontroller FundamentalsLearning ObjectivesMechatronics Concept MapWhat is a Microcontroller?ATmega328 Internal ArchitectureATmega328 FeaturesArduino DuemilanoveArduino Uno R3Arduino DueArduino Duemilanove/Uno FeaturesPowerPoint PresentationATmega328 MicrocontrollerAbsolute MaximumsMicrocontroller Ports and PinsPort Pin Data DirectionalityATmega328 Block DiagramM68HC11 microcontrollerSetting the Pin Data DirectionPin VoltagesPin Used as an OutputPins as Inputs and Pull-up Resistors - 1Pins as Inputs and Pull-up Resistors - 2Pins as Inputs and Pull-up Resistors - 3Pins as Inputs and Pull-up Resistors - 4Spartronics Experimenter ShieldHandling the Arduino - How NOT to Do It!Handling the Arduino - The Proper WaySpartronics Experimenter LED PinoutSpartronics Experimenter Digital Pin AssignmentsSpartronics Experimenter Analog Pin AssignmentsBinary and Hexadecimal Numbers - 1Binary and Hexadecimal Numbers - 2Binary and Hexadecimal Numbers - 3Binary and Hexadecimal Numbers - 4Using Hex ValuesPracticeSolutionSo What?Data Direction RegisterATmega328 Registers of InterestPORT Pin and register detailsExample 1Example 2Structure of an Arduino ProgramDigital IO – Practice 1Digital IO – Practice 1 SolutionSlide 47Digital IO – Practice 2Digital IO – Practice 2 PseudocodeDigital IO – Practice 2 (Arduino style code)Slide 51Digital IO – Practice 3 (Port style code)Slide 53SummarySummary, cont.Microcontroller FundamentalsB. Furman18SEP2014Learning ObjectivesExplain the general architecture of a microcontrollerList the key features of the ATmega328 microcontrollerExplain the features and elements of the Arduino and Spartronics Experimenter Shield (SES)Explain the concepts of microcontroller pins as inputs and outputsConvert between binary and hexadecimal digitsMechatronics Concept MapController(Hardware & Software)System toControlSensorSignalConditioningPowerInterfaceActuatorUserInterfacePowerSourceBJ Furman 22JAN11ME 106ME 154ME 157ME 195ME 120ME 297AME 106ME 120ME 106ME 190ME 187ME 110ME 136ME 154ME 157ME 182ME 189ME 195ME 106ME 120ME 106 INTEGRATIONWhat is a Microcontroller?http://www.freescale.com/files/microcontrollers/doc/ref_manual/M68HC05TB.pdfANALOGINPUTSWhat is the difference between a ‘Digital Input’ and an ‘Ana log Input’?ATmega328 Internal ArchitectureATmega328 data sheet pp. 2, 5http://www.adafruit.com/index.php?main_page=popup_image&pID=50ATmega328 FeaturesATmega328 data sheet p. 1http://www.atmel.com/Images/Atmel-8271-8-bit-AVR-Microcontroller-ATmega48A-48PA-88A-88PA-168A-168PA-328-328P_datasheet.pdfArduino Duemilanove http://www.arduino.cc/en/Main/ArduinoBoardDuemilanovehttp://arduino.cc/en/uploads/Main/ArduinoDuemilanove.jpgPin 13 LEDUSBconnectorBarrel jackDigital pins headerReset buttonATmega328 MCUAnalog pins headerPower-ground headerSee the handout: Arduino_ATmega328_pin_mapping_and_schematicArduino Uno R3http://www.adafruit.com/index.php?main_page=popup_image&pID=50ATmega16u2 replaces FT232RL for USB-serial communicationSee: http://learn.adafruit.com/arduino-tips-tricks-and-techniques/arduino-uno-faqArduino DueAtmel SAM3X8E processor (32 bit ARM Cortex M3 architecture, 84MHz)http://www.adafruit.com/index.php?main_page=popup_image&pID=1076See: http://arduino.cc/en/Main/ArduinoBoardDueNote: 3.3 V !!Arduino Duemilanove/Uno FeaturesMicrocontroller ATmega168/328Operating Voltage 5VInput Voltage (recommended) 7-12VInput Voltage (limits) 6-20VDigital I/O Pins 14 (of which 6 provide PWM output)Analog Input Pins 6DC Current per I/O Pin 40 mADC Current for 3.3V Pin 50 mAFlash Memory16 KB (ATmega168) or 32 KB (ATmega328) of which 2 KB used by bootloaderSRAM 1 KB (ATmega168) or 2 KB (ATmega328)EEPROM 512 bytes (ATmega168) or 1 KB (ATmega328)Clock Speed 16 MHzhttp://www.arduino.cc/en/Main/ArduinoBoardDuemilanovehttp://arduino.cc/en/uploads/Main/arduino-duemilanove-schematic.pdfATmega328 MicrocontrollerPin numberPin nameSpecial functionSource:http://www.atmel.com/dyn/products/product_card.asp?PN=ATmega328PNote the limitations!p. 316Absolute MaximumsATmega328 data sheet p. 316Microcontroller Ports and PinsThe communication channels through which information flows into or out of the microcontrollerEx. PORTBPins PB0 – PB7May not be contiguousOften bi-directionalCSee next slides!Port Pin Data DirectionalityInputWhen you want to take information from the external world (sensors) int o the MCUOutputWhen you want to change the state of something outside the MCU (turn a motor on or off, etc.)Pins default to input direction on power-up or resetYour program can set or change the directionality of a pin at any timeATmega328Block DiagramInputOutputM68HC11 microcontrollerSetting the Pin Data DirectionArduinopinMode(pin_no., dir)Ex. Make Arduino pin 3 (PD3) an outputpinMode(3, OUTPUT);pinMode(PIN_D3, OUTPUT); // with me106.hNote: one pin at a timeSuppose you wanted Arduino pins 3, 5, and 7 (PD3, PD5, and PD7) to be outputs?Is there a way to make them all outputs at the same time?Yes! Answer coming later…Pin VoltagesMicrocontrollers are fundamentally digital devices. For digital IO pins:Information is ‘coded’ in two discrete states:HIGH or LOW (logic: 1 or 0)VoltagesTTL5 V (for HIGH)0 V (for LOW)3.3 V CMOS3.3 V (for HIGH)0 V (for LOW)Pin Used as an OutputTurn on an LED, which is connected to pin Arduino pin 0 (PD0) (note the resistor!)What should the data direction be for pin 0 (PD0)?pinMode(____, ____);Turn on the LEDdigitalWrite(0,HIGH);Turn off the LEDdigitalWrite(0,LOW);ATmega328Arduinopin 0(PD0)Pins as Inputs and Pull-up Resistors - 1Using a switch as a sensorEx. Seat belt sensorDetect the switch stateWhat should the data direction be for Arduino pin 3 (PD3)?pinMode(____, ____);What will the voltage be on PD3 when the switch is closed?What will the voltage be on PD3 when the switch is open?Indeterminate!ATmega328Arduinopin 3(PD3)Pins as Inputs and Pull-up Resistors - 2Switch as a sensor, cont.Make the voltage on the pin determinate by turning on the pull-up resistor for PD3Assuming PD3 is an input:digitalWrite(3,HIGH); turns on the “pull-up” resistorpinMode(3,INPUT_PULLUP);What will the voltage on PD3 be when the switch is open?VTGWhat will the voltage on PD3 be when the switch is closed?ATmega328PD3VTG= +5V01Pins as Inputs and Pull-up Resistors - 3Switch as a sensor, cont.To turn off


View Full Document

SJSU ME 106 - Microcontroller Fundamentals

Download Microcontroller Fundamentals
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Microcontroller Fundamentals and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Microcontroller Fundamentals 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?