1 Neutron Monitor Workshop 3(A): Microcontroller Principles and the Demo Board Mahidol University January 5, 2010 Paul Evenson University of Delaware Bartol.

Slides:



Advertisements
Similar presentations
Computer Architecture
Advertisements

Microprocessors A Beginning.
Microprocessors and Interfacing
Microprocessors.
Parul Polytechnic Institute
INSTRUCTION SET ARCHITECTURES
Computer Organization and Architecture
Processor Function Topic 3.
Processor System Architecture
TK 2633 Microprocessor & Interfacing
Room: E-3-31 Phone: Dr Masri Ayob TK 2123 COMPUTER ORGANISATION & ARCHITECTURE Lecture 5: CPU and Memory.
TK 2633 Microprocessor & Interfacing Lecture 3: Introduction to 8085 Assembly Language Programming (2) 1 Prepared By: Associate Prof. Dr Masri Ayob.
Room: E-3-31 Phone: Dr Masri Ayob TK 2633 Microprocessor & Interfacing Lecture 1: Introduction to 8085 Assembly Language.
Memory - Registers Instruction Sets
Room: E-3-31 Phone: Dr Masri Ayob TK 2633 Microprocessor & Interfacing Lecture 1: Introduction to 8085 Assembly Language.
Recap – Our First Computer WR System Bus 8 ALU Carry output A B S C OUT F 8 8 To registers’ input/output and clock inputs Sequence of control signal combinations.
EET 2261 Unit 2 HCS12 Architecture
Unit-1 PREPARED BY: PROF. HARISH I RATHOD COMPUTER ENGINEERING DEPARTMENT GUJARAT POWER ENGINEERING & RESEARCH INSTITUTE Advance Processor.
CEG 320/520: Computer Organization and Assembly Language Programming1 CEG 320/520 Computer Organization and Assembly Language Programming.
Rabel Talpur:12BME#025.  40-pin chip  Developed by Motorola in 1975  16 address lines and 8 data lines  Used only +5V.
Lecture 18 Last Lecture Today’s Topic Instruction formats
created by :Gaurav Shrivastava
Machine Instruction Characteristics
Computer Systems Organization CS 1428 Foundations of Computer Science.
1 Neutron Monitor Workshop 3(B): Next Generation Readout Board Mahidol University January 6, 2010 Paul Evenson University of Delaware Bartol Research Institute.
Introduction to Computing Systems from bits & gates to C & beyond The Von Neumann Model Basic components Instruction processing.
Lecture 14 Today’s topics MARIE Architecture Registers Buses
Computer Architecture and Organization
Computer Architecture EKT 422
George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ME 4447/6405 Microprocessor Control of Manufacturing Systems and Introduction.
Z80 Overview internal architecture and major elements of the Z80 CPU.
Electronic Analog Computer Dr. Amin Danial Asham by.
1 Introduction to Microcontroller Microcontroller Fundamentals & Programming.
Computer and Information Sciences College / Computer Science Department CS 206 D Computer Organization and Assembly Language.
Instruction Sets: Addressing modes and Formats Group #4  Eloy Reyes  Rafael Arevalo  Julio Hernandez  Humood Aljassar Computer Design EEL 4709c Prof:
COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGE Lecture 21 & 22 Processor Organization Register Organization Course Instructor: Engr. Aisha Danish.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
1 The Instruction Set Architecture September 27 th, 2007 By: Corbin Johnson CS 146.
What is a program? A sequence of steps
Computer Architecture Lecture 4 by Engineer A. Lecturer Aymen Hasan AlAwady 17/11/2013 University of Kufa - Informatics Center for Research and Rehabilitation.
Execution Architecture MTT CPU08 Core M CPU08 INTRODUCTION.
Simple ALU How to perform this C language integer operation in the computer C=A+B; ? The arithmetic/logic unit (ALU) of a processor performs integer arithmetic.
ECE 447: Lecture 11 Introduction to Programming in Assembly Language.
MICROPROCESSOR DETAILS 1 Updated April 2011 ©Paul R. Godin prgodin gmail.com.
1 Basic Processor Architecture. 2 Building Blocks of Processor Systems CPU.
1 Neutron Monitor Workshop 2(B): Neutron Monitor Digital Electronics Mahidol University June 26, 2009 Paul Evenson University of Delaware Cosray at McMurdo.
8085 INTERNAL ARCHITECTURE.  Upon completing this topic, you should be able to: State all the register available in the 8085 microprocessor and explain.
George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ME 4447/6405 Microprocessor Control of Manufacturing Systems and Introduction.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
1 Chapter 1 Basic Structures Of Computers. Computer : Introduction A computer is an electronic machine,devised for performing calculations and controlling.
Computer Architecture. Instruction Set “The collection of different instructions that the processor can execute it”. Usually represented by assembly codes,
Unit Microprocessor.
COURSE OUTCOMES OF Microprocessor and programming
Control Unit Lecture 6.
Introduction of microprocessor
Microcomputer Programming
An Introduction to Microprocessor Architecture using intel 8085 as a classic processor
Processor Organization and Architecture
Morgan Kaufmann Publishers Computer Organization and Assembly Language
ECEG-3202 Computer Architecture and Organization
Md. Mojahidul Islam Lecturer Dept. of Computer Science & Engineering
Md. Mojahidul Islam Lecturer Dept. of Computer Science & Engineering
ECEG-3202 Computer Architecture and Organization
ME 4447/6405 Microprocessor Control of Manufacturing Systems and
COMPUTER ORGANIZATION AND ARCHITECTURE
Computer Operation 6/22/2019.
ME 4447/6405 Microprocessor Control of Manufacturing Systems and
ME 4447/6405 Microprocessor Control of Manufacturing Systems and
Chapter 10 Instruction Sets: Characteristics and Functions
Presentation transcript:

1 Neutron Monitor Workshop 3(A): Microcontroller Principles and the Demo Board Mahidol University January 5, 2010 Paul Evenson University of Delaware Bartol Research Institute

2 Workshop Series Idea Introduce students to technical aspects of neutron monitor operation Rotating workshop series that will repeat every two years at a two per year rate Independent enough so students can join at any point Accommodate wide skill range with an emphasis on “hands on” experience and individual discussion

3 Workshop Series Plan 1.Detector operation A.Detector Physics and Analog Electronics B.Art and Science of Soldering 2.Digital Circuits A.Principles of Digital Logic B.Neutron Monitor Digital Electronics 3.Microcontrollers A.Principles and the Demo Board B.Next Generation Readout Board 4.Real time data acquisition A.Principles of Telemetry and Data Acquisition B.Data Conversion and Manipulation with Visual Basic

4 Plan For Today Lecture with Demonstrations –Discuss Microcontrollers –Explain DEMO8 Board –Explain Code Warrior –Demonstrate Simple Program Individual work on programs –Several CodeWarrior stations –Only one DEMO8 board –Take turns to test

5 Microcomputer vs. Microcontroller Microcomputer –Very fast (GHz) –Powerful Instructions –Manage large memory –High speed general data pathways –Often a “chip set” –Expensive ($100’s) Microcontroller –Modest speed (10Mhz) –Simple instructions –Small memory (mainly ROM) –I/O to communicate with logic –Typically single chip –Cheap ($5)

6 FPGA vs. Microcontroller FPGA –Very fast (GHz) –No fixed instructions –No fixed memory –No structured I/O –Often has a microcomputer on same chip –Expensive ($100’s) Microcontroller –Modest speed (10Mhz) –Simple instructions –Small memory (mainly ROM) –I/O to communicate with logic –Typically single chip –Cheap ($5)

7 Essence of a Microcontroller: MC68HC908AP64 All pins either sense or produce (and most can do either) digital logic levels under control of the internal program

8 Behind This Innocent Exterior Lurks A Complex Mind! In addition to the straightforward input output lines there are functions to construct timing patterns and to communicate in standard ways with other devices All of this is under the control of the program stored in ROM (Read Only Memory)

9 Programming (I) Computer –Operating system converts “user friendly” code into internal instructions –Operating system loads the program into RAM (supplemented by virtual memory on disk) –Operating system manages data flow into and out of the program –Operating system manages execution and terminates runaway programs Microcontroller –Separate system on a computer (Code Warrior) converts “user friendly” code into internal instructions –Hardware device (MON08 Multilink) stores the program in ROM on the chip –All I/O is under direct program control –Limited protection against program faults

10 Programming (II) Code Warrior in fact has the capability to interpret high level languages (C++) Common functions can be captured in subroutines and linked into a program I will however stick to the simplest kind of programming (assembly language) where each line of code translates to a specific machine instruction

11 “Stored Program” Computer Memory –Series of locations each with an address –MC68HC908AP64 uses 8-bit bytes –Contain binary bit patterns –Program and data are intermixed Program Counter –Points to the memory location containing the next instruction Registers –Special memory locations implicitly referenced by instructions

12 Computer Instruction Cycle Fetch the Instruction Pointed to by Program Counter –Instructions can be several bytes long –First byte of the instruction gives length Execute the Instruction –Modify memory and/or registers as specified by the instruction Set Condition Codes –Usually indicate whether a result is +/0/- Update PC to location of next instruction –Can be as simple as n+1 –Often based on instruction and condition codes

13 Some Registers are Part of the Memory Map, and are Accessed Like Data

14 CPU Registers are Not Part of the Memory Map; In a Microcontroller They Are Very Simple

15 Accumulator and Index Register The accumulator is a general-purpose 8-bit register. –The CPU uses the accumulator to hold operands and the results of arithmetic/logic operations. The 16-bit index register allows indexed addressing of a 64-Kbyte memory space. H is the upper byte of the index register, and X is the lower byte. H:X is the concatenated 16-bit index register. –In the indexed addressing modes, the CPU uses the contents of the index register to determine the conditional address of the operand. –The index register can serve also as a temporary data storage location.

16 Program Counter The program counter is a 16-bit register that contains the address of the next instruction or operand to be fetched. –Normally, the program counter automatically increments to the next sequential memory location every time an instruction or operand is fetched. Jump, branch, and interrupt operations load the program counter with an address other than that of the next sequential location. During reset, the program counter is loaded with the reset vector address located at $FFFE and $FFFF. –The vector address is the address of the first instruction to be executed after exiting the reset state.

17 The Stack The “stack” is a group of memory locations specially arranged to allow quick storage and retrieval of temporary data. –The latest entry placed on the stack is the first to be removed –Primarily this is used to store return addresses for multiple layers of subroutines The stack pointer is a 16-bit register that contains the address of the next location on the stack. –During a reset, the stack pointer is preset to $00FF. –The reset stack pointer (RSP) instruction sets the least significant byte to $FF and does not affect the most significant byte. The stack pointer decrements as data are pushed onto the stack and increments as data are pulled from the stack.

18 Condition Code Register The 8-bit condition code register contains the interrupt mask and five flags that indicate the results of the instruction just executed. Bits 6 and 5 are set permanently to logic 1. The five logic flags are: 1.The CPU sets the overflow flag when a two's complement overflow occurs. The signed branch instructions BGT, BGE, BLE, and BLT use the overflow flag. 2.The CPU sets the half-carry flag when a carry occurs between accumulator bits 3 and 4 during an add-without-carry (ADD) or add- with-carry (ADC) operation. The half-carry flag is required for binary- coded decimal (BCD) arithmetic operations. The DAA instruction uses the states of the H and C flags to determine the appropriate correction factor. 3.The CPU sets the negative flag when an arithmetic operation, logic operation, or data manipulation produces a negative result, setting bit 7 of the result. 4.The CPU sets the zero flag when an arithmetic operation, logic operation, or data manipulation produces a result of $00. 5.The CPU sets the carry/borrow flag when an addition operation produces a carry out of bit 7 of theaccumulator or when a subtraction operation requires a borrow. Some instructions — such as bit test and branch, shift, and rotate — also clear or set the carry/borrow flag.

19 Typical Logic Instruction

20 Typical Branch Instruction

21 Subroutine Call and Return

22 DEMO908AP64 Board Carries a sample MC68HC908AP64 Several simple peripherals Connection to other circuits

23 Code Warrior and the MON08 USB Multilink Interface The development environment CodeWarrior and the USB Multilink together allow construction and testing of programs for the microcontroller.

24 Functions of the Development System Assembler/Compiler –Manages user code –Adds processor description Linker –Combines several compiled programs –Adds further processor information Loader –Transfers the program to the chip Debugger –Allows step by step execution of code –Not all that useful for realtime stuff

25 Demonstration First I will demonstrate a small program that flashes patterns of lights on the Demo board Then we can either jointly try to make it do something different, or you can have your own copies to use CodeWarrior on different machines. To test the programs we must use the copy of Code Warrior linked to the Demo board