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

📄 dcm44d.a51

📁 8051实时操作系统
💻 A51
📖 第 1 页 / 共 2 页
字号:
;*     ENTERED FROM:   All

;*

;*     CALLS:          None

;*

;*     ENTERS:         None

;*

;*     INPUTS:         None

;*

;*     MODIFIES:       None

;*

;*     DESTROYS:       Nothing

;*

;*     RETURNS:        Nothing

;*

;*     DESCRIPTION:    Loops

;*

;*     REGISTER BANK:  0

;*

;***************************************************************************



power_up_error:



        SJMP    power_up_error                  ;



$EJECT

;***************************************************************************

;*

;*     PROCEDURE:      INTERNAL_RAM_TEST

;*

;*     PURPOSE:        Test Internal RAM Reliability

;*

;*     CALLED FROM:    None

;*

;*     ENTERED FROM:   ROM_TEST

;*

;*     CALLS:          None

;*

;*     ENTERS:         EXTERNAL_RAM_TEST

;*

;*     INPUTS:         None

;*

;*     MODIFIES:       None

;*

;*     DESTROYS:       DPTR

;*                     A

;*                     R0

;*                     R1

;*                     R2

;*

;*     RETURNS:        Nothing

;*

;*     DESCRIPTION:    This program clears memory, marches a 1 thru

;*                     memory then marches a zero thru memory, except

;*                     for locations 0 - 7.

;*

;*             Register usage

;*                     R0      pointer to byte to be checked and modified at 00H

;*                     R1      new value of the bit to be tested

;*

;*             Memory Usage

;*                     R2      location to store past value of byte under test

;*                     R3      location to store initial byte value 

;*

;*             This section ends with the Red LED off and the green

;*             LED off indicating internal portion of 8044 tests OK

;*

;*     REGISTER BANK:  0

;*

;***************************************************************************



internal_ram_test:



        MOV     R0, #MINRAM             ;set up start addr

        SETB    F0                      ;set flag for zero walk

        CLR     A                       ;set up for walk of zero

        CPL     A

        

irt_walk_zeros:



        CLR     C                       ;set carry to introduce 0



irt_check_byte:



        RLC     A                       ;



        MOV     @R0, A                  ;write new byte to memory

        MOV     AR2, @R0                ;update check word

        CJNE    A, AR2, power_up_error

                                        ;if it has you have an power_up_error

                                        ;Note, CJNE will clear carry when

                                        ;  Equal condition results

        MOV     C, F0                   ;So move the flag bit to C

                                        ;  flag is 0 for ones walk, 1

                                        ;  for zeros walk

; check for finish of rotate of one bit

; If parity is zero, then the one or zero bit has moved into carry.

;  Otherwise, the one or zero bit is still moving.



        JB      P, irt_check_byte



; if one or zero bit has rotated all the way around, then move to next byte



        INC     R0

        CJNE    R0, #MAXRAM, irt_reset_byte

                                        ;Note that this effects carry.

; if address is not the maximum address, then continue

; Otherwise, check the walk test type:



        JNB     F0, irt_done            ;If flag 0 is set, then marches done;

        MOV     R0, #MINRAM             ;set up start addr

        CLR     F0                      ;Otherwise, clear flag for ones test

        CLR     A                       ; set for marching ones, A is 0H



irt_walk_ones:



        SETB    C                       ;Set carry to introduce 1

        SJMP    irt_check_byte



irt_reset_byte:



        JB      F0, irt_walk_zeros      ;If walking zeros, then set

        SJMP    irt_walk_ones



irt_done:



        CLR     RED_LED_BIT             ;Turn off red led



$EJECT

;***************************************************************************

;*

;*     PROCEDURE:      EXTERNAL_RAM_TEST

;*

;*     PURPOSE:        Test Instruction Set Operation

;*

;*     CALLED FROM:    None

;*

;*     ENTERED FROM:   Internal_Ram_Test

;*

;*     CALLS:          None

;*

;*     ENTERS:         RMX51_initialization

;*

;*     INPUTS:         None

;*

;*     MODIFIES:       None

;*

;*     DESTROYS:       DPTR

;*                     A

;*                     R0

;*                     R1

;*                     R2

;*

;*     RETURNS:        Nothing

;*

;*     DESCRIPTION:    This program clears memory, marches a 1 thru memory

;*                     then marches a zero thru memory

;*

;*             Register usage

;*                     DPTR    pointer to memory location

;*                     R0      pointer to low byte of DPTR

;*                     R1      pointer to high byte of DPTR

;*                     R2      register to store initial byte value

;*                     R3      register to store past value of byte under test

;*                     R1      new value of the bit to be tested

;*

;*             Memory Usage

;*                     R2      location to store past value of byte under test

;*                     R3      location to store initial byte value 

;*

;*

;*             This section ends with the Red LED off and the green

;*             LED on indicating internal portion of 8044 tests OK

;*

;*     REGISTER BANK:  0

;*

;***************************************************************************



external_ram_test:



        MOV     DPTR, #0                ;set up start addr

        SETB    F0                      ;set flag for zero walk

        CLR     A                       ;set up for walk of zero

        CPL     A



ert_walk_zeros:



        CLR     C                       ;set carry flag for ones march

                

ert_check_byte:



        RLC     A                       ;



        MOVX    @DPTR, A                ;write new byte to memory

        MOV     R2, A                   ;update check word

        MOVX    A, @DPTR                ;check to see if it has changed

        CJNE    A, AR2, power_up_error  ;if it has you have an power_up_error

                                        ;Note, CJNE will clear carry when

                                        ;  Equal condition results

        MOV     C, F0                   ;So move the flag bit to C

                                        ;  flag is 0 for ones walk, 1

                                        ;  for zeros walk



; check for finish of rotate of one bit

; If parity is zero, then the one or zero bit has moved into carry.

;  Otherwise, the one or zero bit is still moving.



        JB      P, ert_check_byte



; if one bit has rotated all the way around, then move to next byte



        INC     DPL

        MOV     R0, DPL

        CJNE    R0, #0, ert_reset_byte

; if low byte of address is not 0, then continue with same high byte

        INC     DPH

        MOV     R1, DPH                 ;Check for completion of last byte check

        CJNE    R1, #MAXPAGE, ert_reset_byte

                                        ;Note that this effects carry.

; if high byte of address is not the maximum address, then continue

; Otherwise, check the walk test type:



        JNB     F0, ert_done            ;If flag 0 is set, then marches done;

        MOV     DPTR, #0                ;set up start addr

        CLR     F0                      ;Otherwise, clear flag for ones test

        CLR     A                       ; set for marching ones, A is 0H



ert_walk_ones:



        SETB    C                       ;Set carry to introduce 1

        SJMP    ert_check_byte



ert_reset_byte:



        JB      F0, ert_walk_zeros      ;If walking zeros, then set

        SJMP    ert_walk_ones



ert_done:



        SETB    GRN_LED_BIT             ;Turn on green led

        MOV     SP, #7                  ;Set stack pointer to reset value

        LJMP    req_init                ;



END

⌨️ 快捷键说明

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