📄 82930a.cod
字号:
/*
* Copyright (c) 1995, Intel Corporation
*
* $Workfile: 82930a.cod $
* $Revision: 1.6 $
* $Modtime: 19 Dec 1996 09:28:30 $
*
* Purpose:
*
*
*
*
*
* Compiler:
*
* Ext Packages:
*
*
*
*/
##82930 WRITE#
$$IF!STR$ REG_MNEM "CONFIG0"
mov @@REG_MNEM@, #$%aREG_VALUE$
$$END$
##82930 READ#
$$IF!STR$ REG_MNEM "CONFIG0"
mov UserVar, @@REG_MNEM@
$$END$
##82930 OR#
$$IF!STR$ REG_MNEM "CONFIG0"
orl @@REG_MNEM@, #$%aREG_VALUE$
$$END$
##82930 AND#
$$IF!STR$ REG_MNEM "CONFIG0"
anl @@REG_MNEM@, #$%aREG_VALUE$
$$END$
##82930 XOR#
$$IF!STR$ REG_MNEM "CONFIG0"
xrl @@REG_MNEM@, #$%aREG_VALUE$
$$END$
##82930 TESTZ#
$$IF!STR$ REG_MNEM "CONFIG0"
mov A, @@REG_MNEM@
jz
$$END$
##82930 TESTNZ#
$$IF!STR$ REG_MNEM "CONFIG0"
mov A, @@REG_MNEM@
jnz
$$END$
##82930 IU#
; Interrupt Control Unit
$$ifn$IEN0 &! IEN1
; NO INTERRUPTS ENABLED
$$end$
$$if$IEN0
; **** Enabled interrupts in Interrupt Enable Register 0 ****
; **** GLOBAL INTERRUPT MUST BE ENABLED FOR ANY OTHER
; **** INTERRUPT TO WORK!
$$if$IEN0.7
; GLOBAL INTERRUPT ENABLED
$$end$
$$ifN$IEN0.7
; GLOBAL INTERRUPT DISABLED ALL INTERRUPTS
; ARE DISABLED
$$end$
$$if$IEN0.0
; External interrupt 0
$$ifn$IPH0.0 &! IPL0.0
; Priority Level = 0
$$end$
$$ifn$IPH0.0 && IPL0.0
; Priority Level = 1
$$end$
$$if$IPH0.0 &! IPL0.0
; Priority Level = 2
$$end$
$$if$IPH0.0 && IPL0.0
; Priority Level = 3
$$end$
$$end$
$$if$IEN0.1
; Timer 0 interrupt
$$ifn$IPH0.1 &! IPL0.1
; Priority Level = 0
$$end$
$$ifn$IPH0.1 && IPL0.1
; Priority Level = 1
$$end$
$$if$IPH0.1 &! IPL0.1
; Priority Level = 2
$$end$
$$if$IPH0.1 && IPL0.1
; Priority Level = 3
$$end$
$$end$
$$if$IEN0.2
; External interrupt 1
$$ifn$IPH0.2 &! IPL0.2
; Priority Level = 0
$$end$
$$ifn$IPH0.2 && IPL0.2
; Priority Level = 1
$$end$
$$if$IPH0.2 &! IPL0.2
; Priority Level = 2
$$end$
$$if$IPH0.2 && IPL0.2
; Priority Level = 3
$$end$
$$end$
$$if$IEN0.3
; Timer 1 interrupt
$$ifn$IPH0.3 &! IPL0.3
; Priority Level = 0
$$end$
$$ifn$IPH0.3 && IPL0.3
; Priority Level = 1
$$end$
$$if$IPH0.3 &! IPL0.3
; Priority Level = 2
$$end$
$$if$IPH0.3 && IPL0.3
; Priority Level = 3
$$end$
$$end$
$$if$IEN0.4
; Serial Port interrupt
$$ifn$IPH0.4 &! IPL0.4
; Priority Level = 0
$$end$
$$ifn$IPH0.4 && IPL0.4
; Priority Level = 1
$$end$
$$if$IPH0.4 &! IPL0.4
; Priority Level = 2
$$end$
$$if$IPH0.4 && IPL0.4
; Priority Level = 3
$$end$
$$end$
$$if$IEN0.5
; Timer 2 interrupt
$$ifn$IPH0.5 &! IPL0.5
; Priority Level = 0
$$end$
$$ifn$IPH0.5 && IPL0.5
; Priority Level = 1
$$end$
$$if$IPH0.5 &! IPL0.5
; Priority Level = 2
$$end$
$$if$IPH0.5 && IPL0.5
; Priority Level = 3
$$end$
$$end$
$$if$IEN0.6
; PCA interrupt
$$ifn$IPH0.6 &! IPL0.6
; Priority Level = 0
$$end$
$$ifn$IPH0.6 && IPL0.6
; Priority Level = 1
$$end$
$$if$IPH0.6 &! IPL0.6
; Priority Level = 2
$$end$
$$if$IPH0.6 && IPL0.6
; Priority Level = 3
$$end$
$$end$
$$end$
$$if$IEN1
; **** Enabled interrupts in Interrupt Enable Register 1 ****
; **** GLOBAL INTERRUPT MUST BE ENABLED FOR ANY OTHER
; **** INTERRUPT TO WORK!
$$if$IEN1.0
; USB Any Start of Frame interrupt
$$ifn$IPH1.0 &! IPL1.0
; Priority Level = 0
$$end$
$$ifn$IPH1.0 && IPL1.0
; Priority Level = 1
$$end$
$$if$IPH1.0 &! IPL1.0
; Priority Level = 2
$$end$
$$if$IPH1.0 && IPL1.0
; Priority Level = 3
$$end$
$$end$
$$if$IEN1.1
; USB Function interrupt
$$ifn$IPH1.1 &! IPL1.1
; Priority Level = 0
$$end$
$$ifn$IPH1.1 && IPL1.1
; Priority Level = 1
$$end$
$$if$IPH1.1 &! IPL1.1
; Priority Level = 2
$$end$
$$if$IPH1.1 && IPL1.1
; Priority Level = 3
$$end$
$$end$
$$if$IEN1.2
; Global Suspend/Resume interrupt
$$ifn$IPH1.2 &! IPL1.2
; Priority Level = 0
$$end$
$$ifn$IPH1.2 && IPL1.2
; Priority Level = 1
$$end$
$$if$IPH1.2 &! IPL1.2
; Priority Level = 2
$$end$
$$if$IPH1.2 && IPL1.2
; Priority Level = 3
$$end$
$$end$
$$end$
$include (82930A.INC)
CSEG AT FF:0000h ; Use FF:4000h when compiling for 80C251SB target board
ljmp main
CSEG AT FF:0100h ; Use FF:4100h when compiling for 80C251SB target board
init_special_interrupts:
mov IEN0, #0$$IEN0$h ; Enable interrupts
mov IEN1, #0$$IEN1$h
mov SOFH, #0$$SOFH$h
mov IPL0, #0$$IPL0$h ; Set interrupts priority
mov IPH0, #0$$IPH0$h ; Set interrupts priority
mov IPL1, #0$$IPL1$h
mov IPH1, #0$$IPH1$h
ret
main:
lcall init_special_interrupts
;
; User application codes
;
end
##82930 PCATMR#
$include (82930A.INC)
CSEG AT FF:0000h ; Use FF:4000h when compiling for 80C251SB target board
ljmp main
CSEG AT FF:0100h ; Use FF:4100h when compiling for 80C251SB target board
; PCA Timer/Counter
; Clocking Source: $%4CMOD.1-2$Fosc/12$Fosc/4$Timer 0 Overflow$External input (ECI)$
; Run Control: PCA Timer is $%eCCON.2$
$$if$ CCON.6
$$if$ CMOD.7
; (halts during idle mode)
$$end$
$$end$
; Timer Count: $$Ch$$$CL.4-7$$$CL.0-3$h
$$if$ IEN0.6
; PCA global interrupt: enabled
$$if$ CMOD.0
; --Enable PCA overflow interrupt
$$end$
$$if$ (IEN0.7 == 0)
; NOTE: The global disable bit is clear;
; all interrupts are disabled.
$$end$
$$end$
init_pca_tmr:
clr CR ; Turn off PCA timer to load count
mov CL, #0$$CL$h ; Set PCA count (low byte)
mov Ch, #0$$Ch$h ; Set PCA count (high byte)
$$if$ IEN0.6
setb EC ; Enable PCA global interrupt
$$end$
$$else$
clr EC ; Disable PCA global interrupt
$$end$
$$if$ CMOD.0
orl CMOD, #01h ; Enable PCA overflow interrupt
$$end$
$$else$
anl CMOD, #0FEh ; Disable PCA overflow interrupt
$$end$
anl CMOD, #0F9h ; Set clocking input source
orl CMOD, #$%4CMOD.1-2$00$02$04$06$h
$$if$ CMOD.7
orl CMOD, #80h ; Set counter idle control
$$end$
$$else$
anl CMOD, #7Fh ; Clr counter idle control
$$end$
$$if$ CCON.6
setb CR ; Enable PCA Timer/Counter
$$end$
ret
main:
lcall init_pca_tmr
end
##82930 PCAMODULE#
$include (82930A.INC)
CSEG AT FF:0000h ; Use FF:4000h when compiling for 80C251SB target board
ljmp main
CSEG AT FF:0100h ; Use FF:4100h when compiling for 80C251SB target board
; PCA module $$PCAMODULE$
$$if$ (PCATYPE == 0)
; Disabled
$$end$
$$if$ (PCATYPE == 1)
; Capture Mode: trigger on a positive transition
$$end$
$$if$ (PCATYPE == 2)
; Capture Mode: trigger on a negative transition
$$end$
$$if$ (PCATYPE == 3)
; Capture Mode: trigger on a positive or negative transition
$$end$
$$if$ (PCATYPE == 4)
; Compare Mode: software timer
$$end$
$$if$ (PCATYPE == 5)
; Compare Mode: high-speed output
$$end$
$$if$ (PCATYPE == 6)
; Compare Mode: pulse width modulation
$$end$
$$if$ (PCATYPE == 7)
; Compare Mode: watchdog timer
$$end$
$$if$ (PCATYPE == 1) || (PCATYPE == 2) || (PCATYPE == 3)
$$if$ CCAPMx.0
; Interrupts: PCA capture enabled
$$ifn$ IEN0.6
; NOTE: The PCA global interrupt is disabled
$$end$
$$end$
$$end$
$$if$ (PCATYPE == 4) || (PCATYPE == 5) || (PCATYPE == 7)
$$if$ CCAPMx.0
; Interrupts: PCA compare is enabled
$$ifn$ IEN0.6
; NOTE: The PCA global interrupt is disabled
$$end$
$$end$
$$end$
init_pca_module$$PCAMODULE$:
$$if$ (PCATYPE == 7)
anl CMOD, #0BFh ; Disable watchdog mode to load compare value
$$end$
mov CCAPM$$PCAMODULE$, #0$$CCAPMx$h
$$if$ (PCATYPE == 4) || (PCATYPE == 5) || (PCATYPE == 7)
mov CCAP$$PCAMODULE$L, #0$$CCAPxL$h
mov CCAP$$PCAMODULE$h, #0$$CCAPxh$h
$$end$
$$if$ (PCATYPE == 6)
;To change the value in CCAP$$PCAMODULE$L w/o
; glitches write new value into CCAP$$PCAMODULE$h
mov CCAP$$PCAMODULE$h, #0$$CCAPxL$h
$$end$
$$if$ (PCATYPE == 7)
orl CMOD, #40h ; Enable watchdog mode
$$end$
ret
main:
lcall init_pca_module$$PCAMODULE$
end
##82930 IO_P0#
; Initialize the quasi-bidirectional port pins. To use these
; pins as inputs they must be written with a one.
; IO port pins:
; Alternate Functions are Address/Data for External Memory
; p0.0 = $%tP0_DIR.0$IN$OUT$
; p0.1 = $%tP0_DIR.1$IN$OUT$
; p0.2 = $%tP0_DIR.2$IN$OUT$
; p0.3 = $%tP0_DIR.3$IN$OUT$
; p0.4 = $%tP0_DIR.4$IN$OUT$
; p0.5 = $%tP0_DIR.5$IN$OUT$
; p0.6 = $%tP0_DIR.6$IN$OUT$
; p0.7 = $%tP0_DIR.7$IN$OUT$
$include (82930A.INC)
CSEG AT FF:0000h ; Use FF:4000h when compiling for 80C251SB target board
ljmp main
CSEG AT FF:0100h ; Use FF:4100h when compiling for 80C251SB target board
init_io_ports:
mov P0, #0$$P0$h ; Init Port 0
ret
main:
lcall init_io_ports
end
##82930 IO_P1#
; Initialize the quasi-bidirectional port pins. To use these
; pins as inputs they must be written with a one.
; IO port pins:
; p1.0 = $%tP1_DIR.0$IN$OUT$ ;Special Function T2CLK
; p1.1 = $%tP1_DIR.1$IN$OUT$ ;Special Function T2EX
; p1.2 = $%tP1_DIR.2$IN$OUT$ ;
; p1.3 = $%tP1_DIR.3$IN$OUT$ ;
; p1.4 = $%tP1_DIR.4$IN$OUT$ ;
; p1.5 = $%tP1_DIR.5$IN$OUT$ ;
; p1.6 = $%tP1_DIR.6$IN$OUT$ ;
; p1.7 = $%tP1_DIR.7$IN$OUT$ ;
$include (82930A.INC)
CSEG AT FF:0000h ; Use FF:4000h when compiling for 80C251SB target board
ljmp main
CSEG AT FF:0100h ; Use FF:4100h when compiling for 80C251SB target board
init_io_ports:
mov P1, #0$$P1$h ; Init Port 1
ret
main:
lcall init_io_ports
;
; User application codes
;
end
##82930 IO_P2#
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -