<var id="fnfpo"><source id="fnfpo"></source></var>
<rp id="fnfpo"></rp>

<em id="fnfpo"><object id="fnfpo"><input id="fnfpo"></input></object></em>
<em id="fnfpo"><acronym id="fnfpo"></acronym></em>
  • <th id="fnfpo"><track id="fnfpo"></track></th>
  • <progress id="fnfpo"><track id="fnfpo"></track></progress>
  • <tbody id="fnfpo"><pre id="fnfpo"></pre></tbody>

  • x
    x
    查看: 3811|回復: 1
    打印 上一主題 下一主題

    [提問] 51的startup.asm的問題

    [復制鏈接]
    跳轉到指定樓層
    樓主
    發表于 2011-4-11 17:02:48 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
    自己寫的startup.ASM文件為什么在有了main.c文件之后會失效?取消main.c就又正常了?

    ;===================================================================================
    #define __ASM_CODE__

    #include "compile_option.h"


    #include "DC_FSB.h"

    ;#include "variables.inc"


    #define SP_START 07h
    #define Ram_Start 08h
    #define Ram_End 03Fh


    NAME SEGMENT_CODE_START_UP ; Specify the name of the current module
    USING 0 ; use register bank 0
    ;===================================================================================
    ; Constants
    ;===================================================================================

    ;===================================================================================
    ; Variables
    ;===================================================================================
    ;#define BF_CHIP_MODE 2fh.3 ; 0 => chip, 1 => DEEMAX emulator (DC6688FSA/DC6688FS Family, Refer AppNote008)

    ;===================================================================================
    ; External reference
    ;===================================================================================
    EXTRN CODE (MAIN)
    ;EXTRN CODE (Delay_100ms)
    CSEG AT 0000H ; code segment start at 0000H
    USING 0 ; use register bank 0
    ;--------------------------------------
    ; Reset Vector 000h :
    ;--------------------------------------
    ORG 0h
    ljmp START_UP



    ;--------------------------------------
    ; user program is started here
    ;compile_option.h
    ;--------------------------------------

    ORG 80h
    public START_UP
    START_UP:
    #ifdef __DEBUG_MODE__
    mov 0A0h, #0
    #endif


    ;---------------------------------------------------
    ; select band 0 registers
    ;---------------------------------------------------
    clr RS0
    clr RS1

    ; ---------------------------------------------------
    ; OFF_ LED 1st
    ; ---------------------------------------------------
    ; lcall Delay_100ms
    MOV R0, #xPCCONL ;00 10 00 11
    MOV A, #00100011B ;PCCONL[1,0] 11 = counter A output
    MOVX @R0,A ;10 push pull O/P (PC1)
    ;00 input interrupt on falling edge (PC2, PC0)
    MOV R0, #xPORT_C
    MOV A, #00000000B ;0x00
    MOVX @R0,A

    ;---------------------------------------------------
    ; clear DPS_0 to make use of DPTR
    ;---------------------------------------------------
    ; mEnable_DPTR_0 ;DPS

    ;;---------------------------------------------------
    ;; disable all interrupt and clear all IRQ
    ;;---------------------------------------------------
    mov IE, #0
    ; disable counter A interrupt
    mov TCON, #0 ; clear Port A, Counter A, Timer 0, Timer 1 IRQ
    mov T2CON, #0 ; clear Timer 2 IRQ and reset timer config
    mov SCON0, #0 ; clear Serial 0 IRQ and reset serial control 0 config
    mov SCON1, #0 ; clear Serial 1 IRQ and reset serial control 1 config
    mov IP, #0 ; all interupt in low priority

    ;---------------------------------------------------
    ; Start + test
    ;---------------------------------------------------
    MOV A,#0 ; MATTHEW
    SETB ET2 ; Timer 2 overflow interrupt
    CLR IT0 ; falling edge trigger
    ; SETB EA
    CLR EX0

    ;;---------------------------------------------------
    ;; disable watchdog
    ;;---------------------------------------------------
    MOV R0, #xBTCON
    MOV A, #0xA8
    MOVX @R0,A

    ;---------------------------------------------------
    ; clear internal RAM
    ;
    ; note :
    ; - clear all direct accessable RAM from 00h
    ; - clear indirect RAM up to stack area
    ;---------------------------------------------------
    mov a, #Ram_Start ;08h
    mov R0, a

    clear_all_int_ram_loop:
    mov a, #000h
    mov @R0, a
    inc R0
    cjne R0, #Ram_End ,clear_all_int_ram_loop

    init_SP:
    ;---------------------------------------------------
    ; init Stack pointer
    ; note :
    ; - pre-incremented stack
    ; - because of software stack, it is better to
    ; init Stack pointer after clear RAM
    ;---------------------------------------------------
    ;mov SP, #(LOW (RI_STACK-1)) ; '-1' because of pre-increment
    mov SP, #SP_START ;

    ;all interrupts in low priority
    mov IP, #0

    ;clear IT0 for proper Port A interrupt function
    clr IT0

    MOV R0, #xPCCONL ;00 10 00 11
    MOV A, #00100011B ;PCCONL[1,0] 11 = counter A output
    MOVX @R0,A ;10 push pull O/P (PC1)
    ;00 input interrupt on falling edge (PC2, PC0)

    MOV R0, #xPORT_C ; PC[2] = INPUT MODE, INTERRUPT ON RISING
    MOV A, #00000000B ; 0x00 ; PC[1] = push pull output (IR)
    MOVX @R0,A ; PC[0] = push pull output (LED)

    CLR EX0
    ; sjmp $

    ljmp main

    ; =====================================================
    ; =====================================================
    ; =====================================================
    /*
    ISR_PORT_BC:
    ;ISR_PORT_A:
    CLR GF_SLEEP0

    MOV R0,#xPAPND
    MOV A,#0
    MOVX @R0,A

    ; MOV R0,#xPCPND
    ; MOV A,#0
    ; MOVX @R0,A

    ; CLR IE0 ;CLR PORTB, C INTERRUPT FLAG

    CLR EX0 ;PortB, C ext interrupt
    CLR IT0
    NOP
    RETI
    */
    ; =====================================================
    ; =====================================================
    ; =====================================================
    /*
    ISR_TIMER_2:
    CLR TF2
    RETI
    */
    ; =====================================================
    ; =====================================================

    #undef __ASM_CODE__
    end
    沙發
     樓主| 發表于 2011-4-11 17:03:14 | 只看該作者
    前面我;===================================================================================
    ; External reference
    ;===================================================================================
    EXTRN CODE (MAIN)
    EXTRN CODE (Delay_100ms)
    CSEG AT 0000H ; code segment start at 0000H
    USING 0
    后面就可以跳轉ljmp main

    前面已經用EXTRN CODE (MAIN) 進來了,
    后面我直接跳轉去ljmp main

    我在工程里面去掉main.c,那么這個start文件就能用。如果我一加上main.c的話,它就直接跳到main里面去了,不會經過這個start程序

    現在就是這個問題
    您需要登錄后才可以回帖 登錄 | 立即注冊

    本版積分規則

    關于我們  -  服務條款  -  使用指南  -  站點地圖  -  友情鏈接  -  聯系我們
    電子工程網 © 版權所有   京ICP備16069177號 | 京公網安備11010502021702
    快速回復 返回頂部 返回列表
    精品一区二区三区自拍图片区_国产成人亚洲精品_亚洲Va欧美va国产综合888_久久亚洲国产精品五月天婷