Session S2F Learning and Practicing Fundamentals of...

6
Session S2F 978-1-4244-6262-9/10/$26.00 ©2010 IEEE October 27 - 30, 2010, Washington, DC 40 th ASEE/IEEE Frontiers in Education Conference S2F-1 Learning and Practicing Fundamentals of Electrical and Computer Engineering through Building and Programming a Microcontroller with Multiple Peripherals Jianjian Song, Xiaoyan Mu, Huihui Xu and Mark Yoder Rose-Hulman Institute of Technology, [email protected], [email protected], [email protected], [email protected] Abstract - A required sophomore course on microcontrollers and computer architecture was designed and offered for the first time in 2009 to expose our electrical engineering (EE) sophomore students to microcontroller-based applications so that they could appreciate and be exposed to fundamentals of electrical and computer engineering (ECE) through hardware and software design and interfacing. The course also helps students to obtain a broad view of various subjects of ECE from circuits, signals, digital logic, microcontrollers, C and assembly language programming to system design, implementation and measurement so that they can make a well informed decision on whether to continue to major in EE. The course builds a foundation for future classes that may require instrumentation or microcontroller-based applications such as those on communications, control, power electronics as well as junior and senior design courses. In addition, the students are required to purchase most of the hardware components for the course so that they can use the components for future projects. Index Terms – microcontroller, computer architecture, sophomore, C programming language, assembly language. I. INTRODUCTION A sophomore course on microcontrollers and computer architecture was designed and offered for the first time in 2009 to provide an opportunity for students to learn and practice fundamentals of ECE. The course helps students to appreciate fundamentals of ECE through hardware and software design and interfacing and to obtain a broad view of various subjects of ECE from circuits, signals, digital logic, microcontrollers, C and assembly language programming to system design, implementation and measurement. Throughout the course, Students will be exposed to and be engaged in real-world problem solving while working on design-oriented laboratory exercises that help the students to not only learn technical knowledge and skills but also see how relevant electrical and computer engineering is to their daily lives and how real-world problem-solving can be challenging and rewarding. Design philosophy of the course is based on the latest research into effective ECE education that advocates a freshman or sophomore focus on real-world design, active learning, electronics, computer engineering and science. Three main advantages of this early introduction to ECE have been discussed and evaluated in the literature: (1) increasing retention; (2) revamping ECE education; (3) redefining fundamentals. Experience and research from the literature indicate that early introduction to real-world problems will help retention and will improve performance on later courses [1]. Electronics, systems/information processing and computer science have been suggested to be the three central topics of ECE [2]. A number of universities have attempted to redefine fundamentals of electrical engineering and have accumulated rich experience in their practice [3]-[8]. This paper introduces the course rationale, content, structure, and our early experience. Evaluation of the effectiveness of this course on student learning and retention as well as on its usefulness to later ECE courses will be carried out and reported in the future. I.1 Fundamentals of Electrical and Computer Engineering A number of researchers have attempted to redefine fundamentals of electrical and computer engineering (ECE). Their main ideas and beliefs can be found in their new freshman and sophomore introduction to ECE classes. Extensive research results have been reported in two redefined ECE fundamentals: (1) information sensing, processing and transmission, and (2) Signals and Computers. The new approaches have a number of common characteristics. They all emphasize on the top down approach, synthesis and design, system integration, and generally speaking, what and how to make a product or a system. Traditional approaches to introducing fundamentals follow the bottom up approach, extensive analysis, component-level designs to answer the why question.

Transcript of Session S2F Learning and Practicing Fundamentals of...

Page 1: Session S2F Learning and Practicing Fundamentals of ...archive.fie-conference.org/fie2010/papers/1036.pdf · course so that they can use the components for future projects. Index

Session S2F

978-1-4244-6262-9/10/$26.00 ©2010 IEEE October 27 - 30, 2010, Washington, DC 40th ASEE/IEEE Frontiers in Education Conference S2F-1

Learning and Practicing Fundamentals of Electrical and Computer Engineering through Building and

Programming a Microcontroller with Multiple Peripherals

Jianjian Song, Xiaoyan Mu, Huihui Xu and Mark Yoder

Rose-Hulman Institute of Technology, [email protected], [email protected], [email protected], [email protected]

Abstract - A required sophomore course on microcontrollers and computer architecture was designed and offered for the first time in 2009 to expose our electrical engineering (EE) sophomore students to microcontroller-based applications so that they could appreciate and be exposed to fundamentals of electrical and computer engineering (ECE) through hardware and software design and interfacing. The course also helps students to obtain a broad view of various subjects of ECE from circuits, signals, digital logic, microcontrollers, C and assembly language programming to system design, implementation and measurement so that they can make a well informed decision on whether to continue to major in EE. The course builds a foundation for future classes that may require instrumentation or microcontroller-based applications such as those on communications, control, power electronics as well as junior and senior design courses. In addition, the students are required to purchase most of the hardware components for the course so that they can use the components for future projects. Index Terms – microcontroller, computer architecture, sophomore, C programming language, assembly language.

I. INTRODUCTION

A sophomore course on microcontrollers and computer architecture was designed and offered for the first time in 2009 to provide an opportunity for students to learn and practice fundamentals of ECE. The course helps students to appreciate fundamentals of ECE through hardware and software design and interfacing and to obtain a broad view of various subjects of ECE from circuits, signals, digital logic, microcontrollers, C and assembly language programming to system design, implementation and measurement.

Throughout the course, Students will be exposed to and be engaged in real-world problem solving while working on design-oriented laboratory exercises that help the students to not only learn technical knowledge and skills but also see how relevant electrical and computer engineering is to their

daily lives and how real-world problem-solving can be challenging and rewarding.

Design philosophy of the course is based on the latest research into effective ECE education that advocates a freshman or sophomore focus on real-world design, active learning, electronics, computer engineering and science. Three main advantages of this early introduction to ECE have been discussed and evaluated in the literature: (1) increasing retention; (2) revamping ECE education; (3) redefining fundamentals. Experience and research from the literature indicate that early introduction to real-world problems will help retention and will improve performance on later courses [1]. Electronics, systems/information processing and computer science have been suggested to be the three central topics of ECE [2]. A number of universities have attempted to redefine fundamentals of electrical engineering and have accumulated rich experience in their practice [3]-[8].

This paper introduces the course rationale, content, structure, and our early experience. Evaluation of the effectiveness of this course on student learning and retention as well as on its usefulness to later ECE courses will be carried out and reported in the future.

I.1 Fundamentals of Electrical and Computer Engineering

A number of researchers have attempted to redefine fundamentals of electrical and computer engineering (ECE). Their main ideas and beliefs can be found in their new freshman and sophomore introduction to ECE classes. Extensive research results have been reported in two redefined ECE fundamentals: (1) information sensing, processing and transmission, and (2) Signals and Computers. The new approaches have a number of common characteristics. They all emphasize on the top down approach, synthesis and design, system integration, and generally speaking, what and how to make a product or a system. Traditional approaches to introducing fundamentals follow the bottom up approach, extensive analysis, component-level designs to answer the why question.

Page 2: Session S2F Learning and Practicing Fundamentals of ...archive.fie-conference.org/fie2010/papers/1036.pdf · course so that they can use the components for future projects. Index

Session S2F

978-1-4244-6262-9/10/$26.00 ©2010 IEEE October 27 - 30, 2010, Washington, DC 40th ASEE/IEEE Frontiers in Education Conference S2F-2

Fundamentals of electrical and computer engineering are defined as knowledge of “how to interface with the physical world, how to transmit energy and information and how to extract and interpret and analyze information” in [3]. Correspondingly, the authors have designed and taught a freshman course entitled Fundamentals of Electrical and Computer Engineering that covers the above mentioned fundamentals. Furthermore, the topics are introduced through integrating sensing and information processing. Integrated Sensing and Information Processing (ISIP) theme-based structure enables coherent, lateral and vertically integrated connections between each course. These connections provide immediate relevance to what students are learning, increasing their interest and engagement. The laboratory exercises of the course in [3] indicate that the course is an introduction to embedded systems.

Electronics, systems/information processing and computer science are proposed as the three central topics of ECE in [2]. Following the thought, Digital signal processing (DSP) or signals and systems are introduced as fundamentals at sophomore level [5], [6]. Signals are not treated as electrical ones but abstractions from real world problems.

As electrical and computer engineering becomes more and more complex and branches out into many fields of applications and sciences, many component level study and research will be done at graduate schools. Undergraduate education for ECE may need to focus on designing digital and programmable systems that are composed of electronics, sensors, and information processing and storage software [2]. This realization may have a great impact on the future of undergraduate ECE education.

Our effort in designing and implementing this sophomore-level course follows the above-mentioned philosophy of evolution in undergraduate education of electrical and computer engineering to emphasize on system-level design and system integration.

I.2 The Course Summary

The course description is given in Table 1. The course covers hardware, software and theory as pertinent to microcontroller-based design. Hardware aspect of the class includes power supply; input and output devices; communications between integrated circuit chips and between systems and sensors; measurement and test with voltmeter, ohmmeter, function generator and oscilloscope; integration of circuit components through a microcontroller; and soldering circuit components on a printed circuit board. Software aspect of the class involves programming in C and assembly language. The theoretical aspect includes circuit theory, signals, real time control, digital logic design, computer system architecture, instruction set architecture, and digital data presentations and storage.

TABLE 1 DESCRIPTION OF THE COURSE.

Computer architecture. Data representation and storage. Memory management. The C programming language and its application. Microcontroller architecture, instruction set, programmer’s model, hardware modules, and assembly language programming. Input and output devices. Sensors and actuators. Real-time event measurement and generation. Interrupt generation and processing. Development of embedded systems.

The course starts with a bare printed circuit board, as seen in Figure 1, with just a microcontroller chip, its power supply and a serial port. Figure 1 shows the bare board at the beginning of the quarter and the finished board at the end of the quarter. Each student is required to solder circuit components onto the board. After each component has been soldered and tested, the student will write microcontroller software to interface the component with the microcontroller and to integrate it into a whole system. The student will work on circuit construction and measurement, microcontroller programming in C and system integration weekly and will finally integrate all pieces to form a multi-functional device. One example of such devices is a multi-function device of alarm clock, stopwatch, voltmeter and thermometer with an LCD display.

II. A SOPHOMORE COURSE ON MICROCONTROLLERS AND COMPUTER ARCHITECTURE

Table 2 shows the weekly topics of the course for ten weeks as our school follows the quarter schedule.

Specifically, this class introduces students to soldering discrete circuit components on a printed circuit board, user interface design and implementation, real time signal generation and hardware and software, system integration and sensors. Through the course, Students will be exposed to and be engaged in real-world problems while working on design-oriented laboratory exercises, which are created to make students not only learn technical knowledge and skills but also see how relevant electrical and computer engineering is to their daily lives and how problem-solving is challenging and rewarding.

Page 3: Session S2F Learning and Practicing Fundamentals of ...archive.fie-conference.org/fie2010/papers/1036.pdf · course so that they can use the components for future projects. Index

Session S2F

978-1-4244-6262-9/10/$26.00 ©2010 IEEE October 27 - 30, 2010, Washington, DC 40th ASEE/IEEE Frontiers in Education Conference S2F-3

FIGURE 1

A BARE PIC-P40-28 BOARD FROM MICROCONTROLLER PROS CORP VS. THE FINISHED BOARD.

TABLE 2

WEEKLY SCHEDULE OF THE CLASS

Week Topics Labs Soldering 1 2 3 4 5 6

C structures, statements, push-buttons and LEDs Analog to digital conversion; Keypad scanning PICkit2 programmer and in circuit debugging State machine programming RS232 Serial port and

MPLAB and PIC-P40-28 board introduction pushbuttons and LED bar-graph display patterns measure waveforms with an oscilloscope pushbuttons and LED bar-graph display patterns measure waveforms with an oscilloscope Keypad debouncing and LED code Making a breadboard circuit with PIC16F887 Two channel voltage meter with serial port

One LED, 6-pin connector for PICkit 2 Three push-buttons, 8 micro LEDs, 8 10kΩ SIP resistor bank, 8 pin single row pin header Three push-buttons, 8 micro LEDs, 8 10kΩ SIP resistor bank, 8 pin single row pin header

7 8 9 10

transceiver Timer0 and Interrupts LCD interface, real-time clock I2C, thermal sensor

A clock with LCD Multi-purpose device project Project Project

LCD connector and wires I2C thermo sensor Alarm buzzer or LED

II.1 The PIC-P40-28 Board, Component Soldering and Measurement

The microcontroller used in the class is PIC16F887 from Microchip Incorporation and the printed circuit board is PIC-P40-28 from Microcontroller Pros Corporation [9]. Hardware modules on the microcontroller introduced in the class are Timers, Analog to Digital Converter, RS232 Serial Port Module and I2C Interface Module. Circuit components are push-button switches, LEDs, potentiometers, a 4x4 keypad, a LCD, RS232, I2C thermometer, various resistors and pin connectors, etc. Instruments are voltmeter, ohmmeter, soldering stations, function generator, and oscilloscope.

Various electronic components are included in the lab experiments. Here are some of them: push-button switches, LEDs, potentiometers, a 4x4 keypad, an LCD, an RS232 transceiver, an I2C thermometer, various resistors and pin connectors., etc.

Voltmeters, ohmmeters, soldering stations, function generator, and oscilloscope are used.

II.2 Computer Architecture and Software Topics

The class covers the following software topics: delay loops, real time signal generation, state machines, switch debouncing, interrupt generation and services, subroutines, data types, I/O port configuration, analog to digital conversion and timer configuration.

The class starts with learning to write programs in the C programming language for the first seven weeks of the ten week class. PIC16 assembly language programming is introduced as a tool to introduce computer architecture such as the central processing unit, memory structures and types, memory management, etc.

III. APPLICATIONS

The following applications are implemented typically in a ten week quarter.

Page 4: Session S2F Learning and Practicing Fundamentals of ...archive.fie-conference.org/fie2010/papers/1036.pdf · course so that they can use the components for future projects. Index

Session S2F

978-1-4244-6262-9/10/$26.00 ©2010 IEEE October 27 - 30, 2010, Washington, DC 40th ASEE/IEEE Frontiers in Education Conference S2F-4

III.1 Pushbutton Detection and LED Bargraph Display (Figure 2)

The objective of this lab is to program the PIC-P40-28 to search for key depression of one of the three keys and display the corresponding patterns on an LED bar-graph display. When a key is pressed, its corresponding sequence of patterns should be seen on the LEDs, one pattern being shown every 300ms.

Through this lab, students will learn how to use PICkit 2 programmer for in-circuit debugging; how to test a pushbutton circuit and an LED circuit; how to create a table in flash memory and how to implement a table lookup. They will also learn how to check if a push button is depressed with a voltmeter and how to interface a bar-graph LED display.

A switch debouncing delay loop is designed and the delay time needs to be simulated with MPLAB SIM and measured on an oscilloscope.

III.2 Two-Channel Voltmeter with an LED Bargraph Display (Figure 3)

The objective of this lab is to program the PIC-P40-28 to interface with two potentiometers and display a voltage on an LED bar-graph display. When a potentiometer is selected, its voltage should be seen on the LEDs as a bargraph.

This lab teaches students how to solder and use a potentiometer; how to configure the analogue to digital (ATD) module of PIC16F887 to select a channel and get the analogue voltage from the channel; and how to display the voltage as a bar-graph on an 8-LED display.

III.3 An LCD Clock on a Breadboard (Figure 4)

The objective of this lab is to build a PIC16F887 based LCD clock on a breadboard. This breadboard circuit is a complete system with a 7805 voltage regulator, a 6-pin interface to a PICkit 2 programmer, a character LCD display and push button switches to adjust the time on the clock. The students will need to measure the voltage output of the 7805 regulator with a voltmeter and check connectivity of jumper wires with an ohmmeter.

This is the first complete circuit on a breadboard that most students have ever built. As a matter of fact, this is the first time for the majority of the students to work with a breadboard.

III.4 4x4 Keypad Scan

The objective of this lab is to program the PIC-P40-28 to interface with a 4x4 keypad and display the key numbers from 1 to 16 on an LED bar-graph display. When a key is pressed, its corresponding number should be seen on the LEDs as a binary coded decimal (BCD) number.

Keypads from various manufacturers may not have the same pinout maps. The students will need to use an ohmmeter to find out how the pins are connected to the rows and columns of a keypad.

The keypad is scanning 16 times to see if one of the 16 keys has been depressed. The students will need to design a pattern search strategy to look for a depressed key. They will also need to implement a switch debouncing strategy.

III.5 Two-Channel Voltmeter with RS232 Serial Port Display on a Computer

The lab introduces students to the serial communication port on the PC that follows RS232 protocol. Most new laptops do not have a RS232 serial port and therefore a USB-to-RS232 adaptor needs to be used to connect the PIC board to a serial port terminal such as HyperTerminal on a PC.

The students will learn how to interface with a RS232 port through register configurations, how to set up a RS232 terminal such as Hyper Terminal on a PC and how to implement a two-channel voltmeter with a RS232 terminal to display an analogue voltage on a PC display.

III.6 A Real-Time Clock with an LCD Display (Figure 5)

This lab is to create a real-time clock that has buttons to set second, minute and hour and display on a 2X16 character LCD with the Hitachi interface. The second line of the 2-line LCD is to scroll lines of one favorite prose of the choice of the student.

A 14-pin female connector will need to be soldered on the PIC-P40-28 board so that the 2x16 LCD can be wired to the PIC chip.

Interrupt driven subroutines will need to be written to generate the real time clock as well as to scroll the prose.

III.7 A Multi-Purpose Device of Alarm Clock, Stopwatch, Voltmeter and Thermometer (Figure 6)

Figure 6 shows the hardware for the finale project for this 10-week course: a four-device multi-purpose instrument. This multipurpose device has one real-time clock with alarm, one thermometer, one stopwatch and one two-channel voltmeter.

An I2C interface thermo meter needs to be connected to the board through a 2x5-pin female connector and two pull up resistors. The thermo sensor is TC74 from Microchip.

This final term project uses a number of interrupts to generate a clock, a stopwatch, an alarm as well as measuring the voltages on two potentiometers.

Students will learn system integration with multiple sensors and displays as well as the state machine programming style to deal with multiple tasks.

Page 5: Session S2F Learning and Practicing Fundamentals of ...archive.fie-conference.org/fie2010/papers/1036.pdf · course so that they can use the components for future projects. Index

Session S2F

978-1-4244-6262-9/10/$26.00 ©2010 IEEE October 27 - 30, 2010, Washington, DC 40th ASEE/IEEE Frontiers in Education Conference S2F-5

IV. CONCLUSIONS

A new sophomore level course is described and analyzed. This class introduces microcontroller-based control and interface product design and development to ECE sophomore students. It helps them to appreciate the discipline and various topics of ECE through hardware and software design as well as hardware and software interfacing. It also helps students to understand a broad view of various subjects of the ECE so that they can make a well informed decision on whether to continue their study of ECE as their career choice. The class builds a foundation for later classes when instrumentation is needed as well as required skills and equipment for junior and senior designs. Students are required to purchase most hardware components for the course so that the components will be available for later courses.

V. REFERENCES [1] Olds, B. and Miller, R., “The Effect of a First-Year Integrated

Engineering Curriculum on Graduation Rates and Student Satisfaction: A Longitudinal Study,” J. Engineering Education, pp.23-36, January, 2004.

[2] Lee, E. A. and Messerschmitt, D. G., “Engineering an Education for the Future,” IEEE Computer Magazine, pp. 77-85, January, 1998. (three central topics of ECE: )

[3] Huettel, L.G., Brown, A.S., et. al., “Fundamentals of ECE A Rigorous, Integrated Introduction to Electrical and Computer Engineering,” IEEE Transactions on Education, vol. 50, No. 3, August, 2007.

[4] Seung Han Kim and Jae Wook Jeon, “Introduction for Freshmen to Embedded Systems Using LEGO Mindstorms,” IEEE Trans on Education, Vol. 52, No. 1, February 2009, pp99-108.

[5] Edward A. Lee and Pravin Varaiya, “Introducing Signals and Systems – the Berkeley Approach,” 9TH DSP Workshop (DSP 2000) and SPE 2000 from www.spib.ece.rice.edu/DSP2000. (system approach)

[6] Barnwell, III, T. P., “Repackaging the Core ECE Curriculum at Georgia Tech Using DSP First,” 9TH DSP Workshop (DSP 2000) and SPE 2000 (www.spib.ece.rice.edu/DSP2000.)

[7] Ybarra, G.A., Collins, L.M., Huettel, L.G., Massoud, H.Z., Board, J.A., Brooke, M., Jokerst, N.M., Choudhury, R.R., Gustafson, M.R., Willett, R.M., and Coonley, K., “Integrating Sensing and Information Processing in an Electrical and Computer Engineering Undergraduate Curriculum,” 39th ASEE/IEEE Frontiers in Education Conference, San Antonio, Texas, October 18-21,. 2009.

[8] Huettel, L.G., “Integration of a DSP Hardware-based Laboratory into an Introductory Signals and Systems Course,” Proceedings of the American Society for Engineering Education Annual Conference, June, 2006.

[9] Microcontroller Pros Corprtion at http://www.ucpros.com/.

FIGURE 2

THREE PUSH-BUTTON SWITCHES AND AN 8-LED BARGRAPH AND SWITCH DEBOUNCING DELAY LOOP.

FIGURE 3

TWO-CHANNEL VOLTMETER WITH AN LED BARGRAPH DISPLAY.

FIGURE 4

AN LCD CLOCK ON A BREADBOARD.

Page 6: Session S2F Learning and Practicing Fundamentals of ...archive.fie-conference.org/fie2010/papers/1036.pdf · course so that they can use the components for future projects. Index

Session S2F

978-1-4244-6262-9/10/$26.00 ©2010 IEEE October 27 - 30, 2010, Washington, DC 40th ASEE/IEEE Frontiers in Education Conference S2F-6

FIGURE 5

A REAL-TIME CLOCK WITH AN LCD WITH A 14-PIN FEMALE CONNECTOR.

FIGURE 6

A MULTI-FUNCTION DEVICE: ALARM CLOCK, STOPWATCH, VOLTMETER AND THERMOMETER.