lecture7

lecture7 - Foundations of Embedded Systems A Term Spring...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Foundations of Embedded Systems A Term Spring 2008 Lecture #7: Making it work: The Keypad Reading for Today: Keypad datasheet, MSP430x4xx User Guide Ch 9 Reading for Next Class: Review all reading, notes, User's Guide Ch 1,3.1-3.2,9 Lab #0: Due Now Lab #1 (on Web) : Due next Tuesday 9/16/2008 in class HW #2 (on Web): Due THURSDAY 9/11/2008 EXAM #1 – This Friday 9/12/2008! Last class : More on configuring and reading from and writing to the digital IO ports on the MSP430F449. -->Using bitwise operations for configure the digital IO ports. MSP430F449 Basic Digital I/O >> Six independent, individually configurable, 8-bit wide digital I/O ports >> Each pin of each port can be configured individually as an input or an output >> Each pin of each port can be individually read or written to Function Select Register : Sets function of each pin in the port (i.e. P4SEL)-- Bit = 0 = Selected for Digital I/O -- Bit = 1 = Not selected for digital I/O (multiplexed pin functions) Direction Registe r: Sets direction of each pin in the port (i.e. P2DIR)-- Bit = 0 = Corresponding pin is an Input -- Bit = 1 = Corresponding pin is an Output Input Register : Where input to the port is read from (i.e. P2IN)-- Bit = 0 = Logic low-- Bit = 1 = Logic high Output Register : Where data to be output from the port is written ( P5OUT)-- Bit = 0 = Logic low-- Bit = 1 = Logic high >> All I/O port registers are memory mapped – Read and write to the registers names (defined msp430x44x.h) as if they were C variables! Using pre-defined constants to avoid “magic numbers” >> In C, there is always multiple ways to implement the same functionality >> Some ways are accepted as representing better coding style Try to avoid “ → magic numbers ” = fixed hard-coded numbers that appear in code without explanation of their meaning or purpose >> These values are pre-defined in the msp430x44x.h header file ... we can just use 'em!>> These values are pre-defined in the msp430x44x....
View Full Document

This note was uploaded on 10/27/2008 for the course ECE 2801 taught by Professor Jarvis during the Fall '08 term at WPI.

Page1 / 10

lecture7 - Foundations of Embedded Systems A Term Spring...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online