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

📄 appl1.a51

📁 8051实时操作系统
💻 A51
字号:
;**************

;* APPL1.A51  *

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

;

; iDCM 44 Sample Application: Part 1

;



$nolist

$include(dcx51a.ext)

$include(dcx51a.lit)

$include(dcx51a.mac)

$list



;

; Sample Application: Consists of Task 1 and Task 2, which do the following:

;

;  Task 1:                    Loop

;                               Wait on a timer 1 Overflow interrupt

;                             End Loop

;

;  Task 2:                    Loop

;                               Wait on the next 1-second time interval

;                               Toggle the green LED

;                             End Loop

;

;  To generate this sample, perform the following:

;

;  ASM51 APPL1.A51 DEBUG

;  RL51  DCM44I.LIB(DCM44_SPACE), APPL1.OBJ, DCX51I.LIB TO APPL1

;  OH    APPL1 TO APPL1.HEX

;

;  To execute on an Intel iRCB board, place a 2K x 8 SRAM into the empty    

;  universal memory site, and set the board for memory option B.  Next, 

;  use the Bitbus Monitor to download APPL1.HEX into the SRAM.  Upon reset,

;  tasks 1 and 2 will execute (and the green LED will start flashing).

;

;  APPL1 can also be executed out of EPROM, or by using an emulator, such as

;  ICE5100.

;



                  CSEG      AT 0FFF0H



ITD1:

%ITD(TASK1, 8, 081H, 000B, 02H, 01000B, ITD2)   

                                      ;TASK1   = Beginning PC Addr.

                                      ;8       = Stack length

                                      ;081H    = Function ID

                                      ;000B    = Choose any register bank

                                      ;02H     = Task priority

                                      ;01000B  = Assign Timer 1 int. 

                                      ;          to this task

                                      ;ITD2    = Next ITD/IDD



                  CSEG      AT 0FE00H



ITD2:

%ITD(TASK2, 8, 082H, 000B, 01H, 00000B, IDD) 

                                      ;TASK2   = Beginning PC Addr.

                                      ;8       = Stack length

                                      ;082H    = Function ID

                                      ;000B    = Choose any register bank

                                      ;01H     = Task priority

                                      ;00000B  = Assign no interrupts

                                      ;          to this task

                                      ;IDD     = next ITD/IDD





IDD:

%IDD(-10000, 0, 0, 0, 0F800H)         

                                      ;-10000  = 10 msec clock unit

                                      ;0       = Don't change clock priority

                                      ;0       = Leave buffer size = 20

                                      ;0       = No user-reserved data space

                                      ;0F800H  = Terminate ITD/IDD chain

                                      ;          unless another ITD/IDD exists

                                      ;          at 0F800H



; Equates

;

GREEN_LED           EQU    91H

;



; The code for Tasks 1 and 2 follows

;



TASK1:

  CLR   TR1                                     ;Stop Timer 1

  ORL   TMOD,#010H                              ;Set Timer 1 to Mode 1

  SETB  TR1                                     ;Start Timer 1

LOOP1:

  MOV   A,#INTERRUPT_EVENT                      ;Wait for next interrupt

  MOV   B,#WAIT_FOREVER                         ; indefinitely

  CALL  RQWAIT                                  ;

  SJMP  LOOP1                                   ;Repeat Loop





TASK2:

  CLR   GREEN_LED                               ;Turn off green LED

  MOV   A,#100                                  ;Set for 1 second intervals

  CALL  RQSETINTERVAL                           ;

LOOP2:

  MOV   A,#INTERVAL_EVENT                       ;Wait for next time interval

  MOV   B,#WAIT_FOREVER                         ; indefinitely

  CALL  RQWAIT                                  ;

  CPL   GREEN_LED                               ;Toggle green LED

  SJMP  LOOP2                                   ;Repeat Loop



END

⌨️ 快捷键说明

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