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

📄 chap7.asm

📁 Motorola 6812芯片开发的接口程序。
💻 ASM
字号:
; Chapter 7 6812 assembly language programs; Jonathan W. Valvano; This software accompanies the book,; Real Time Embedded Systems published by Brooks Cole;; Program 7.1. Assembly subroutine to output a character using the SCI port.; MC68HC812A4OutChar brclr SC0SR1,#$80,OutChar        staa  SC0DRL ;sci data        rts; Program 7.2. A second assembly subroutine to output a character using the SCI port.; MC68HC812A4OutChar staa SC0DRL ;sci datawait2   brclr SC0SR1,#$80,wait2        rts; Program 7.3. A third assembly subroutine to output a character using the SCI port.; MC68HC812A4OutChar staa SC0DRL ;sci datawait3   brclr SC0SR1,#$40,wait3        rts; Program 7.5. Assembly ritual to initialize the SCI port to accept receiver interrupts.; MC68HC812A4 and MC68HC912B32RITSCI sei       ;make atomic       ldd  #104 ;4800 baud       std  SC0BD       ldaa #00  ;M=0, 8 bit data       staa SC0CR1 ;1 stop       ldaa #$2C        staa SC0CR2       bsr  CLRQ ;Initialize FIFO       cli       ;Enable       rts; Program 7.6. Simple polling for receiver interrupts.; MC68HC812A4 and MC68HC912B32SCIHAN  brset SC0SR1,#$20,INSCI; Program 7.7. Polling for ones and zeros for receiver interrupts.; none for MC68HC812A4 and MC68HC912B32; Program 7.8. Assembly ISR for receiver interrupts.; MC68HC812A4 and MC68HC912B32INSCI ldaa SC0SR1 ;status        anda #$0E ;OR, NF, FE        bne  ERROR         ldaa SCDR ;data, ack        bsr  PutFifo ;Communicate        bcs  ERROR ;FIFO full?        rti; Program 7.10. Assembly ritual to initialize the SCI port to accept receiver and transmitter interrupts.; MC68HC812A4/MC68HC912B32Init  movw #104,SC0BD  ;9600      movb #$00,SC0CR1 ;mode      movb #$2c,SC0CR2 ;RDRF      jsr  RxInitFifo  ;empty      jsr  TxInitFifo  ;empty      cli      rtsProgram 7.11. Assembly subroutines called by the main program to perform serial I/O.; MC68HC812A4/MC68HC912B32InChar  jsr  RxGetFifo        beq  InChar        rtsOutChar jsr  TxPutFifo ;save        beq  OutChar  ;full?        movb #$AC,SC0CR2 ;arm        rts; Program 7.12. Assembly ISR for receiver and transmitter interrupts.; MC68HC812A4/MC68HC912B32SCIhdlr ldaa SC0SR1        anda #$20    ;check RDRF        beq  ChkTDRE ;Not RDRF InSCI   ldaa SC0DRL  ;ASCII code        bsr  RxPutFifoChkTDRE ldaa SC0SR1        anda #$80    ;check TDRE        beq  SCIdone ;Not TDREOutSCI  bsr  TxGetFifo        beq  nomore        staa SC0DRL   ;start next         bra  SCIdonenomore  movb #$2C,SC0CR2 ;disarmSCIdone rti; Program 7.13. Assembly functions for serial output using DTR synchronization.; MC68HC812A4 or MC68HC912B32;PT3/IC3 is DTROutChar brclr PORTT,#$08,OutChar        brclr SC0SR1,#$80,OutChar        staa SC0DRL ;sci data        rts

⌨️ 快捷键说明

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