Presentation is loading. Please wait.

Presentation is loading. Please wait.

Programming 68HC11. Steps in programming MPU START FETCH TO CODE DECODE OP CODE FETCH OPERAND ADDRESS IF ANY EXECUTE THE INSTRUCTION.

Similar presentations


Presentation on theme: "Programming 68HC11. Steps in programming MPU START FETCH TO CODE DECODE OP CODE FETCH OPERAND ADDRESS IF ANY EXECUTE THE INSTRUCTION."— Presentation transcript:

1 Programming 68HC11

2 Steps in programming MPU START FETCH TO CODE DECODE OP CODE FETCH OPERAND ADDRESS IF ANY EXECUTE THE INSTRUCTION

3 Programming Language machine Machine Language Hex Machine language B C BB E FF B C AA

4  $ indicate that the address is in hex  LDAA load accumulator A B6  STAA store accumulator A B7  ADDA add to accumulator A BB  SUBA subtract to accumulator A B0  WAI halt 3E  JMP jump 7E  BEQ branch if equal to zero 27

5 Jump branch instruction Memory Address hex Memory word hex MnemonicDescription C10048ASLA Shift A left 1 bit C1017EJMP JUMP to C15F for the next instruction C102C1 ADDRESS OF THE NEXT INSTRUCTION C1035F ADDRESS OF THE NEXT INSTRUCTION C104 C105 … C15FB7STAA STORE IN MEMORY LOCATION C300 C160C3 ADDRESS OF THE LOCATION WHERE THE CONTENTS OF A WILL B STORED C16100

6 Branch Equal to Zero (BEQ) instruction Memory Address hex Memory word hex MnemonicDescription C200BOSUBA Shift A left 1 bit C201C2 JUMP to C15F for the next instruction C2029B ADDRESS OF THE NEXT INSTRUCTION C20327BEQ RESULT OF THE LAST OPERATION IS ZERO BRANCH TO C219 C20414 IF NOT GO TO C205 OFSET = C205 … ??? PC = C205 + OFSET 14 C219 B7STAA STORE IN ADDRESS C127 C21AC1 C21B27

7 Terms  Offset determines MPU’s next instruction  C1, 00 address of operand X  C1, 01 address of operand Y  C1, 02 address where the contents of the accumulator A will be stored  C1, 5F address of next instruction  C3, 00 address of location where the contents of A will be stored

8 Assembly language source program Memory address Instruction mnemonic Comments C200LDAA $D0FFGet first the data word C203ADDA $D500Add second data word C206STAA $D700Store sum in memory

9 LDAA code Source Code Object Code LDAA B6D0FF $D0FF

10 Assembly process typical steps  The online assembler program is loaded into the computer’s internal RAM’s (unless it is already in ROM)  The programmer loads the assembly language source program into the computer’s RAM, either from the keyboard or an external memory unit (like when using ASCII code for the characters)

11 Continuation  The computer then is commanded to execute the one-line assembler program  The computer executes the one-line assembler program which converts source code instruction such as LDAA $D0FF into object code that I places into RAM  Once instruction is placed in RAM the program then can be stored in disk for later use

12 Continuation  The object program can now be executed since it is in the executable machine.

13 High level languages  BASIC  FORTRAN  TURBO C++

14 Flowchart Start Initialize COUNT=7 Initialize RESULT=0 Read data byte from sensor Add to RESULT Decrement COUNT Is count =0 ? Store result in memory stop yesno

15 Problems  How many consecutive location does an 8 bit microcomputer store a 48 bit word?  Answer 48 bit / 8 bit 6 consecutive memory location

16 A certain 32 bit computer has the following instruction word format: Op codeOperands address 8 bits16 bits Answer a) 256 bits b) c) a)How many different instructions can this instruction word specify? b)How many different memory addresses can it specify? c)What internal memory capacity would this computer require to operate at full capacity?

17 During the LDAA instruction data are taken from__________ and transferred to ___________ Memory location STAA


Download ppt "Programming 68HC11. Steps in programming MPU START FETCH TO CODE DECODE OP CODE FETCH OPERAND ADDRESS IF ANY EXECUTE THE INSTRUCTION."

Similar presentations


Ads by Google