📄 82930c.cod
字号:
/*
* Copyright (c) 1995, Intel Corporation
*
* $Workfile: 82930c.cod $
* $Revision: 1.4 $
* $Modtime: 26 Aug 1996 08:56:08 $
*
* Purpose:
*
*
*
*
*
* Compiler:
*
* Ext Packages:
*
*
*
*/
##82930 WRITE#
@@REG_MNEM@ = $%cREG_VALUE$;
##82930 READ#
UserVar = @@REG_MNEM@;
##82930 OR#
@@REG_MNEM@ = @@REG_MNEM@ | $%cREG_VALUE$;
##82930 AND#
@@REG_MNEM@ = @@REG_MNEM@ & $%cREG_VALUE$;
##82930 XOR#
@@REG_MNEM@ = @@REG_MNEM@ ^ $%cREG_VALUE$;
##82930 TESTZ#
if (@@REG_MNEM@ == 0)
{
/* user code */
}
##82930 TESTNZ#
if (@@REG_MNEM@ != 0)
{
/*user code*/
}
##82930 IU#
#include <82930C.H>
/* Interrupt Control Unit */
$$ifn$IEN0
/* NO INTERRUPTS*/
$$end$
$$if$IEN0
/* **** Enabled interrupts in Interrupt Enable Register ****
**** 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$
$$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$
void init_special_interrupts(void)
{
IEN0=0X$$IEN0$;
IPL0=0X$$IPL0$;
IPL1=0X$$IPL1$;
IPH0=0X$$IPH0$;
IPH1=0X$$IPH1$;
SOFH=0X$$SOFH$;
}
void main(void)
{
init_special_interrupts( );
}
##82930 PCATMR#
#include <82930C.H>
/********************************************************************
PCA Timer/Counter
Clocking Source: $%4CMOD.1-2$Fosc/12$Fosc/4$Timer 0 Overflow$External input (ECI)$
Run Control: PCA Timer is $%eCCON.6$
$$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$
********************************************************************/
void InitPCATimer()
{
CR = 0; /*Turn off PCA timer to load count*/
CL = 0x$$CL$; /*Set PCA count (low byte)*/
CH = 0x$$CH$; /*Set PCA count (high byte)*/
$$if$ IEN0.6
EC = 1; /*Enable PCA global interrupt*/
$$end$
$$else$
EC = 0; /*Disable PCA global interrupt*/
$$end$
$$if$ CMOD.0
CMOD |= 0x01; /*Enable PCA overflow interrupt*/
$$end$
$$else$
CMOD &= 0xFE; /*Disable PCA overflow interrupt*/
$$end$
CMOD &= 0xF9; /*Set clocking input source*/
CMOD |= 0x$%4CMOD.1-2$00$02$04$06$;
$$if$ CMOD.7
CMOD |= 0x80; /*Set counter idle control*/
$$end$
$$else$
CMOD &= 0x7F; /*Clr counter idle control*/
$$end$
$$if$ CCON.6
CR = 1; /*Enable PCA Timer/Counter*/
$$end$
}
void main()
{
InitPCATimer();
}
##82930 PCAMODULE#
#include <82930C.H>
/********************************************************************
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$
********************************************************************/
void InitPCAModule$$PCAMODULE$()
{
$$if$ (PCATYPE == 7)
CMOD &= 0xBF; /*Disable watchdog mode to load compare value*/
$$end$
CCAPM$$PCAMODULE$ = 0x$$CCAPMx$;
$$if$ (PCATYPE == 4) || (PCATYPE == 5) || (PCATYPE == 7)
CCAP$$PCAMODULE$L = 0x$$CCAPxL$;
CCAP$$PCAMODULE$H = 0x$$CCAPxH$;
$$end$
$$if$ (PCATYPE == 6)
/*To change the value in CCAP$$PCAMODULE$L w/o*/
/* glitches write new value into CCAP$$PCAMODULE$H*/
CCAP$$PCAMODULE$H = 0x$$CCAPxL$;
$$end$
$$if$ (PCATYPE == 7)
CMOD |= 0x40; /*Enable watchdog mode*/
$$end$
}
void main()
{
InitPCAModule$$PCAMODULE$();
}
##82930 IO_P0#
#include <82930C.H>
/*
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$
*/
void init_io_ports(void)
{
P0=0X$$P0$;
}
void main(void)
{
init_io_ports( );
}
##82930 IO_P1#
#include <82930C.H>
/*
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
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$
*/
void init_io_ports(void)
{
P1=0X$$P1$;
}
void main(void)
{
init_io_ports( );
}
##82930 IO_P2#
#include <82930C.H>
/*
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
p2.0 = $%tP2_DIR.0$IN$OUT$
p2.1 = $%tP2_DIR.1$IN$OUT$
p2.2 = $%tP2_DIR.2$IN$OUT$
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -