DOC PREVIEW
PSU EE 200 - L8_EE200_s14

This preview shows page 1-2-3-4-5-6-7-8-57-58-59-60-61-62-63-64-115-116-117-118-119-120-121-122 out of 122 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 122 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 122 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 122 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 122 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 122 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 122 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 122 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 122 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 122 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 122 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 122 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 122 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 122 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 122 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 122 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 122 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 122 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 122 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 122 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 122 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 122 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 122 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 122 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 122 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 122 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

ColorGrayscaleEE 200 Spring 2014Lecture 8.EE 200Design ToolsLecture 8Professor Jeffrey SchianoDepartment of Electrical Engineering1EE 200 Spring 2014Lecture 8.Lecture 8 Topics• Announcements• Microcontrollers– Digital I/O ports: Review and Further Details– Realization of a FSM in C– Polling and Interrupts– Peripheral Pin Select• Laboratory Topics– Required circuits 2EE 200 Spring 2014Lecture 8.Announcements• Problem Set 8– Problem 29 circuit required for Laboratory 15– Problem 30 circuit required for Laboratory 16• Midterm Exam– Date: Thursday March 20– Location: 112 Kern– Time 8:15 pm – 10:15 pm• Midterm Review Session– Date: Monday March 17– Location: 22 Deike– Time: 8:15 pm3EE 200 Spring 2014Lecture 8.Midterm Exam Topics1. Finite State Machine Analysis – Moore Machines– State Diagrams and Tables– Karnaugh Maps2. Finite State Machine Synthesis– Discrete Logic– CPLD using HDL– LabVIEW43. Sinusoidal Steady-State Analysis– Frequency Response4. Multisim– SPICE Models5. PCB Realization6. LabVIEW ProgrammingEE 200 Spring 2014Lecture 8.Midterm Exam Topics• Lectures: 1 through 7• Labs: 1 through 15• Problem Sets: 1 through 8 • The Midterm Exam does not cover material on the microcontroller or LCD module• Review past midterm exams on the EE 200 web page5EE 200 Spring 2014Lecture 8.Digital I/O Ports: Review6• Two Digital Input/Output ports: PORTx, x = A or B• PORTA provides 5 I/O lines: RA0 through RA4• PORTB provides 16 I/O lines: RB0 through RB15• Input: 3.3V CMOS • Output: 3.3V CMOS or open-drain– Open drain allows VDD up to 5V on 5V tolerant pinsEE 200 Spring 2014Lecture 8.Digital I/O Ports: Pin Locations7AN0/OA2OUT/RA0AN1/C2IN1+/RA1MCLRPGED3/VREF-/AN2/C2IN1-/SS1/RPI32/CTED2/RB0PGEC3/VREF+/AN3/OA1OUT/RPI33/CTED1/RB1PGEC1/AN4/C1IN1+/RPI34/RB2PGED1/AN5/C1IN1-/RP35/RB3VSSOSC1/CLKI/RA2OSC2/CLKO/RA3FLT32/RP36/RB4CVREF20/RP20/T1CK/RA4VDDPGED2/ASDA2/RP37/RB5AVDDAVSSRPI47/PWM1L/T5CK/RB15RPI46/PWM1H/T3CK/RB14RPI45/PWM2L/CTPLS/RB13RPI44/PWM2H/RB12TDI/RP43/PWM3L/RB11TDO/RP42/PWM3H/RB10VCAPVSSTMS/ASDA1/SDI1/RP41/RB9TCK/CVREF10/ASCL1/SDO1/RP40/T4CK/RB8SCK1/RP39/INT0/RB7PGEC2/ASCL2/RP38/RB6 Pins are up to 5V tolerant12345678910111213142827262524232221201918171615dsPIC33EP64MC502-I/SPEE 200 Spring 2014Lecture 8.Digital I/O Ports: Block Diagram8EE 200 Spring 2014Lecture 8.I/O Port Control Registers9• ANSELx: Analog Select Control Register• TRISx: Data Direction Register• PORTx: I/O Port register• LATx: I/O Latch register• ODCx: Open-Drain Control RegisterEE 200 Spring 2014Lecture 8.ANSELx Registers10• Some ports are shared with analog module pins• The corresponding bits in the ANSELx registers, if present, must be set to ‘0’ for digital I/O port functionality• Default value (after reset) is ‘1’ for anlog input/outputEE 200 Spring 2014Lecture 8.TRISx Registers11• Determines whether each pin associated with the I/O port is a digital input or an output• If the TRIS bit for an I/O pin is a ‘1’, then the pin is an input– ‘1’ looks like an I (input)• If the TRIS bit for an I/O pin is a ‘0’, then the pin is configured as an output– ‘0’ looks like an O (output)• Default value (after reset) is ‘1’ for inputEE 200 Spring 2014Lecture 8.PORTx Registers12• A write to the PORTx register writes the value to the port data latch• A read of the PORTx register reads the value of the I/O pinEE 200 Spring 2014Lecture 8.LATx Registers13• A write to the LATx register has the same effect as a write to the PORTx register• A read of the LATx register returns the values that held in the port output latches instead of the values on the I/O pinsEE 200 Spring 2014Lecture 8.ODCx Control Register• The ODCx register determines whether a pin is configured for a totem pole or open-drain output• Setting a ODCx bit configures the corresponding pin to act as an open-drain output• The default value is 0x0000; pins configured for totem pole output• The open-drain feature allows the generation of outputs higher than VDD (for example, 5V) on any desired 5V tolerant pins by using external pull-up resistors14EE 200 Spring 2014Lecture 8.Totem Pole Versus Open-Drain Output15Totem Pole Output Open-Drain OutputEE 200 Spring 2014Lecture 8.Data Input and Output:TRIS, PORT and LAT Registers16EE 200 Spring 2014Lecture 8.Digital I/O Programming Steps171. If DIO pin is shared with an analog peripheral, clear the corresponding ANSELx bit2. Configure data direction by setting TRISx3. For digital output, select totem pole (default) or open-drain output by setting ODCx4. Write to the peripheral pin by writing to either LATx or PORTx pins configured for digital output5. Read the logic-level of a peripheral pin using PORTx6. Read the logic-level of the latch using LATxEE 200 Spring 2014Lecture 8.Realization of a FSM in C• Use nested switch statements within a while–loop– Directly analogous to LabVIEW which uses nested case structures within a while-loop structure• Outer-level switches on the current state• Inner-level switches on the input18EE 200 Spring 2014Lecture 8.Switch Statement Syntax19• The break statement terminates execution • Without break, the program continues to the next case• The default statement is executed if no case constant-expression is equal to the value of switch ( expression )• Similar to LabVIEW Case Structuresint x;switch(x) {case 1: { statements } break;case 2: { statements } break;default: { statements } break;}EE 200 Spring 2014Lecture 8.Enumerated Type• LabVIEW programmers typically use an enumerated type to define states• Similarly, C programmers often use an enumerated type (enum) to define states• An enum type defines a list of aliases represented by incrementing integers staring with zero20EE 200 Spring 2014Lecture 8.enum Example• Use an enum type called STATE to alias S0 and S1 to the integers 0 and 1, respectively21enum STATE {S0, S1}; // defines an enumeration typeenum STATE state = S0; // declare a variable state of the // type enum STATE, and // assign the value S0 from the set // STATE to the variable state// code example using the variable state switch (state) {case S0: state = S1; break; case S1: state = S0; break;}EE 200 Spring 2014Lecture 8.typedef• typedef is a keyword in the C programming language• typdefs allows the programmer to form complex types from


View Full Document

PSU EE 200 - L8_EE200_s14

Download L8_EE200_s14
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 L8_EE200_s14 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 L8_EE200_s14 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?