⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 chap1.asm

📁 摩托罗拉Mc6811利程
💻 ASM
字号:
; Chapter 1 6811 assembly language programs; Jonathan W. Valvano; This software accompanies the book,; Embedded Microcomputer Systems: Real Time Interfacing; published by Brooks Cole, 1999;;Program 1.1. 6811 software that programs its internal EEPROM.PPROG  = 0x103B; *************erases all of 6811 EEPROM****************; returns RegA=FF if successfulEraseAll:      ldab #0x06       ; Bulk erase mode      stab PPROG      ; ERASE=1, ELAT=1, EEPRGM=0      stab 0xB600      ; write to any EEPROM address      incb            ; ERASE=1, ELAT=1, EEPRGM=1      stab PPROG      bsr  Wait10ms      clr  PPROG      rts; **********program 1 byte**************************; RegX points into $B600-$B7FF; RegA has data, returns actual data writtenProg: ldab #0x02         ; Byte program mode      stab PPROG         ; ERASE=0, ELAT=1, EEPRGM=0      staa 0,x           ; write to the EEPROM address      incb               ; ERASE=0, ELAT=1, EEPRGM=1      stab PPROG      bsr  Wait10ms      clr  PPROG      ldaa 0,x           ; actual value in EEPROM      rts  ; ***********Wait for 10 ms**********************Wait10ms: pshx              ldx  #3334    ; E clock=2MHzwloop: dex           ; 6 cycles*3334*0.5us/cycle=10ms       bne  wloop       pulx       rts; Program 1.11. Assembly definitions of the MC68HC11 I/O ports.PORTA equ  $1000  PA7 input/output, PA6-PA3 outputs, PA2-PA0 inputsPACTL equ  $1026  Bit 7(DDRA7) specifies whether PA7 is input or outputPORTB equ  $1004  PB7-PB0 are all read able outputs PORTC equ  $1003  PC7-PC0 can be input or outputDDRC  equ  $1007  Direction register for Port CPORTD equ  $1008  PD5-PD0 can be input or outputDDRD  equ  $1009  Direction register for Port DPORTE equ  $100A  PE7-PE0 are all inputsPIOC  equ  $1002  Parallel I/O Control Register; Program 1.14. Assembly software that reads from port A and writes to port B.; Program to implement a NOT gate; Port A are the 8 digital inputs and Port B are the 8 digital outputs; Software continuously repeats the following; 1) Read value from Port A; 2) Calculate the logical complement; 3) Write the result out to Port BNotGate ldaa PORTA   Read from Port A into Register A        coma         Logical complement        staa PORTB   Write from Register A to Port B        bra  NotGate; Program 1.16. Assembly software that initializes an I/O port to input.; MC68HC11A8    clr  DDRC; Program 1.18. Assembly software that reads from an I/O port input.; MC68HC11A8    ldaa PORTC    staa Happiness; Program 1.20. Assembly software that initializes an I/O port to output.; MC68HC11A8    ldaa #$0F    staa DDRC;Program 1.22. Assembly software that outputs an I/O port output.; MC68HC11A8    ldaa #$FF    staa PORTC; Program 1.24. Assembly subroutines that provide initialization, read and write access an I/O port.; MC68HC11A8Init staa DDRC     rtsSet  staa PORTC     rtsRead ldaa PORTC     rts; Program 1.26. Assembly subroutine that initializes the I/O port.; MC68HC11A8PORTC equ  $1003 ;I/O portDDRC  equ  $1007  init  ldaa #$F0  ;PC7-PC3 out      staa DDRC  ;PC3-PC0 in       rts; Program 1.27. Assembly program that implements the 4 bit NOT gate.; MC68HC11A8     org  $E000 ;ROMmain lds #$00FF ;SP=$00FF     bsr  init  ;ritualloop ldaa PORTC ;input     coma       ;logical not     lsla       ;shift     lsla     lsla     lsla     staa PORTC ;output     bra  loop  ;repeat     org  $FFFE     fdb  main  ;reset vector

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -