main.asm

来自「IIC MC9S12DG128 主机向从机写」· 汇编 代码 · 共 60 行

ASM
60
字号
;**************************************************************
;* This stationery serves as the framework for a              *
;* user application. For a more comprehensive program that    *
;* demonstrates the more advanced functionality of this       *
;* processor, please see the demonstration applications       *
;* located in the examples subdirectory of the                *
;* Freescale CodeWarrior for the HC12 Program directory       *
;**************************************************************

; export symbols
            XDEF Entry, main
            ; we use export 'Entry' as symbol. This allows us to
            ; reference 'Entry' either in the linker .prm file
            ; or from C/C++ later on

            XREF __SEG_END_SSTACK      ; symbol defined by the linker for the end of the stack

; include derivative specific macros
            INCLUDE 'mc9s12dg128.inc'



; variable/data section
MY_EXTENDED_RAM: SECTION
; Insert here your data definition.


; code section
MyCode:     SECTION
main:
Entry:                            

          SEI
START:    MOVB  #$60,IBFD
          BSET  IBSR,#$10                
          MOVB  #$FE,IBAD
A_START: 
          BCLR  IBCR,#$30;从机模式,接收模式 
          BSET  IBCR,#$40;开中断
          BSET  IBCR,#$80;使能IIC
          CLI
MAINLOOP:
          JMP MAINLOOP
         
         
         
         
         
         
IIC:  
       SEI
       BRSET IBSR,#$40,RECEIVE
    RTN:
       CLI
       RTI          
          
 RECEIVE:
        BRA  RTN         
        ORG  $FFC0
        FDB  IIC

⌨️ 快捷键说明

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