Motorola Axiom CMD11E1 Guide de l'utilisateur

Naviguer en ligne ou télécharger Guide de l'utilisateur pour Logiciel Motorola Axiom CMD11E1. Motorola Axiom CMD11E1 User`s guide Manuel d'utilisatio

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 101
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 0
MC68HC11 Laboratory Manual
N. Natarajan
Department of Electrical and Computer Engineering
University of Michigan-Dearborn
4901 Evergreen Road
Dearborn-48128
Vue de la page 0
1 2 3 4 5 6 ... 100 101

Résumé du contenu

Page 1 - MC68HC11 Laboratory Manual

MC68HC11 Laboratory ManualN. NatarajanDepartment of Electrical and Computer EngineeringUniversity of Michigan-Dearborn4901 Evergreen RoadDearborn-4812

Page 2

10 CHAPTER 1. INTRODUCTION TO HC111.2.4 Writing and entering your first program: Using MMLet us write a short program that will add three numbers store

Page 3 - Contents

100 CHAPTER 9. ANALOG TO DIGITAL CONVERSION;STEP 2; INITIATE CONVERSION;LDAA #%00100011 *SCAN=1, MULT=0, PIN = 011 (PE3)STAA ADCTL;MAIN LOOPLOOP;STEP

Page 4

9.7. A SIMPLE DIGITAL VOLTMETER 101JSR OUTLHLFLDAA #’.JSR OUTAPULA *GET THE SAVED VALUEJSR OUTRHLFJSR OUTCRLF; BACK FOR MORE UNLESS USER TYPES AN ESCA

Page 5

1.2. TASKS 11call C100Note you can abbreviate any command by entering enough characters to identifyit. Since no other command starts with the letter c

Page 6 - 6 CONTENTS

12 CHAPTER 1. INTRODUCTION TO HC11>ASM C200C200 STX $FFFF>LDAA D000B6 D0 00C203 STX $FFFF>ADDA D001BB D0 01C206 STX $FFFF>ADDA D002BB D0 0

Page 7 - Introduction to HC11

1.2. TASKS 13(b) Find out the ascii codes for the letters in the phrase THIS CLASS ISFUN. To get you started, here are some codes: code for ’T’ is 54,

Page 8 - 1.2.3 Modifying memory

14 CHAPTER 1. INTRODUCTION TO HC11LOAD TIn Hyperterm, use the ASCII file transfer command (use the Transfer menu itemto get to it) to transfer the PROG

Page 9

Chapter 2Introduction to Looping2.1 ObjectiveTo become familiar with elementary loops and simple input/outputs functions.2.2 Simple Input/OutputOne of

Page 10

16 CHAPTER 2. INTRODUCTION TO LOOPING2.2.1 The function OUTAThe function OUTA will transmit whatever is in register A over the serial com-munication l

Page 11

2.3. BRANCHING 17Exercise:1. Using the MM command (memory modify) enter the following values inmemory locations D000, D001, · · ·: 30 31 32 33 41 42 4

Page 12

18 CHAPTER 2. INTRODUCTION TO LOOPINGExercise:1. Using the HC11 reference book, identify 5 instructions that do not affectthe C flag, but affects some ot

Page 13

2.4. LOOPING 19Exercises:1. Assemble the following code in your PC, transfer the S19 file to HC11, runthe program and write down the output of the prog

Page 15 - Introduction to Looping

20 CHAPTER 2. INTRODUCTION TO LOOPINGSWIVerify that CALL C100 and CALL C200 produces the same output. Explainwhy this is so, and how and why the loop

Page 16 - 2.2.2 The function OUT1BYT

2.4. LOOPING 21ORG $D000FCB $55, $6F, $66, $4D, $2D, $44, $62, $72, $6ERun the above program using CALL C3004. Modify the above program as shownbelow

Page 17 - 2.3 Branching

22 CHAPTER 2. INTRODUCTION TO LOOPINGLDAA 0,XADDA $10,XSTAA $20,XINXDECBBRA CALLOOHCALLAYSWIORG $D000FCB $55, $6F, $66, $4D, $44, $62, $72, $6EFCB $41

Page 18 - 2.4 Looping

2.5. OTHER CONDITIONAL BRANCHES 23DECBBRA KINGSCABBAGESLDAA #$0AJSR OUTAJSR OUTASWI2.5 Other Conditional Branches2.5.1 Signed and unsigned numbersSo f

Page 19

24 CHAPTER 2. INTRODUCTION TO LOOPINGcompared are of opposite sign) and one for unsigned comparison where no specialcases need be considered.2.5.2 com

Page 20 - Marching through memory

2.5. OTHER CONDITIONAL BRANCHES 25Branch to LOCif A >= MEMCMPA MEMBGE LOC *Branch if Greater or EqualBranch to LOCif A < MEMCMPA MEMBLT LOC *Bra

Page 21

26 CHAPTER 2. INTRODUCTION TO LOOPING; IT USES CODE REUSE IN THIS SIMPLE FORM. TO ADD 54, IT; IT ADDS 6 AND THEN FALLS DOWN TO THE CASE OF ADDING 48.;

Page 22

2.5. OTHER CONDITIONAL BRANCHES 27ADD54ADDA #6ADD48ADDA #6ADD42ADDA #6ADD36ADDA #6ADD30ADDA #6ADD24ADDA #6ADD18ADDA #6ADD12ADDA #6ADD6ADDA #6DONESTAA

Page 23

28 CHAPTER 2. INTRODUCTION TO LOOPING>MM D000D000 23 29>C C00029 41P-C04B Y-AAAA X-D002 A-20 B-AA C-D9 S-004A>Using LoopsHere is a version us

Page 24

2.5. OTHER CONDITIONAL BRANCHES 29DONESTAA $D001LDX #$D000JSR OUT1BSP *SAME AS OUT1BYT EXCEPT PRINTS A SPACE AFTER THE NUMBERJSR OUT1BYTSWI;;;;;;;;;;;

Page 25 - 2.5.4 An example: HEX2BCD

Contents1 Introduction to HC11 71.1 Objective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71.2 Tasks . . . . . . . . . . . . . . . .

Page 26

30 CHAPTER 2. INTRODUCTION TO LOOPING

Page 27

Chapter 3Functions and bit manipulations3.1 ObjectiveTo become familiar with bit level operations and writing functions. This lab alsoillustrates the

Page 28

32 CHAPTER 3. FUNCTIONS AND BIT MANIPULATIONSmost often used sentinels are zero (also known as ASCII-Z string), 26 (also knownas CONTROL-Z string, or

Page 29

3.4. WRITING YOUR FIRST FUNCTION 33next and then the program section, though it is easier to follow the code if theprogram section precedes the data s

Page 30

34 CHAPTER 3. FUNCTIONS AND BIT MANIPULATIONSthe registers the way they were before the functions used them1.Here are the basic rules for writing func

Page 31 - Chapter 3

3.4. WRITING YOUR FIRST FUNCTION 35You use FCB to initialize consecutive memory loication (when you transfer thecode from the PC). The label associate

Page 32

36 CHAPTER 3. FUNCTIONS AND BIT MANIPULATIONSADCA #20STAA SEED ;don’t forget to save it backRTS;;;;;;;;;;;;;;;;;;;;;;;;End: RAND ;;;;;;;;;;;;;;;;;;;;;

Page 33

3.5. YOUR SECOND FUNCTION 37code for 0 or the code for 1 depending on whether the carry is cleared or set5.Note the function involves a counting loop.

Page 34

38 CHAPTER 3. FUNCTIONS AND BIT MANIPULATIONS; the function destroys the value in a,; so re load it! then print second digitTBAJSR OUTRHLF; now print

Page 35

3.5. YOUR SECOND FUNCTION 39; restore the registersPULXPULBPULARTS;;;;;;;;;;;;;;;;;;;;;;;End: PRBINARY;;;;;;;;;;;;;;;;;;;;3.5.1 Test your functionWe c

Page 36 - 3.5 Your second function

4 CONTENTS3.4 Writing your first function . . . . . . . . . . . . . . . . . . . . . . 323.4.1 On random sequences . . . . . . . . . . . . . . . . . . .

Page 37

40 CHAPTER 3. FUNCTIONS AND BIT MANIPULATIONSJSR RANDJSR PRBINARYSWI;;; INSERT YOUR CODE FOR PRBINARY HERE;;; INSERT YOUR CODE FOR RAND HEREORG $D000;

Page 38

3.7. CLEARING BITS 41SETBIT4PSHALDAA $00ORAA #%00010000STAA $00PULARTS;; INSERT THE CODE FOR FUNCTIONS RAND AND PRBINARY HEREORG $D000;; ALL THE DATA

Page 39 - 3.5.1 Test your function

42 CHAPTER 3. FUNCTIONS AND BIT MANIPULATIONSJSR CLRBIT4LDAA $00JSR PRBINARY *PRINT AFTER CLEARSWI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Page 40 - 3.6 Setting bits

3.8. TOGGLING BITS 43ORG $C100JSR OUTCRLF *NEED THIS FOR OUTPUTS TO LINE UP!JSR RANDSTAA $00JSR PRBINARY *PRINT BEFOREJSR TGLBIT4LDAA $00JSR PRBINARY

Page 41 - 3.7 Clearing bits

44 CHAPTER 3. FUNCTIONS AND BIT MANIPULATIONSORG $D000;; ALL THE DATA ITEMS GO HERE.$;;;;;;;;;;;;;;;;;;;;;;;end of code ;;;;;;;;;;;;;;;;;;;;;;;;3.9 Te

Page 42 - 3.8 Toggling bits

3.10. HARDWARE INTERFACING 45NOSTR FCC /NO/FCB 4;;;;;;;;;;;;;;;;;;;;;;;end of code ;;;;;;;;;;;;;;;;;;;;;;;;3.10 Hardware InterfacingWorking with rando

Page 43

46 CHAPTER 3. FUNCTIONS AND BIT MANIPULATIONSdrive devices from these pins (as long as you do not supply more than 5 mA). PA7is bidirectional and you,

Page 44 - 3.9 Testing bits

3.10. HARDWARE INTERFACING 4733.3KLEDTo groundTo test pointPA5 for exampleFigure 3.1: Test Probe. Make sure that the resistor is connected to the anod

Page 45 - 3.10 Hardware Interfacing

48 CHAPTER 3. FUNCTIONS AND BIT MANIPULATIONS2. Connect the input circuit as shown in figure 3.2.3.10.2 Controlling the LEDUse memory modify, MM $1000,

Page 46

Chapter 4Programs4.1 ObjectiveTo b ecome familiar with writing programs. This lab also illustrates the use ofassembler directives.4.2 What you should

Page 47

CONTENTS 57.5 Variable frequency generator . . . . . . . . . . . . . . . . . . . . . 807.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . .

Page 48 - 3.10.2 Controlling the LED

50 CHAPTER 4. PROGRAMS5. Compiler keeps track of the life and scope of the variable so that the variableis available only when it is in the scope of t

Page 49 - Programs

4.4. YOUR FIRST PROGRAM 513. If the instruction is a RMB instruction, then add the value after the mnemonicto the location counter.4. If the instructi

Page 50 - 4.3.1 How the assembler works

52 CHAPTER 4. PROGRAMSpseudo language, I will use a C like syntax1. The program we want to write shouldbe similar to the following C program (since HC

Page 51 - 4.4 Your first program

4.5. ON YOUR OWN! 53;v4 = 044;ldaa #@44staa v4;total = v1+v2+v3+v4;ldaa v1adda v2adda v3adda v4staa total;print total as 2 digit hex numberldaa totalj

Page 52

54 CHAPTER 4. PROGRAMSchar v;char total;main() {v = 0;total = 0;v = v+1;total = total + v;v = v+1;total = total + v;v = v+1;total = total + v;v = v+1;

Page 53 - 4.5 On your own!

4.5. ON YOUR OWN! 55anda #$0F; in C, use: getchar() & 0X0FUse the above sequence to let the user specify the count. When expectingthe user to ente

Page 54

56 CHAPTER 4. PROGRAMS(f) Modify the program so that the output reads some thing like:v1 = 07v2 = 1Cv3 = 23v4 = 467. Write a function that will be pas

Page 55

4.5. ON YOUR OWN! 57goto foo;bar:return 0;}10. Type the following C program, run it to see what the output is. Rewrite theprogram in assembly language

Page 56

58 CHAPTER 4. PROGRAMSif (c == ’1’) goto one;if (c == ’2’) goto two;fprintf(stderr,"\n\nNot a valid choice!\n");goto foo;one:fprintf(stderr,

Page 57

Chapter 5Tables5.1 ObjectiveTo become familiar with table driven code.5.2 What you should doYou will have to turn in your LST files for the programs yo

Page 58

6 CONTENTS

Page 59 - Chapter 5

60 CHAPTER 5. TABLESORG $3000 *data section...primes fcb 2,3,5, 7, 11, 13, 17, 19, 23, 29 *table of some primesnprimes equ 10 *number of entries in

Page 60 - 5.5 Working with tables

5.5. WORKING WITH TABLES 61a Yes/No value. A convenient way to return a Yes/No value is to use a hardwareflag. Let us use the Carry flag. The function w

Page 61

62 CHAPTER 5. TABLESinit equ $ffa9input equ $ffacoutput equ $ffafoutlhlf equ $ffb2outrhlf equ $ffb5outa equ $ffb8out1byt equ $ffbbout1bsp equ $ffbeout

Page 62

5.5. WORKING WITH TABLES 63org $2100ldx #preamblejsr outstrgmainloopjsr incharldx #vowelsldab #nvowelsjsr lookupbcs isvowelldx #nostrjsr outstrgobra m

Page 63

64 CHAPTER 5. TABLESExercise: Type the above program, assemble it, transfer the S19 file to the68HC11, and run the program with CALL 2100. When the pro

Page 64 - 5.5.2 Input with validation

5.5. WORKING WITH TABLES 65that we accept only digits and ignore non-digits (the user may be in the habit oftyping spaces, dashes etc. You want to sil

Page 65

66 CHAPTER 5. TABLESfcc /Hit the reset button to quit/fcb 10fcc /=====================================/fcb 10,10,10, 4; setup the table of digitsdigit

Page 66

5.5. WORKING WITH TABLES 67;;; Add the code for lookup function hereExercise: Type the above program and run it. Enter the following input andexplain

Page 67

68 CHAPTER 5. TABLEShexchars fcc /0123456789AaBbCcDdEeFf/hextrans fcb 0,1,2,3,4fcb 5,6,7,8,9fcb 10,10, 11,11, 12,12, 13,13, 14,14, 15,15nhexchars equ

Page 68

5.5. WORKING WITH TABLES 69out2bsp equ $ffc1outcrlf equ $ffc4outstrg equ $ffc7outstrgo equ $ffcainchar equ $ffcdvecinit equ $ffd0org $3000; setup some

Page 69

Chapter 1Introduction to HC111.1 ObjectiveTo become familiar with HC11 and using BUFFALO utilities, interacting usingthe terminal program, transferrin

Page 70

70 CHAPTER 5. TABLES; print 2 spaces so the output looks neatldaa #’ ’jsr outajsr outapula ; get it backjsr outajsr outcrlfbra mainloop;;;;;;;;;;;;;;;

Page 71

5.5. WORKING WITH TABLES 71lkplooptstbbeq notthere *this is the basic counting loopcmpa 0,xbeq founditinxdecbbra lkploopnotthereclcrtsfounditsecrtsExe

Page 72 - 72 CHAPTER 5. TABLES

72 CHAPTER 5. TABLESL 5U 8M 6

Page 73 - Timing using Polling

Chapter 6Timing using Polling6.1 ObjectiveIntroduces polling timer overflow flag to create a simple clock and to generateON-OFF output signals.6.2 Getti

Page 74

74 CHAPTER 6. TIMING USING POLLINGWe can use this to create a30.522Hz square wave by toggling an output pin everytime counter rolls over. Here is the

Page 75 - 6.3.1 Slowing it down

6.3. TIMING 756.3.1 Slowing it downIn the last exp eriment, we toggle the pin so fast that chances are you did notnotice the LED’s blink. We can slow

Page 76

76 CHAPTER 6. TIMING USING POLLING;NOW TOGGLE PA4LDAA #%00010000EORA PORTASTAA PORTA;DO IT ALL OVER AGAINBRA LOOP1

Page 77 - Interrupt Processing

Chapter 7Interrupt Processing7.1 ObjectiveTo become familiar with interrupt processing.7.2 BackgroundIn an earlier lab, you had to generate a 30.52 Hz

Page 78 - 7.3 Interrupts

78 CHAPTER 7. INTERRUPT PROCESSING; CLEAR THE FLAG. NO HARM IS DONE IF IT IS ALREADY CLEAREDLDAA #%10000000STAA TFLAG2;WAIT FOR THE FLAG TO BE SETLOOP

Page 79

7.3. INTERRUPTS 79(b) However, if the mask is set, then request for service is generated.i. The I bit in the CCR is a master disable switch. If this i

Page 80

8 CHAPTER 1. INTRODUCTION TO HC11CTRL-A Quit.BF <addr1> <addr2> [<data>] Block fill.BR [-][<addr>] Set up breakpoint table...

Page 81 - 7.4 The Real time interrupt

80 CHAPTER 7. INTERRUPT PROCESSING2. Write the service routine. As part of the service make sure you turn off theflag that generated the interrupt.3. Le

Page 82

7.4. THE REAL TIME INTERRUPT 81; INTERRUPT SERVICESERVICE; TOGGLE PA4LDAA #%00010000EORA PORTASTAA PORTA; TURN OFF THE FLAG!LDAA #%10000000STAA TFLG2;

Page 83 - 7.4.1 Exercises

82 CHAPTER 7. INTERRUPT PROCESSINGLast two bits of PACTL Time between interrupts00 4.096 ms (244.1 Hz)01 8.192 ms (122 Hz)10 16.384 ms (61 Hz)11 32.76

Page 84

7.4. THE REAL TIME INTERRUPT 83;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; INTERRUPT SERVICESERVICE; TOGGLE PA4LDAA #%00010000EORA PORTASTAA PORTA; TURN OFF

Page 85

84 CHAPTER 7. INTERRUPT PROCESSING7.5 The output compare interruptThe HC11 has 5 OCx interrupts. These are like alarm clocks. You set a desired’alarm’

Page 86

7.5. THE OUTPUT COMPARE INTERRUPT 85SERVICE; TOGGLE PA4LDAA #%00010000EORA PORTASTAA PORTA; TURN OFF THE FLAG!LDAA #%01000000 <= This is differentS

Page 87 - Signal Generation

86 CHAPTER 7. INTERRUPT PROCESSING;set the next interrupt to occur 2000 clock ticks after thisLDD TOC2 <= This is differentADDD #2000STD TOC2 <=

Page 88 - 8.4 500 Hz tone generator

Chapter 8Signal Generation8.1 ObjectiveTo become familiar with generating square waves.8.2 BackgroundIn an earlier lab, you had to generate a square w

Page 89

88 CHAPTER 8. SIGNAL GENERATION8.3 Variable frequency signal generatorIn this experiment, we will generate a square wave with frequency selected by th

Page 90

8.4. 500 HZ TONE GENERATOR 89SEILDD #1000STD ONTIMELDD #3000STD OFFTIMELDAA #%01000000STAA TMSK1CLI; Now go about your business of printing Z’sLDAA #’

Page 91

1.2. TASKS 9modify the memory, the command will first echo the value already in memory. Ifyou don’t want to change it, press the space bar, command wil

Page 92 - 8.6 Exercises

90 CHAPTER 8. SIGNAL GENERATIONRESTADDD TOC2STD TOC2 ; BUMP ALARM SETTING; TURN OFF THE FLAG!LDAA #%01000000STAA TFLG1RTI; Connect the service to the

Page 93 - Analog to Digital Conversion

8.5. VARIABLE FREQUENCY GENERATOR 91FDB 851, 804, 759, 716, 676OFFTIMETBLFDB 3409, 3217, 3037, 2866, 2706FDB 2554, 2410, 2275, 2147, 2027Note that it

Page 94 - 9.4 Decisions, decisions

92 CHAPTER 8. SIGNAL GENERATIONBefore AfterLDAA #’Z’ LOOPLOOP JSR OUTA JSR INPUTBRA LOOP TSTABEQ LOOPANDA #$0FTAB ; B HAS INDEXLDX #ONTIMETBLABXABXLDY

Page 95 - 9.5.2 Initiating a conversion

Chapter 9Analog to Digital Conversion9.1 ObjectiveTo become familiar with Analog to Digital Conversion.9.2 BackgroundIn this lab you will learn how to

Page 96 - 9.6 A trial dry run

94 CHAPTER 9. ANALOG TO DIGITAL CONVERSIONwhereD The converted digital valueV Measured voltageV RL Lower limit voltageV RH Upper limit voltageb· · ·c

Page 97

9.5. PROCESS OF TAKING A MEASUREMENT 95pins PE0-PE3 or the pins PE4-PE7. If you chose the first the group of pins thenthe voltage in PE0 will be conver

Page 98

96 CHAPTER 9. ANALOG TO DIGITAL CONVERSIONthis to 1 if you want scanning; or else, set it to zero. Bit #4 is the MULT bit. Setthis to 1 if you want mu

Page 99

9.7. A SIMPLE DIGITAL VOLTMETER 97scanning mode, there is no need to issue any new commands. Measure theinput voltage, V and compute255V5. Also note d

Page 100

98 CHAPTER 9. ANALOG TO DIGITAL CONVERSION4. Take a reading (this is easy!)LDAA ADR15. Convert it to decivolts by multiplying by 50 and then dividing

Page 101

9.7. A SIMPLE DIGITAL VOLTMETER 99TAB *COPY A TO BH2B.LTCMPB #10 *IS B < 10BLO H2B.DONE *IF SO WE ARE DONESUBB #10 *B <- B-10ADDA #6 *A <- A+

Commentaires sur ces manuels

Pas de commentaire