ECE 447: Lecture 3 Microcontroller Programming in C.

Slides:



Advertisements
Similar presentations
Chapter 5 Internal Memory
Advertisements

ECE 447 Fall 2009 Lecture 2: TI MSP430 Software Development C and MSP430 Assembly.
MC68HC11 System Overview. System block diagram (A8 version)
H. Huang Transparency No.5-1 The 68HC11 Microcontroller Chapter 5: Operation Modes and Memory Expansion The 68HC11 Microcontroller Han-Way Huang Minnesota.
External Interrupt Module MTT EXTERNAL INTERRUPT REQUEST MODULE (IRQ)
Department of Computer Engineering
Processor System Architecture
ELEC 330 Digital Systems Engineering Dr. Ron Hayne
ECE 447 Fall 2009 Lecture 9: TI MSP430 Interrupts & Low Power Modes.
MEMORY ORGANIZATION Memory Hierarchy Main Memory Auxiliary Memory
ECE 372 – Microcontroller Design Parallel IO Ports - Interrupts
CMPE 118 MECHATRONICS CMPE 118/L Introduction to Mechatronics Tu-Th 4:00-5:45pm, Jack Baskin Engineering 372 Lab: Jack Baskin Engineering 150, 24/7 Instructor:
Midterm Tuesday October 23 Covers Chapters 3 through 6 - Buses, Clocks, Timing, Edge Triggering, Level Triggering - Cache Memory Systems - Internal Memory.
Micro-controller or embedded controller
1 ECE 263 Embedded System Design Lessons 2, 3 68HC12 Hardware Overview, Subsystems, and memory System.
9/20/6Lecture 3 - Instruction Set - Al Hardware interface (part 2)
Architecture of the 8051 INTERNAL DATA BUS Oscillator & Timing Programmable I/O (32 Pins) 80C51 CPU 64K byte Expansion Control Serial I/O 4K Program Memory.
The 8051 Microcontroller.
INTERRUPTS PROGRAMMING
NS Training Hardware. System Controller Module.
MCU – Microcontroller Unit – 1 MCU  1 cip or VLSI core – application-specific.
Serial Peripheral Interface Module MTT M SERIAL PERIPHERAL INTERFACE (SPI)
ECE 265 – LECTURE 12 The Hardware Interface 8/22/ ECE265.
ECE 447: Lecture 1 Microcontroller Concepts. ECE 447: Basic Computer System CPU Memory Program + Data I/O Interface Parallel I/O Device Serial I/O Device.
Revised: Aug 1, ECE 263 Embedded System Design Lesson 1 68HC12 Overview.
AT91RM9200 Boot strategies This training module describes the boot strategies on the AT91RM9200 including the internal Boot ROM and the U-Boot program.
Address Decoding Memory/IO.
Embedded System Spring, 2011 Lecture 4: The PIC Microcontrollers Eng. Wazen M. Shbair.
Chapter 5 Internal Memory. Semiconductor Memory Types.
Internal Input/Output Devices (I/O Subsystems)
ECE Lecture 1 Microcontroller Concepts. Basic Computer System CPU Memory Program + Data I/O Interface Parallel I/O Device Serial I/O Device Data.
ECE Lecture 13 Motorola 68HC11. Resources 68HC11 E-series Reference Guide and if necessary 68HC11 E-series Technical Data 68HC11 Reference Manual.
MICROCONTROLLER SYSTEMS Part 1. Figure 1.1Elements of a digital controller CPU Central Processing Unit Input Peripherals Output Peripherals ROM Read Only.
8051 Micro controller. Architecture of 8051 Features of 8051.
ECE 265 – LECTURE 3 68HC11 Address Space, Memory, Registers, and data transfers 3/29/ ECE265.
Appendix B: System Development Example MTT48 V2.1 B - 1 APPENDIX B: SYSTEM DEVELOPMENT.
EE 345 Class Notes EE345 Midterm Review Dr. Jane Dong.
1 Introduction to Microcontroller Microcontroller Fundamentals & Programming.
S4525A Peripherals & Enhanced FLASH 1 © 1999 Microchip Technology Incorporated. All Rights Reserved. S4525A Peripherals & Enhanced FLASH 1 Peripherals.
Microprocessor Fundamentals Week 4
Features of the PIC18 microcontroller - 8-bit CPU - 2 MB program memory space (internal 32KB to 128KB) bytes to 1KB of data EEPROM - Up to 4096 bytes.
ECE 371 Microprocessor Interfacing
1 Expanded Modes, Bus, External Memory Today: First Hour: Expanded Modes, Bus, Timing –Section of Huang’s Textbook –In-class Activity #1 Second.
1 Bringing it all together: Exploring the EVB Today: First Hour: Bringing it all together by exploring the EVB –Section of Huang’s Textbook.
EPROM/OTPROM Module MTT48 V EPROM PROGRAMMING.
1 Basic Processor Architecture. 2 Building Blocks of Processor Systems CPU.
ECE 447: Lecture 2 Internal Input/Output Devices A/D Converter.
8051 Micro Controller. Microcontroller versus general-purpose microprocessor.
The Principle and Application of Microcontrollers
Computer Operating Properly Module MTT COMPUTER OPERATING PROPERLY MODULE (COP)
1 Bringing it all together: Exploring the EVB Today: First Hour: Bringing it all together by exploring the EVB –Section of Huang’s Textbook.
George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ME 4447/6405 Microprocessor Control of Manufacturing Systems and Introduction.
Memory Mapped IO (and the CerfBoard). The problem How many IO pins are available on the 8051? What if you are using interrupts, serial, etc…? We want.
George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ME 4447/6405 Microprocessor Control of Manufacturing Systems and Introduction.
Introduction to Microcontroller Technology
Hoda Roodaki AVR Family Overview Hoda Roodaki
UNIT – Microcontroller.
8051 Timers Timers are the peripherals of the 8051 Microcontroller.
BVM Engineering College Electrical Engineering Department : Microprocessor and Microcontroller Interfacing Interrupts of 8051 Prepared by:
The Arduino Microcontroller: Atmel AVR Atmega 328
Data bus CPU General Purpose microprocessor RAM ROM I/O Port Timer
8051 Programming in C rhussin.
Introduction to Microprocessors and Microcontrollers
Number Representations and Basic Processor Architecture
AT91RM9200 Boot strategies This training module describes the boot strategies on the AT91RM9200 including the internal Boot ROM and the U-Boot program.
8051 Timers / Counters It has two timers Timer 0 and Timer 1.
ADDRESSING MODES AND INSTRUCTION SET
ANALOG TO DIGITAL CONVERTER (ATD).
Chapter 9 Bootloader.
UNIT-III Pin Diagram Of 8086
Presentation transcript:

ECE 447: Lecture 3 Microcontroller Programming in C

ECE 447: Class Exercise 1 Write a function in C that transfers 512 bytes of data from the internal EEPROM of MC68HC11E9 to the block of external RAM starting at address $6000.

ECE 447: 68HC11E9 Memory Map $0000 $1000 $B600 $FFFF $0000-$01FF 512 bytes RAM $1000-$103F 64 bytes I/O registers $B600-$B7FF 512 bytes EEPROM Expanded bus mode $D000 $2000-$B5FF 37.5 kbytes $D000-$FFFF 12 kbytes ROM External RAM recommended for use $2000 recommended for use

ECE 447: Default Memory Map $0000 $1000 $B600 $FFFF $0000-$01FF 512 bytes RAM $1000-$103F 64 bytes I/O registers $B600-$B7FF 512 bytes EEPROM Expanded bus mode $D000 Program area - text $2000 $6000 Data area – data External RAM $2000-$5FFF 16 kbytes $6000-$B5FF 21.5 kbytes

ECE 447: Class Exercise 2 Write a program in C that continuously transfers data from PORT E to PORT C of MC68HC11.

ECE 447: Organization of MC68HC11 CPU RAM ROM EEPROM TIMER A/D SPI SCI PORT APORT BPORT CPORT DPORT E 8 8 (4)

ECE 447: Class Exercise 3 Write a program in C that continuously scans pin PE5 of PORT E of MC68H11. Whenever a falling edge is detected at PE5, the microcontroller should clear the pin PC4,and toggle pin PC2 of MC68HC11.

ECE 447: Running program continuously while (1) { ……….. } Sequence of operations repeated continuously

ECE 447: Setting and Clearing a bit Setting a bit #define BIT7 0x80 unsigned char c = …; c |= BIT7; Clearing a bit #define BIT7 0x80 unsigned char c = …; c &= ~BIT7;

ECE 447: Toggling a bit #define BIT7 0x80 unsigned char c = …; c ^= BIT7;

ECE 447: Testing a bit #define BIT7 0x80 unsigned char c = …; if (c & BIT7) ….. ; else ….. ;

ECE 447: Writing data to / Reading data from a particular memory location unsigned char * ADCTL_ptr = (volatile unsigned char *) 0x1030; unsigned char result; *ADCTL_ptr = …; result = *ADCTL_ptr; Method 1

ECE 447: Writing data to / Reading data from a particular memory location #define ADCTL (* (volatile unsigned char *) 0x1030); unsigned char result; ADCTL = …; result = ADCTL; Method 2

ECE 447: Writing data to / Reading data from a particular memory location #include “hc11e9.h” unsigned char result; ADCTL = …; result = ADCTL; Method 3 (not allowed in Experiment 1)

ECE 447: Waiting for a bit to set #define CCF 0x80 #define ADCTL (* (volatile unsigned char *) 0x1030); while (!(ADCTL & CCF)) ; do nothing