📄 spce061a.inc
字号:
//========================================================================================
//port define,written by wangwenyan,2001/12/29
//========================================================================================
// Program: Standard function definition
// Naming rule:
// F : function
// G : global variable
// M : module variable
// L : label
// C : define constant
// P : define I/O port
//
//========================================================================================
.IFNDEF __SPCE061A_INC__
.DEFINE __SPCE061A_INC__
//////////////////////////////////////////////////////////////////
// Define Area for I/O
//////////////////////////////////////////////////////////////////
//PortA,PortB contain some special functions
.DEFINE P_IOA_Data 0x7000; // Write Data into data register and read from IOA pad
.DEFINE P_IOA_Buffer 0x7001; // Write Data into buffer register and read from buffer register
.DEFINE P_IOA_Dir 0x7002; // Direction vector for IOA
.DEFINE P_IOA_Attrib 0x7003; // Attribute vector for IOA
.DEFINE P_IOA_Latch 0x7004; // Latch PortA data for key change wake-up
.DEFINE P_IOB_Data 0x7005; // Write Data into the data register and read from IOB pad
.DEFINE P_IOB_Buffer 0x7006; // Write Data into buffer register and read from buffer register
.DEFINE P_IOB_Dir 0x7007; // Direction vector for IOB
.DEFINE P_IOB_Attrib 0x7008; // Attribute vector for IOB
.DEFINE P_FeedBack 0x7009; // Clock form external R,C
.DEFINE P_TimerA_Data 0x700A; // Data port for TimerA
.DEFINE P_TimerA_Ctrl 0x700B; // Control Port for TimerA
.DEFINE P_TimerB_Data 0x700C; // Data port for TimerB
.DEFINE P_TimerB_Ctrl 0x700D; // Control Port for TimerB
.DEFINE P_TimeBase_Setup 0x700E; // TimerBase Freq. Set
.DEFINE P_TimeBase_Clear 0x700F; // Reset Timerbase counter
.DEFINE P_INT_Ctrl 0x7010; // for read INT flag(R)
.DEFINE P_INT_Clear 0x7011; // Clear interrupt source
.DEFINE P_INT_Mask 0x702D; //R/W INT enable/disable
// Define for P_INT_Ctrl
.DEFINE SpC_IRQ_TMB2 0x0001; //Timer B IRQ6
.DEFINE SpC_IRQ_TMB1 0x0002; //Timer A IRQ6
.DEFINE SpC_IRQ_2Hz 0x0004; //2Hz IRQ5
.DEFINE SpC_IRQ_4Hz 0x0008; //4Hz IRQ5
.DEFINE SpC_IRQ_1024Hz 0x0010; //1024Hz IRQ4
.DEFINE SpC_IRQ_2048Hz 0x0020; //2048 IRQ4
.DEFINE SpC_IRQ_4096Hz 0x0040; //4096 IRQ4
.DEFINE SpC_IRQ_KeyChange 0x0080; //Key Change IRQ3
.DEFINE SpC_IRQ_Ext1 0x0100; //Ext1 IRQ3
.DEFINE SpC_IRQ_Ext2 0x0200; //Ext2 IRQ3
.DEFINE SpC_IRQ_TimerB 0x0400; //Timer B IRQ2
.DEFINE SpC_FIQ_TimerB 0x0800; //Timer B FIQ
.DEFINE SpC_IRQ_TimerA 0x1000; //Timer A IRQ1
.DEFINE SpC_FIQ_TimerA 0x2000; //Timer A FIQ
.DEFINE SpC_IRQ_PWM 0x4000; //PWM IRQ0
.DEFINE SpC_FIQ_PWM 0x8000; //PWM FIQ
.DEFINE P_Watchdog_Clear 0x7012; // Watchdog Reset
.DEFINE P_SystemClock 0x7013; // Change system clock frequency(include go to standby mode)
.DEFINE P_ADC 0x7014; // Data Port for AD0
.DEFINE P_ADC_Ctrl 0x7015; // Control Port for AD control
.DEFINE P_ADC_Status 0x7015; // AD Port Status
.DEFINE P_DAC2 0x7016; // Data Port for DAC2
//.DEFINE P_PWM 0x7016; // Data Port for PWM
.DEFINE P_DAC1 0x7017; // Data Port for DAC1
.DEFINE P_IR_Ctrl 0x7018; // Control Port for IR
.DEFINE P_LVD_Ctrl 0x7019; // Control Port for LVD
.DEFINE P_SIO_Data 0x701A; // serial interface IO
.DEFINE P_SIO_Addr_Low 0x701B; // Address Port low
.DEFINE P_SIO_Addr_Mid 0x701C; // Address Port middle
.DEFINE P_SIO_Addr_High 0x701D; // Address Port high
.DEFINE P_SIO_Ctrl 0x701E; // Control Port
.DEFINE P_SIO_Start 0x701F; // Start port for serial interface
.DEFINE P_SIO_Stop 0x7020; // Stop port for serial interface
.define B_SIO_En 0x80
.define B_SIO_Write_En 0x40
.define B_SIO_WR_DisEn 0x20
.define C_SIO_Clk_16 0x00
.define C_SIO_Clk_4 0x08
.define C_SIO_Clk_8 0x10
.define C_SIO_Clk_32 0x18
.define C_SIO_Addr_Sel_16 0x00
.define C_SIO_Addr_Sel_0 0x01
.define C_SIO_Addr_Sel_8 0x02
.define C_SIO_Addr_Sel_24 0x03
//.define B_Busy 0x80
.DEFINE P_UART_Command1 0x7021; // Command1 Port for UART
.DEFINE P_UART_Command2 0x7022; // Command2 Port for UART
.DEFINE P_UART_Data 0x7023; // Data Port for UART
.DEFINE P_UART_BaudScalarLow 0x7024; // Set Baud Rate scalar low
.DEFINE P_UART_BaudScalarHigh 0x7025; // Set Baud Rate scalar high
//SPCE061A
.DEFINE P_DAC_Ctrl 0x702A; // Control Port for two DAC and audio output mode
.DEFINE P_ADC_MUX_Ctrl 0x702B; // Control Port for AD1 -- 7
.DEFINE P_ADC_MUX_Data 0x702C; // Data Port for AD1 -- 7
.DEFINE P_INT_Ctrl_New 0x702D; //R/W INT enable/disable
.DEFINE P_Flash_Ctrl 0x7555
// Define for P_TimerA_Ctrl, P_TimerB_Ctrl
.DEFINE SpC_Timer_Fosc_2 0x0000; // b0--b2: clock of source A
.DEFINE SpC_Timer_Fosc_256 0x0001; //
.DEFINE SpC_Timer_32768Hz 0x0002; //
.DEFINE SpC_Timer_8192Hz 0x0003; //
.DEFINE SpC_Timer_4096Hz 0x0004; //
.DEFINE SpC_Timer_A1 0x0005; //
.DEFINE SpC_Timer_A0 0x0006; //
.DEFINE SpC_Timer_Ext1 0x0007; //
.DEFINE SpC_Timer_2048Hz 0x0000; //b3--b5: clock of source B
.DEFINE SpC_Timer_1024Hz 0x0008; //
.DEFINE SpC_Timer_256Hz 0x0000; //
.DEFINE SpC_Timer_TMB1 0x0018; //
.DEFINE SpC_Timer_4Hz 0x0020; //
.DEFINE SpC_Timer_2Hz 0x0028; //
.DEFINE SpC_Timer_B1 0x0030; //
.DEFINE SpC_Timer_Ext2 0x0038; //
.DEFINE SpC_PWMO_Off 0x0000; //b6--b9: output pulse
.DEFINE SpC_PWMO_D1 0x0040; //
.DEFINE SpC_PWMO_D2 0x0080; //
.DEFINE SpC_PWMO_D3 0x00C0; //
.DEFINE SpC_PWMO_D4 0x0100; //
.DEFINE SpC_PWMO_D5 0x0140; //
.DEFINE SpC_PWMO_D6 0x0180; //
.DEFINE SpC_PWMO_D7 0x01C0; //
.DEFINE SpC_PWMO_D8 0x0200; //
.DEFINE SpC_PWMO_D9 0x0240; //
.DEFINE SpC_PWMO_D10 0x0280; //
.DEFINE SpC_PWMO_D11 0x02C0; //
.DEFINE SpC_PWMO_D12 0x0300; //
.DEFINE SpC_PWMO_D13 0x0340; //
.DEFINE SpC_PWMO_D14 0x0380; //
.DEFINE SpC_PWMO_Div_2 0x03C0; //
// Define for P_SystemClock
.DEFINE SpC_Fosc 0x0000; // b2..b0: frequency select
.DEFINE SpC_Fosc_Div_2 0x0001; //
.DEFINE SpC_Fosc_Div_4 0x0002; //
.DEFINE SpC_Fosc_Div_8 0x0003; // (default)
.DEFINE SpC_Fosc_Div_16 0x0004; //
.DEFINE SpC_Fosc_Div_32 0x0005; //
.DEFINE SpC_Fosc_Div_64 0x0006; //
.DEFINE SpC_Sleep 0x0007; //
.DEFINE SpC_32K_Work 0x0010; // b4 = 1: at sleep mode,32.768k still work
.DEFINE SpC_32K_Off 0x0000; // b4 = 0: at sleep mode,32.768k off
.DEFINE SpC_StrongMode 0x0008; // b3 = 1: force strong mode
.DEFINE SpC_AutoWeakMode 0x0000; // b3 = 0: auto weak mode(default)
.DEFINE SpC_PLL_Freq_24M 0x0000 //b5..b7: PLL frequency select
.DEFINE SpC_PLL_Freq_20M 0x0020 //
.DEFINE SpC_PLL_Freq_32M 0x0040 //
.DEFINE SpC_PLL_Freq_40M 0x0060 //
.DEFINE SpC_PLL_Freq_49M 0x0080 //
// Define for P_ADC_Ctrl
.DEFINE SpC_AD_Enable 0x0001; //b0=1: enable A/D converter
.DEFINE SpC_AD_Disable 0x0000; //b0=0: disable A/D converter
.DEFINE SpC_AD_Line_In 0x0002; //b1=1: line in input
.DEFINE SpC_AD_MIC_In 0x0000; //b1=0: microphone input
.DEFINE SpC_AGC_Enable 0x0004; //b2=1: enable AGC function
.DEFINE SpC_AGC_Disable 0x0000; //b2=0: disable AGC function
.DEFINE SpC_AD_Sample 0x0004; //b3=1: sample the analog signal(manual mode)
.DEFINE SpC_AD_Hold 0x0000; //b3=0: hold(manual mode)
.DEFINE SpC_Auto_Mode 0x0010; //b4=1: A/D auto mode
.DEFINE SpC_Manual_Mode 0x0000; //b4=0: A/D manual mode
//b5: ADINI?
.DEFINE SpC_DAC_Current_2mA 0x0040; //b6=1: DAC current = 2mA @ vdd=3V(new option)
.DEFINE SpC_DAC_Current_3mA 0x0000; //b6=0: DAC current = 3mA @ vdd=3V(Default)
.DEFINE SpC_AD_Vref_VDD 0x0080; //b7=1: Vref is VDD
.DEFINE SpC_AD_Vref_VRTPAD 0x0000; //b7=0: Vref is from pin "VRTPAD"
.DEFINE SpC_AD_COMP 0x4000; //b14=1: output voltage of DAC0<Analog input signal
//b14=0: output voltage of DAC0>Analog input signal
.DEFINE SpC_AD_RDY 0x4000; //b15=1: A/D digital data ready; 0: not ready
// Define for P_DAC_Ctrl
.DEFINE SpC_DAC1_Direct 0x0000; // b8 b7: DAC1 latch
.DEFINE SpC_DAC1_LatchA 0x0080; // Latch data to DAC1 by TimerA
.DEFINE SpC_DAC1_LatchB 0x0100; // Latch data to DAC1 by TimerB
.DEFINE SpC_DAC1_LatchAB 0x0180; // Latch data to DAC1 by TimerA or TimerB
.DEFINE SpC_DAC2_Direct 0x0000; // b6 b5: DAC2 latch
.DEFINE SpC_DAC2_LatchA 0x0020; // Latch data to DAC2 by TimerA
.DEFINE SpC_DAC2_LatchB 0x0040; // Latch data to DAC2 by TimerB
.DEFINE SpC_DAC2_LatchAB 0x0060; // Latch data to DAC2 by TimerA or TimerB
.DEFINE SpC_ADC_Direct 0x0000; // b4 b3: ADC latch
.DEFINE SpC_ADC_LatchA 0x0008; // Latch data to ADC by TimerA
.DEFINE SpC_ADC_LatchB 0x0010; // Latch data to ADC by TimerB
.DEFINE SpC_ADC_LatchAB 0x0018; // Latch data to ADC by TimerA or TimerB
// Define for P_LVD_Ctrl
.DEFINE SpC_LVD24V 0x0000; // LVD = 2.4V; b1b0
.DEFINE SpC_LVD28V 0x0001; // LVD = 2.8V
.DEFINE SpC_LVD32V 0x0002; // LVD = 3.2V
.DEFINE SpC_LVD36V 0x0003; // LVD = 3.6V
.ENDIF //__SPCE061A_INC__
//========================================================================================
// End of SPCE061A.inc
//========================================================================================
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -