FMUSER Wirless Transmit Video And Audio More Easier !

[email protected] WhatsApp +8618078869184
Language

    Single-chip STARTUP.A51 file label and clear program content detailed

     

    "1. Label IDATALEN EQU 80H ; the length of IDATA memory in bytes. Here idatalen is just a label, which is not the same as IData! If you like, you can change the idatalen in this program into dog, pig and Playboy (in fact, my ideal is to live a pig like life without worrying about food and drink, carefree, but I can't do it). The above sentence means that where idatalen is used in the program, it can actually be regarded as the number 80h, You are absolutely right to use 80h instead of idatalen. The name idatalen is only used to make it easy to remember, indicating that it has a little relationship with IData, so that your program is not too long. If you used Playboy as the label, you will forget what Playboy means later. The range of IData is 0 ~ FFH. If you want to change to FFH, you can. 2。 Clear IF IDATALEN <> 0 MOV R0,#IDATALEN - 1 CLR A IDATALOOP: MOV @R0,A DJNZ R0,IDATALOOP For this paragraph, it is obvious that it is clearing. If idatalen = 80h above, it is clearing 0 ~ 7FH; If Your program is rewritten as: IDATALEN EQU 0100H ; It is to clear 0 ~ FFH. Also note the if statement, which will be discussed later. 2、 How to load this program as you wish Generally, considering this, it is often necessary to distinguish between power on reset and program reset in your design. Sometimes when the program is reset, you don't want some memory units to be cleared, so you can't do it without making some changes to startup.a51. The default is to automatically load this section of startup.a51. So you have to do this: Copy the original startup.a51 file in the Lib directory to the directory where your project is located, and then add the startup.a51 in your project directory to your project (in keil's integrated environment, I hope you know how to do this), and then modify the startup.a51. For example, change to: IDATALEN EQU 00H ; the length of IDATA memory in bytes. Then compile the link. In this way, your program will not contain the internal code to reset IData. Why? The function of the if statement mentioned above! When idatalen = 0 is defined, the reset code is skipped! //////////////////////////////////////////// Chinese description of startup.a51 ;------------------------------------------------------------------------------ ; Startup.a51: user power on initialization program ;------------------------------------------------------------------------------ ; ; User defined memory space for power on initialization ; ; Use the following equ command to define the memory space to be initialized with 0 during CPU reset ; ;; ; The absolute starting address of the space of IData memory is always 0; IDATALEN EQU 80H ; The number of bytes of IData memory space that needs to be initialized with 0 ; XDATASTART EQU 0H ; Absolute starting address of XDATA storage space XDATALEN EQU 0H ; The number of space bytes of XDATA memory to initialize with 0 ; PDATASTART EQU 0H ; Absolute starting address of the space of pdata memory PDATALEN EQU 0H ; The number of space bytes of pdata memory to be initialized with 0 ; ; Note: the space of IData memory physically includes the data and bit memory space of 8051 single chip microcomputer ; It is said that at least the memory space related to the C51 compiler runtime should be 0 initialized. Do you want to ;------------------------------------------------------------------------------ ; ; Reentry function simulation initialization ; ; The following defines the reentry function with the equ instruction to simulate the initialization of the stack pointer ; ; The stack space of the reentry function when using small memory mode IBPSTACK EQU 0 ; When using the small memory mode reentry function, set it to 1 IBPSTACKTOP EQU 0FFH+1 ; Set the top of the stack to the highest address + 1 ; ; Stack space of reentry function when using large memory mode; The stack space of the reentry function when using the large memory mode XBPSTACK EQU 0 ; When using the large memory mode reentry function, set it to 1 XBPSTACKTOP EQU 0FFFFH+1; Set the top of the stack to the highest address + 1 ; ; Stack space of reentry function when compact memory mode is used; The stack space of the reentry function when using compact memory mode PBPSTACK EQU 0 ; Set the compact memory mode reentry function to 1 PBPSTACKTOP EQU 0FFFFH+1; Set the top of the stack to the highest address + 1 ; ;------------------------------------------------------------------------------ ; ; Paging definition of 64K byte XDATA memory space when using compact memory mode ; ; The following uses the equ instruction to define the page address of pdata type variable in XDATA memory space ; When defining pfage with equ command, it must be consistent with the control parameters of L51 connection locator pdata command ; PPAGEENABLE EQU 0 ; When using a pdata type variable, set it to 1 PPAGE EQU 0 ; Define page number ; ;------------------------------------------------------------------------------ NAME ? C_ STARTUP; Module name is? C_ STAUTUP ? C_ C51STARTUP SEGMENT CODE ; code ? STACK SEGMENT IDATA ; stack RSEG ? STACK ; stack DS 1 EXTRNEXTRN CODE ((? C_ START)) ; Program start address PUBLIC ? C_ STARTUP CSEG AT 0x8000 ; Defining the starting address of the user program may be useful when using the mon51 emulator ? C_ STARTUP: LJMP STARTUP1 RSEG ? C_ C51STARTUP STARTUP1:: ; ; Initialize serial port MOV SCON,#40H MOV TMOD,#20H MOV TH1,#0fdH SETB TR1 CLR TI ; When the MCU is powered on, the IData memory is cleared. If it is not necessary to power on, the IData can log off the words between if and ifedn ; Or modify the length of the idtalen. In order to have the power down protection function, I don't know how long the idtalen is IF IDATALEN <> 0 MOV R0,#IDATALEN - 1 CLR A IDATALOOP: MOV @R0,A DJNZ R0,IDATALOOP ENDIF ; ; MCU power on XDATA memory reset if you do not need power on to reset XDATA, you can log off the words between if and ifedn ; Or modify the length of xdatalen IF XDATALEN <> 0 MOV DPTR,#XDATASTART MOV R7,#LOW ((XDATALEN) IF (LOW (XDATALEN) <> 0 MOV R6,#(HIGH (XDATALEN) +1 ELSE MOV R6,,#HIGH ((XDATALEN) ENDIF CLR A XDATALOOP: MOVX @DPTR,A INC DPTR DJNZ R7,XDATALOOP DJNZ R6,XDATALOOP ENDIF ; ; Send pdata memory page high address IF PAGEENABLE <> 0 MOV P2,#PPAGE ENDIF ; ; When the MCU is powered on, pdata memory is cleared. If it is not necessary to power on, XDATA can log off the words between if and ifedn ; Or modify the length of pdatalen IF PDATALEN <> 0 MOV R0,#PDATASTART MOV R7,#LOW (PDATALEN) CLR A PDATALOOP: MOVX @R0,A INC R0 DJNZ R7,PDATALOOP ENDIF ; ; Sets the stack space for reentry functions when using small memory mode IF IBPSTACK <> 0 EXTRN DATA (? C_ IBP) MOV ? C_ IBP,#LOW IBPSTACKTOP ENDIF ; ; Sets the stack space for reentry functions when using large memory mode IF XBPSTACK <> 0 EXTRN DATA (? C_ XBP) MOV ? C_ XBP,#HIGH XBPSTACKTOP MOV ? C_ XBP+1,#LOW XBPSTACKTOP ENDIF ; ; Sets the stack space for reentry functions when compact memory mode is used IF PBPSTACK <> 0 EXTRN DATA (C_ PBP) MOV ? C_ PBP,#LOW PBPSTACKTOP ENDIF ; ; Sets the starting address of the stack MOV SP,#? STACK-1 ; For example, MOV SP, #4fh; ; This code is required if you use L51_ BANK.A51 with Banking Mode 4 ; If your program uses mode 4 program grouping technology, please start the following program. Your program will not exceed 64K ; EXTRN CODE (? B_ SWITCH0) ; CALL ? B_ SWITCH0 ; init bank mechanism to code bank 0 ;; The program starts from the first group of bank 0 blocks ; Jump to user program main function LJMP ? C_ START END ; Linshengfeng, read the full text, original title: detailed explanation of the contents of MCU startup.a51 file Source: [micro signal: wujianying]_ Danpianji, WeChat official account: SCM Wu Jianying, please welcome to add attention! Please indicate the source of the article“

     

     

     

     

    List all Question

    Nickname

    Email

    Questions

    Our other product:

    Professional FM Radio Station Equipment Package

     



     

    Hotel IPTV Solution

     


      Enter email  to get a surprise

      fmuser.org

      es.fmuser.org
      it.fmuser.org
      fr.fmuser.org
      de.fmuser.org
      af.fmuser.org ->Afrikaans
      sq.fmuser.org ->Albanian
      ar.fmuser.org ->Arabic
      hy.fmuser.org ->Armenian
      az.fmuser.org ->Azerbaijani
      eu.fmuser.org ->Basque
      be.fmuser.org ->Belarusian
      bg.fmuser.org ->Bulgarian
      ca.fmuser.org ->Catalan
      zh-CN.fmuser.org ->Chinese (Simplified)
      zh-TW.fmuser.org ->Chinese (Traditional)
      hr.fmuser.org ->Croatian
      cs.fmuser.org ->Czech
      da.fmuser.org ->Danish
      nl.fmuser.org ->Dutch
      et.fmuser.org ->Estonian
      tl.fmuser.org ->Filipino
      fi.fmuser.org ->Finnish
      fr.fmuser.org ->French
      gl.fmuser.org ->Galician
      ka.fmuser.org ->Georgian
      de.fmuser.org ->German
      el.fmuser.org ->Greek
      ht.fmuser.org ->Haitian Creole
      iw.fmuser.org ->Hebrew
      hi.fmuser.org ->Hindi
      hu.fmuser.org ->Hungarian
      is.fmuser.org ->Icelandic
      id.fmuser.org ->Indonesian
      ga.fmuser.org ->Irish
      it.fmuser.org ->Italian
      ja.fmuser.org ->Japanese
      ko.fmuser.org ->Korean
      lv.fmuser.org ->Latvian
      lt.fmuser.org ->Lithuanian
      mk.fmuser.org ->Macedonian
      ms.fmuser.org ->Malay
      mt.fmuser.org ->Maltese
      no.fmuser.org ->Norwegian
      fa.fmuser.org ->Persian
      pl.fmuser.org ->Polish
      pt.fmuser.org ->Portuguese
      ro.fmuser.org ->Romanian
      ru.fmuser.org ->Russian
      sr.fmuser.org ->Serbian
      sk.fmuser.org ->Slovak
      sl.fmuser.org ->Slovenian
      es.fmuser.org ->Spanish
      sw.fmuser.org ->Swahili
      sv.fmuser.org ->Swedish
      th.fmuser.org ->Thai
      tr.fmuser.org ->Turkish
      uk.fmuser.org ->Ukrainian
      ur.fmuser.org ->Urdu
      vi.fmuser.org ->Vietnamese
      cy.fmuser.org ->Welsh
      yi.fmuser.org ->Yiddish

       
  •  

    FMUSER Wirless Transmit Video And Audio More Easier !

  • Contact

    Address:
    No.305 Room HuiLan Building No.273 Huanpu Road Guangzhou China 510620

    E-mail:
    [email protected]

    Tel / WhatApps:
    +8618078869184

  • Categories

  • Newsletter

    FIRST OR FULL NAME

    E-mail

  • paypal solution  Western UnionBank OF China
    E-mail:[email protected]   WhatsApp:+8618078869184   Skype:sky198710021 Chat with me
    Copyright 2006-2020 Powered By www.fmuser.org

    Contact Us