diff --git a/keilp/cc_as_stc02_ps5ws.uvprojx b/keilp/cc_as_stc02_ps5ws.uvprojx index 646f75d..8fa286e 100644 --- a/keilp/cc_as_stc02_ps5ws.uvprojx +++ b/keilp/cc_as_stc02_ps5ws.uvprojx @@ -380,11 +380,6 @@ 1 ..\source\msp\UART0.C - - iic_sim.c - 1 - ..\source\msp\iic_sim.c - msp_eeprom.c 1 @@ -400,11 +395,6 @@ bsp - - bsp_power.c - 1 - ..\source\bsp\bsp_power.c - bsp_cs1232.c 1 diff --git a/si4/ps5ws.si4project/soft_ps5ws.sip_sym b/si4/ps5ws.si4project/soft_ps5ws.sip_sym index 754f6e3..a283463 100644 Binary files a/si4/ps5ws.si4project/soft_ps5ws.sip_sym and b/si4/ps5ws.si4project/soft_ps5ws.sip_sym differ diff --git a/si4/ps5ws.si4project/soft_ps5ws.sip_xab b/si4/ps5ws.si4project/soft_ps5ws.sip_xab index c8b4f42..37cd650 100644 Binary files a/si4/ps5ws.si4project/soft_ps5ws.sip_xab and b/si4/ps5ws.si4project/soft_ps5ws.sip_xab differ diff --git a/si4/ps5ws.si4project/soft_ps5ws.sip_xad b/si4/ps5ws.si4project/soft_ps5ws.sip_xad index 9911101..c06c88f 100644 Binary files a/si4/ps5ws.si4project/soft_ps5ws.sip_xad and b/si4/ps5ws.si4project/soft_ps5ws.sip_xad differ diff --git a/si4/ps5ws.si4project/soft_ps5ws.sip_xc b/si4/ps5ws.si4project/soft_ps5ws.sip_xc index c159f36..2fe1158 100644 Binary files a/si4/ps5ws.si4project/soft_ps5ws.sip_xc and b/si4/ps5ws.si4project/soft_ps5ws.sip_xc differ diff --git a/si4/ps5ws.si4project/soft_ps5ws.sip_xf b/si4/ps5ws.si4project/soft_ps5ws.sip_xf index 50d7c65..2a0364c 100644 Binary files a/si4/ps5ws.si4project/soft_ps5ws.sip_xf and b/si4/ps5ws.si4project/soft_ps5ws.sip_xf differ diff --git a/si4/ps5ws.si4project/soft_ps5ws.sip_xm b/si4/ps5ws.si4project/soft_ps5ws.sip_xm index b50bf1b..38c549d 100644 Binary files a/si4/ps5ws.si4project/soft_ps5ws.sip_xm and b/si4/ps5ws.si4project/soft_ps5ws.sip_xm differ diff --git a/si4/ps5ws.si4project/soft_ps5ws.sip_xr b/si4/ps5ws.si4project/soft_ps5ws.sip_xr index 593a129..be75fe5 100644 Binary files a/si4/ps5ws.si4project/soft_ps5ws.sip_xr and b/si4/ps5ws.si4project/soft_ps5ws.sip_xr differ diff --git a/si4/ps5ws.si4project/soft_ps5ws.sip_xsb b/si4/ps5ws.si4project/soft_ps5ws.sip_xsb index 704a36f..a724f75 100644 Binary files a/si4/ps5ws.si4project/soft_ps5ws.sip_xsb and b/si4/ps5ws.si4project/soft_ps5ws.sip_xsb differ diff --git a/si4/ps5ws.si4project/soft_ps5ws.sip_xsd b/si4/ps5ws.si4project/soft_ps5ws.sip_xsd index 4b902b2..6d7a3b4 100644 Binary files a/si4/ps5ws.si4project/soft_ps5ws.sip_xsd and b/si4/ps5ws.si4project/soft_ps5ws.sip_xsd differ diff --git a/si4/ps5ws.si4project/soft_ps5ws.siproj b/si4/ps5ws.si4project/soft_ps5ws.siproj index 218c725..9c59e41 100644 Binary files a/si4/ps5ws.si4project/soft_ps5ws.siproj and b/si4/ps5ws.si4project/soft_ps5ws.siproj differ diff --git a/source/app/app_task_uart0.c b/source/app/app_task_uart0.c index 2560487..33c4acd 100644 --- a/source/app/app_task_uart0.c +++ b/source/app/app_task_uart0.c @@ -14,10 +14,6 @@ void L3_task_uart0_modbus_handler(TS_Handle_PH4 *ph4) { L3_ph4_common_handler((TS_PH4_modbus*)(ph4->buf)); } - else - { - L3_ph4_send_error_pkg(MODBUS_ERR_CRC); - } } } diff --git a/source/app/common.c b/source/app/common.c index 67fc94f..4235108 100644 --- a/source/app/common.c +++ b/source/app/common.c @@ -279,7 +279,7 @@ int L3_ph4_common_handler(TS_PH4_modbus *pmodbus) break; } default: - L3_ph4_send_error_pkg(MODBUS_ERR_OPCODE); + //L3_ph4_send_error_pkg(MODBUS_ERR_OPCODE); break; } return handlerStatus; diff --git a/source/app/main.c b/source/app/main.c index 4e60ae9..f2b970e 100644 --- a/source/app/main.c +++ b/source/app/main.c @@ -90,8 +90,8 @@ stc5ac32s void L0_main_init(void) { Lc_delay_ms(200); - L0_I2C_INIT(1); - L1_app_POWER_init(); + //L0_I2C_INIT(1); + //L1_app_POWER_init(); L1_uart0_buf_init();//串口初始化 EA = 1; Lc_delay_ms(100); @@ -99,7 +99,8 @@ void L0_main_init(void) L1_tick_init(); L0_timer0_Init(); L0_timer1_Init(); - L0_I2C_INIT(1); + L0_board_config() + //L0_I2C_INIT(1); //L2_task_ALGO_init(); } @@ -124,11 +125,11 @@ void main(void) //----------------------------------------------- //系统主循环 //----------------------------------------------- -#if 1 //看门狗 +#if 0 //看门狗 if(!L3_mcu_id_ok()) { - P35 = 0; - P10 = 0; + P54 = 0; + P17 = 0; while(1) { if(1 == s_nos_tick.t1s_heatbeart) @@ -146,7 +147,7 @@ void main(void) if(1 == s_nos_tick.t1s_heatbeart) { s_nos_tick.t1s_heatbeart = 0; - P35 ^= 1; + P54 ^= 1; } //单路采集 diff --git a/source/app/main.h b/source/app/main.h index dee4b58..ac25847 100644 --- a/source/app/main.h +++ b/source/app/main.h @@ -48,40 +48,16 @@ //#include "../msp/msp_buzz.h" //#include "../msp/msp_rtc.h" //#include "../msp/msp_plcd.h" -#include "../msp/iic_sim.h" +//#include "../msp/iic_sim.h" #include "../msp/msp_eeprom.h" #include "../msp/msp_id.h" - - -#include "../clib/Clib.h" -#include "../clib/bit.h" - -//#include "../debug/debug_drv.h" -//#include "../uartcom/uprotocol.h" -//#include "../uartcom/Uartcom0.h" -#include "../ctask/task.h" -#include "../ctask/tick.h" - -//#include "../bsp/bsp_led.h" - -#include "../bsp/bsp_power.h" - - -//#include "../bsp/Bsp_debug.h" - - -//#include "app_yeelink.h" -#include "app_flow.h" - -//#include "app_Gsensor.h" -//#include "app_io.h" +//#include "../clib/Clib.h" +//#include "../clib/bit.h" +//#include "../ctask/task.h" +//#include "../ctask/tick.h" #include "../tpc/tpc_uart.h" - -#include "stdio.h" -#include "app_paraid.h" -#include "app_algorithm.h"/// - - +//#include "stdio.h" +//#include "app_paraid.h" #include "../bsp/bsp_cs1232.h" #include "../bsp/bsp_485.h" #include "../app/app_task_uart0.h" diff --git a/source/bsp/bsp_485.c b/source/bsp/bsp_485.c index b2efe0e..f626864 100644 --- a/source/bsp/bsp_485.c +++ b/source/bsp/bsp_485.c @@ -4,5 +4,5 @@ void L2_485_init(void) { //485配置强推挽输出 P33 P32 //BITN_0(P3M1,BITN3);BITN_1(P3M0,BITN3); - BITN_0(P3M1,BITN2);BITN_1(P3M0,BITN2); + BITN_0(P5M1,BITN5);BITN_1(P5M0,BITN5); } \ No newline at end of file diff --git a/source/bsp/bsp_485.h b/source/bsp/bsp_485.h index 134dfa8..4bc2395 100644 --- a/source/bsp/bsp_485.h +++ b/source/bsp/bsp_485.h @@ -10,8 +10,8 @@ //485_RE P33 //485_DE P32 -#define D_485_TX() P32 = 1;// >750us -#define D_485_RX() P32 = 0; +#define D_485_TX() P55 = 1;// >750us +#define D_485_RX() P55 = 0; extern void L2_485_init(void); #endif \ No newline at end of file diff --git a/source/bsp/bsp_config.h b/source/bsp/bsp_config.h index 83a9f41..fc6e36c 100644 --- a/source/bsp/bsp_config.h +++ b/source/bsp/bsp_config.h @@ -51,6 +51,32 @@ #endif +#define D_SERVE_INT0 interrupt 0 +#define D_SERVE_TIMER0 interrupt 1 +#define D_SERVE_INT1 interrupt 2 +#define D_SERVE_TIMER1 interrupt 3 +#define D_SERVE_UART interrupt 4 +#define D_SERVE_ADC interrupt 5 +#define D_SERVE_LVD interrupt 6 +#define D_SERVE_PCA interrupt 7 +#define D_SERVE_UART2 interrupt 8 +#define D_SERVE_SPI interrupt 9 +#define D_SERVE_INT2 interrupt 10 +#define D_SERVE_INT3 interrupt 11 +#define D_SERVE_TIMER2 interrupt 12 +#define D_SERVE_INT4 interrupt 16 +#define D_SERVE_UART3 interrupt 17 +#define D_SERVE_UART4 interrupt 18 + +#define D_SERVE_TIMER3 interrupt 19 +#define D_SERVE_TIMER4 interrupt 20 +#define D_SERVE_CMP interrupt 21 +#define D_SERVE_PWM interrupt 22 +#define D_SERVE_PWMFD interrupt 23 +#define D_SERVE_I2C interrupt 24 + + + #if 0 #define D_debug_sim #endif @@ -81,7 +107,11 @@ #include #include - #include "../cpu/STC_stc8a8k.h" + //#include "../cpu/STC_stc8a8k.h" + #include "../cpu/stc_stc8hxx.h" + #include "../cpu/stc_macro.h" + +#define D_MCU_SPEC_PARAM_CHIPID 0xBFF9 #if 0//// 烧写配置 . 内部IRC振荡器的频率: 22.128MHz @@ -120,7 +150,6 @@ SPI IIC T0-T4 5个定时器 掉电唤醒专用定时器 比较器 内部电压检测中断 看门狗 tssop20 1.2元人民币 #endif - #include "../cpu/c51_macro.h" #define D_MCLKO_DIV2 2 #define D_MCLKO_DIV4 4 #define D_MCLKO_DIV8 6 @@ -244,18 +273,18 @@ L1_tick_tick ///<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<****/ -#define D_IO_LED1_OFF() D_P35_OFF() -#define D_IO_LED2_OFF() D_P34_OFF() -#define D_IO_485_RE_OFF() D_P33_OFF() -#define D_IO_485_DE_OFF() D_P32_OFF() +#define D_IO_LED1_OFF() D_P17_OFF() +#define D_IO_LED2_OFF() D_P54_OFF() +#define D_IO_485_RE_OFF() D_P55_OFF() +#define D_IO_485_DE_OFF() //D_P55_OFF() #define D_IO_LED1_INIT() ///D_P35_INIT() #define D_IO_LED2_INIT() ///D_P34_INIT() #define D_IO_485_RE_INIT() ///D_P33_INIT() #define D_IO_485_DE_INIT() ///D_P32_INIT() -#define D_IO_LED1_ON() D_P35_ON() -#define D_IO_LED2_ON() D_P34_ON() -#define D_IO_485_RE_ON() D_P33_ON() -#define D_IO_485_DE_ON() D_P32_ON() +#define D_IO_LED1_ON() D_P17_ON() +#define D_IO_LED2_ON() D_P54_ON() +#define D_IO_485_RE_ON() D_P55_ON() +#define D_IO_485_DE_ON() //D_P32_ON() ////////////////////////////////sim iic config @@ -266,6 +295,15 @@ L1_tick_tick #define L0_IIC_SIM_close() BITN_1(P3M1,5);BITN_0(P3M0,5);\ BITN_1(P3M1,4);BITN_0(P3M0,4); +#define L0_board_config() D_stdIO_P1(BITN7);D_stdIO_P5(BITN4);\ + D_stdIO_P1(BITN0);D_stdIO_P1(BITN1);\ + D_stdIO_P1(BITN2);D_stdIO_P1(BITN6);\ + D_stdIO_P3(BITN2);D_stdIO_P3(BITN3);\ + D_stdIO_P3(BITN4);D_stdIO_P3(BITN5);\ + D_stdIO_P3(BITN6);D_stdIO_P3(BITN7); + + + #if 10 #define L0_SDA_ON() D_P34_ON() #define L0_SDA_OFF() D_P34_OFF() @@ -329,7 +367,8 @@ if(BITN_G(DR_who_wakeup, DRB_who_wakeup_timer0)) #include #include - #include "../cpu/STC_stc8a8k.h" + //#include "../cpu/STC_stc8a8k.h" + #include "../cpu/stc_stc8hxx.h" #define D_CPUfamily_type D_CPUfamily_8bits diff --git a/source/bsp/bsp_cs1232.h b/source/bsp/bsp_cs1232.h index f9b375a..c907d7e 100644 --- a/source/bsp/bsp_cs1232.h +++ b/source/bsp/bsp_cs1232.h @@ -90,45 +90,44 @@ P3.1 TXD0 12 P3.0 RXD0 11 *****************/ - -#define D_ADC_DOUT1_INIT() ///D_P16_INIT() -#define D_ADC_SCLK1_INIT() ///D_P17_INIT() +#define D_ADC_DOUT1_INIT() ///D_P17_INIT() +#define D_ADC_SCLK1_INIT() ///D_P16_INIT() #define D_ADC_CS_A0_INIT() ///D_P55_INIT() -#define D_ADC_DOUT1_AT() D_P14_AT() -#define D_ADC_DOUT1_ON() D_P14_ON() -#define D_ADC_SCLK1_ON() D_P15_ON();D_adc_delay2(); -#define D_ADC_CS_A0_ON() D_P55_ON() -#define D_ADC_DOUT1_OFF() D_P14_OFF() -#define D_ADC_SCLK1_OFF() D_P15_OFF();D_adc_delay(); -#define D_ADC_CS_A0_OFF() D_P55_OFF() +#define D_ADC_DOUT1_AT() D_P36_AT() +#define D_ADC_DOUT1_ON() D_P36_ON() +#define D_ADC_SCLK1_ON() D_P35_ON();D_adc_delay2(); +#define D_ADC_CS_A0_ON() //D_P55_ON() +#define D_ADC_DOUT1_OFF() D_P36_OFF() +#define D_ADC_SCLK1_OFF() D_P35_OFF();D_adc_delay(); +#define D_ADC_CS_A0_OFF() //D_P55_OFF() //#define D_ADC_CS2_A0_ON() D_P13_ON() -#define D_ADC_DOUT2_ON() D_P16_ON() -#define D_ADC_DOUT2_AT() D_P16_AT() -#define D_ADC_SCLK2_ON() D_P17_ON();D_adc_delay2(); +#define D_ADC_DOUT2_ON() D_P10_ON() +#define D_ADC_DOUT2_AT() D_P10_AT() +#define D_ADC_SCLK2_ON() D_P16_ON();D_adc_delay2(); //#define D_ADC_CS2_A0_INIT() ///D_P13_INIT() #define D_ADC_DOUT2_INIT() ///D_P14_IN() ///D_P14_INIT() #define D_ADC_SCLK2_INIT() ///D_P15_INIT() //#define D_ADC_CS2_A0_OFF() D_P13_OFF() -#define D_ADC_DOUT2_OFF() D_P16_OFF() -#define D_ADC_SCLK2_OFF() D_P17_OFF();D_adc_delay(); +#define D_ADC_DOUT2_OFF() D_P10_OFF() +#define D_ADC_SCLK2_OFF() D_P16_OFF();D_adc_delay(); #define D_ADC_DOUT3_INIT() ///D_P11_INIT() #define D_ADC_SCLK3_INIT() ///D_P13_INIT() -#define D_ADC_DOUT3_AT() D_P11_AT() -#define D_ADC_DOUT3_ON() D_P11_ON() -#define D_ADC_SCLK3_ON() D_P13_ON();D_adc_delay2(); -#define D_ADC_DOUT3_OFF() D_P11_OFF() -#define D_ADC_SCLK3_OFF() D_P13_OFF();D_adc_delay(); +#define D_ADC_DOUT3_AT() D_P37_AT() +#define D_ADC_DOUT3_ON() D_P37_ON() +#define D_ADC_SCLK3_ON() D_P34_ON();D_adc_delay2(); +#define D_ADC_DOUT3_OFF() D_P37_OFF() +#define D_ADC_SCLK3_OFF() D_P34_OFF();D_adc_delay(); #define D_ADC_DOUT4_INIT() ///D_P34_INIT() #define D_ADC_SCLK4_INIT() ///D_P33_INIT() -#define D_ADC_DOUT4_AT() D_P34_AT() -#define D_ADC_DOUT4_ON() D_P34_ON() -#define D_ADC_SCLK4_ON() D_P33_ON();D_adc_delay2(); -#define D_ADC_DOUT4_OFF() D_P34_OFF() -#define D_ADC_SCLK4_OFF() D_P33_OFF();D_adc_delay(); +#define D_ADC_DOUT4_AT() D_P33_AT() +#define D_ADC_DOUT4_ON() D_P33_ON() +#define D_ADC_SCLK4_ON() D_P32_ON();D_adc_delay2(); +#define D_ADC_DOUT4_OFF() D_P33_OFF() +#define D_ADC_SCLK4_OFF() D_P32_OFF();D_adc_delay(); @@ -137,14 +136,14 @@ P3.0 RXD0 11 #define D_ADC_TEMP_INIT() ///D_P12_INIT() -#define D_ADC_TEMP_ON() D_P12_ON() -#define D_ADC_TEMP_OFF() D_P12_OFF() +#define D_ADC_TEMP_ON() //D_P12_ON() +#define D_ADC_TEMP_OFF() //D_P12_OFF() #define D_ADC_PDWN_INIT() ///D_P54_INIT() -#define D_ADC_PDWN_OFF() D_P54_OFF() -#define D_ADC_PDWN_ON() D_P54_ON() +#define D_ADC_PDWN_OFF() D_P11_OFF() +#define D_ADC_PDWN_ON() D_P11_ON() @@ -152,10 +151,10 @@ P3.0 RXD0 11 #define D_ADC_GAIN1_INIT() ///D_P37_INIT() #define D_ADC_GAIN0_INIT() ///D_P36_INIT() -#define D_ADC_GAIN1_OFF() D_P37_OFF() -#define D_ADC_GAIN0_OFF() D_P36_OFF() -#define D_ADC_GAIN1_ON() D_P37_ON() -#define D_ADC_GAIN0_ON() D_P36_ON() +#define D_ADC_GAIN1_OFF() //D_P37_OFF() +#define D_ADC_GAIN0_OFF() D_P12_OFF() +#define D_ADC_GAIN1_ON() //D_P37_ON() +#define D_ADC_GAIN0_ON() D_P12_ON() // #define D_ADS1213_GAIN_VAL 1 // #define D_ADS1213_GAIN_VAL 2 diff --git a/source/clib/type.h b/source/clib/type.h index a07b789..8708996 100644 --- a/source/clib/type.h +++ b/source/clib/type.h @@ -268,8 +268,8 @@ typedef struct #define HIGHT 1 #define LOW 0 -#ifndef MIN -#define MIN(a,b) (((a) < (b)) ? (a) : (b)) +#ifndef __MIN +#define __MIN(a,b) (((a) < (b)) ? (a) : (b)) #endif #ifndef MAX diff --git a/source/cpu/stc_macro.H b/source/cpu/stc_macro.H new file mode 100644 index 0000000..8c2f880 --- /dev/null +++ b/source/cpu/stc_macro.H @@ -0,0 +1,384 @@ +////////////////////////////////////////////////////////////////////////// +/// COPYRIGHT NOTICE +/// Copyright (c) 2018, 传控科技 +/// All rights reserved. +/// +/// @file __C51_MACRO_H_ +/// @brief macro define 和cpu相关,可以和同一个系列的cpu共享 +/// +///(本文件实现的功能的详述) +/// +/// @version 1.1 CCsens technology +/// @author CC +/// @date 20180102 + +// +////////////////////////////////////////////////////////////////////////// + + + +#ifndef __STC_MACRO_H_ +#define __STC_MACRO_H_ + +#include +#include "../clib/bit.h" + +#define NOP() _nop_() + +#define D_P07_ON() P07 = 1 +#define D_P06_ON() P06 = 1 +#define D_P05_ON() P05 = 1 +#define D_P04_ON() P04 = 1 +#define D_P03_ON() P03 = 1 +#define D_P02_ON() P02 = 1 +#define D_P01_ON() P01 = 1 +#define D_P00_ON() P00 = 1 +#define D_P07_OFF() P07 = 0 +#define D_P06_OFF() P06 = 0 +#define D_P05_OFF() P05 = 0 +#define D_P04_OFF() P04 = 0 +#define D_P03_OFF() P03 = 0 +#define D_P02_OFF() P02 = 0 +#define D_P01_OFF() P01 = 0 +#define D_P00_OFF() P00 = 0 +#define D_P07_AT() (P07) +#define D_P06_AT() (P06) +#define D_P05_AT() (P05) +#define D_P04_AT() (P04) +#define D_P03_AT() (P03) +#define D_P02_AT() (P02) +#define D_P01_AT() (P01) +#define D_P00_AT() (P00) +#define D_P07_REV() P07 = ~P07 +#define D_P06_REV() P06 = ~P06 +#define D_P05_REV() P05 = ~P05 +#define D_P04_REV() P04 = ~P04 +#define D_P03_REV() P03 = ~P03 +#define D_P02_REV() P02 = ~P02 +#define D_P01_REV() P01 = ~P01 +#define D_P00_REV() P00 = ~P00 + + +#define D_P17_ON() P17 = 1 +#define D_P16_ON() P16 = 1 +#define D_P15_ON() P15 = 1 +#define D_P14_ON() P14 = 1 +#define D_P13_ON() P13 = 1 +#define D_P12_ON() P12 = 1 +#define D_P11_ON() P11 = 1 +#define D_P10_ON() P10 = 1 +#define D_P17_OFF() P17 = 0 +#define D_P16_OFF() P16 = 0 +#define D_P15_OFF() P15 = 0 +#define D_P14_OFF() P14 = 0 +#define D_P13_OFF() P13 = 0 +#define D_P12_OFF() P12 = 0 +#define D_P11_OFF() P11 = 0 +#define D_P10_OFF() P10 = 0 +#define D_P17_AT() (P17) +#define D_P16_AT() (P16) +#define D_P15_AT() (P15) +#define D_P14_AT() (P14) +#define D_P13_AT() (P13) +#define D_P12_AT() (P12) +#define D_P11_AT() (P11) +#define D_P10_AT() (P10) +#define D_P17_REV() P17 = ~P17 +#define D_P16_REV() P16 = ~P16 +#define D_P15_REV() P15 = ~P15 +#define D_P14_REV() P14 = ~P14 +#define D_P13_REV() P13 = ~P13 +#define D_P12_REV() P12 = ~P12 +#define D_P11_REV() P11 = ~P11 +#define D_P10_REV() P10 = ~P10 + +#define D_P27_ON() P27 = 1 +#define D_P26_ON() P26 = 1 +#define D_P25_ON() P25 = 1 +#define D_P24_ON() P24 = 1 +#define D_P23_ON() P23 = 1 +#define D_P22_ON() P22 = 1 +#define D_P21_ON() P21 = 1 +#define D_P20_ON() P20 = 1 +#define D_P27_OFF() P27 = 0 +#define D_P26_OFF() P26 = 0 +#define D_P25_OFF() P25 = 0 +#define D_P24_OFF() P24 = 0 +#define D_P23_OFF() P23 = 0 +#define D_P22_OFF() P22 = 0 +#define D_P21_OFF() P21 = 0 +#define D_P20_OFF() P20 = 0 +#define D_P27_AT() (P27) +#define D_P26_AT() (P26) +#define D_P25_AT() (P25) +#define D_P24_AT() (P24) +#define D_P23_AT() (P23) +#define D_P22_AT() (P22) +#define D_P21_AT() (P21) +#define D_P20_AT() (P20) +#define D_P27_REV() P27 = ~P27 +#define D_P26_REV() P26 = ~P26 +#define D_P25_REV() P25 = ~P25 +#define D_P24_REV() P24 = ~P24 +#define D_P23_REV() P23 = ~P23 +#define D_P22_REV() P22 = ~P22 +#define D_P21_REV() P21 = ~P21 +#define D_P20_REV() P20 = ~P20 + + +#define D_P37_ON() P37 = 1 +#define D_P36_ON() P36 = 1 +#define D_P35_ON() P35 = 1 +#define D_P34_ON() P34 = 1 +#define D_P33_ON() P33 = 1 +#define D_P32_ON() P32 = 1 +#define D_P31_ON() P31 = 1 +#define D_P30_ON() P30 = 1 +#define D_P37_OFF() P37 = 0 +#define D_P36_OFF() P36 = 0 +#define D_P35_OFF() P35 = 0 +#define D_P34_OFF() P34 = 0 +#define D_P33_OFF() P33 = 0 +#define D_P32_OFF() P32 = 0 +#define D_P31_OFF() P31 = 0 +#define D_P30_OFF() P30 = 0 +#define D_P37_AT() (P37) +#define D_P36_AT() (P36) +#define D_P35_AT() (P35) +#define D_P34_AT() (P34) +#define D_P33_AT() (P33) +#define D_P32_AT() (P32) +#define D_P31_AT() (P31) +#define D_P30_AT() (P30) +#define D_P37_REV() P37 = ~P37 +#define D_P36_REV() P36 = ~P36 +#define D_P35_REV() P35 = ~P35 +#define D_P34_REV() P34 = ~P34 +#define D_P33_REV() P33 = ~P33 +#define D_P32_REV() P32 = ~P32 +#define D_P31_REV() P31 = ~P31 +#define D_P30_REV() P30 = ~P30 + + +#define D_P47_ON() P47 = 1 +#define D_P46_ON() P46 = 1 +#define D_P45_ON() P45 = 1 +#define D_P44_ON() P44 = 1 +#define D_P43_ON() P43 = 1 +#define D_P42_ON() P42 = 1 +#define D_P41_ON() P41 = 1 +#define D_P40_ON() P40 = 1 +#define D_P47_OFF() P47 = 0 +#define D_P46_OFF() P46 = 0 +#define D_P45_OFF() P45 = 0 +#define D_P44_OFF() P44 = 0 +#define D_P43_OFF() P43 = 0 +#define D_P42_OFF() P42 = 0 +#define D_P41_OFF() P41 = 0 +#define D_P40_OFF() P40 = 0 +#define D_P47_AT() (P47) +#define D_P46_AT() (P46) +#define D_P45_AT() (P45) +#define D_P44_AT() (P44) +#define D_P43_AT() (P43) +#define D_P42_AT() (P42) +#define D_P41_AT() (P41) +#define D_P40_AT() (P40) +#define D_P47_REV() P47 = ~P47 +#define D_P46_REV() P46 = ~P46 +#define D_P45_REV() P45 = ~P45 +#define D_P44_REV() P44 = ~P44 +#define D_P43_REV() P43 = ~P43 +#define D_P42_REV() P42 = ~P42 +#define D_P41_REV() P41 = ~P41 +#define D_P40_REV() P40 = ~P40 + +#define D_P57_ON() P57 = 1 +#define D_P56_ON() P56 = 1 +#define D_P55_ON() P55 = 1 +#define D_P54_ON() P54 = 1 +#define D_P53_ON() P53 = 1 +#define D_P52_ON() P52 = 1 +#define D_P51_ON() P51 = 1 +#define D_P50_ON() P50 = 1 +#define D_P57_OFF() P57 = 0 +#define D_P56_OFF() P56 = 0 +#define D_P55_OFF() P55 = 0 +#define D_P54_OFF() P54 = 0 +#define D_P53_OFF() P53 = 0 +#define D_P52_OFF() P52 = 0 +#define D_P51_OFF() P51 = 0 +#define D_P50_OFF() P50 = 0 +#define D_P57_AT() (P57) +#define D_P56_AT() (P56) +#define D_P55_AT() (P55) +#define D_P54_AT() (P54) +#define D_P53_AT() (P53) +#define D_P52_AT() (P52) +#define D_P51_AT() (P51) +#define D_P50_AT() (P50) +#define D_P57_REV() P57 = ~P57 +#define D_P56_REV() P56 = ~P56 +#define D_P55_REV() P55 = ~P55 +#define D_P54_REV() P54 = ~P54 +#define D_P53_REV() P53 = ~P53 +#define D_P52_REV() P52 = ~P52 +#define D_P51_REV() P51 = ~P51 +#define D_P50_REV() P50 = ~P50 + +#define D_P67_ON() P67 = 1 +#define D_P66_ON() P66 = 1 +#define D_P65_ON() P65 = 1 +#define D_P64_ON() P64 = 1 +#define D_P63_ON() P63 = 1 +#define D_P62_ON() P62 = 1 +#define D_P61_ON() P61 = 1 +#define D_P60_ON() P60 = 1 +#define D_P67_OFF() P67 = 0 +#define D_P66_OFF() P66 = 0 +#define D_P65_OFF() P65 = 0 +#define D_P64_OFF() P64 = 0 +#define D_P63_OFF() P63 = 0 +#define D_P62_OFF() P62 = 0 +#define D_P61_OFF() P61 = 0 +#define D_P60_OFF() P60 = 0 +#define D_P67_AT() (P67) +#define D_P66_AT() (P66) +#define D_P65_AT() (P65) +#define D_P64_AT() (P64) +#define D_P63_AT() (P63) +#define D_P62_AT() (P62) +#define D_P61_AT() (P61) +#define D_P60_AT() (P60) +#define D_P67_REV() P67 = ~P67 +#define D_P66_REV() P66 = ~P66 +#define D_P65_REV() P65 = ~P65 +#define D_P64_REV() P64 = ~P64 +#define D_P63_REV() P63 = ~P63 +#define D_P62_REV() P62 = ~P62 +#define D_P61_REV() P61 = ~P61 +#define D_P60_REV() P60 = ~P60 + +#define D_P77_ON() P77 = 1 +#define D_P76_ON() P76 = 1 +#define D_P75_ON() P75 = 1 +#define D_P74_ON() P74 = 1 +#define D_P73_ON() P73 = 1 +#define D_P72_ON() P72 = 1 +#define D_P71_ON() P71 = 1 +#define D_P70_ON() P70 = 1 +#define D_P77_OFF() P77 = 0 +#define D_P76_OFF() P76 = 0 +#define D_P75_OFF() P75 = 0 +#define D_P74_OFF() P74 = 0 +#define D_P73_OFF() P73 = 0 +#define D_P72_OFF() P72 = 0 +#define D_P71_OFF() P71 = 0 +#define D_P70_OFF() P70 = 0 +#define D_P77_AT() (P77) +#define D_P76_AT() (P76) +#define D_P75_AT() (P75) +#define D_P74_AT() (P74) +#define D_P73_AT() (P73) +#define D_P72_AT() (P72) +#define D_P71_AT() (P71) +#define D_P70_AT() (P70) +#define D_P77_REV() P77 = ~P77 +#define D_P76_REV() P76 = ~P76 +#define D_P75_REV() P75 = ~P75 +#define D_P74_REV() P74 = ~P74 +#define D_P73_REV() P73 = ~P73 +#define D_P72_REV() P72 = ~P72 +#define D_P71_REV() P71 = ~P71 +#define D_P70_REV() P70 = ~P70 + + +#define D_stdIO_P0_ALL() P0M1=0;P0M0=0; +#define D_HighI_P0_ALL() P0M1=0;P0M0=0XFF; +#define D_HighR_P0_ALL() P0M1=0XFF;P0M0=0; +#define D_OpenD_P0_ALL() P0M1=0XFF;P0M0=0XFF; + +#define D_stdIO_P1_ALL() P1M1=0;P1M0=0; +#define D_HighI_P1_ALL() P1M1=0;P1M0=0XFF; +#define D_HighR_P1_ALL() P1M1=0XFF;P1M0=0; +#define D_OpenD_P1_ALL() P1M1=0XFF;P1M0=0XFF; + +#define D_stdIO_P2_ALL() P2M1=0;P2M0=0; +#define D_HighI_P2_ALL() P2M1=0;P2M0=0XFF; +#define D_HighR_P2_ALL() P2M1=0XFF;P2M0=0; +#define D_OpenD_P2_ALL() P2M1=0XFF;P2M0=0XFF; + +#define D_stdIO_P3_ALL() P3M1=0;P3M0=0; +#define D_HighI_P3_ALL() P3M1=0;P3M0=0XFF; +#define D_HighR_P3_ALL() P3M1=0XFF;P3M0=0; +#define D_OpenD_P3_ALL() P3M1=0XFF;P3M0=0XFF; + +#define D_stdIO_P4_ALL() P4M1=0;P4M0=0; +#define D_HighI_P4_ALL() P4M1=0;P4M0=0XFF; +#define D_HighR_P4_ALL() P4M1=0XFF;P4M0=0; +#define D_OpenD_P4_ALL() P4M1=0XFF;P4M0=0XFF; + +#define D_stdIO_P5_ALL() P5M1=0;P5M0=0; +#define D_HighI_P5_ALL() P5M1=0;P5M0=0XFF; +#define D_HighR_P5_ALL() P5M1=0XFF;P5M0=0; +#define D_OpenD_P5_ALL() P5M1=0XFF;P5M0=0XFF; + +#define D_stdIO_P6_ALL() P6M1=0;P6M0=0; +#define D_HighI_P6_ALL() P6M1=0;P6M0=0XFF; +#define D_HighR_P6_ALL() P6M1=0XFF;P6M0=0; +#define D_OpenD_P6_ALL() P6M1=0XFF;P6M0=0XFF; + +#define D_stdIO_P7_ALL() P7M1=0;P7M0=0; +#define D_HighI_P7_ALL() P7M1=0;P7M0=0XFF; +#define D_HighR_P7_ALL() P7M1=0XFF;P7M0=0; +#define D_OpenD_P7_ALL() P7M1=0XFF;P7M0=0XFF; + +////Notice: n: BITN0---BITN7 不是0-7 eg:D_stdIO_P0(BITN0) +#define D_stdIO_P0(n) BITN_0(P0M1,n);BITN_0(P0M0,n); //////00 准双向口 灌电流20mA 拉电流270-150uS +#define D_HighI_P0(n) BITN_0(P0M1,n);BITN_1(P0M0,n); //////01 推挽输出 20mA 加限流 +#define D_HighR_P0(n) BITN_1(P0M1,n);BITN_0(P0M0,n); /////////10 高阻 +#define D_OpenD_P0(n) BITN_1(P0M1,n);BITN_1(P0M0,n); /////11 开漏 open-Drain 内部上拉电阻断开 开漏模式既可以度外部状态也可以对外输出高低电平 + +#define D_stdIO_P1(n) BITN_0(P1M1,n);BITN_0(P1M0,n); //////00 准双向口 灌电流20mA 拉电流270-150uS +#define D_HighI_P1(n) BITN_0(P1M1,n);BITN_1(P1M0,n); //////01 推挽输出 20mA 加限流 +#define D_HighR_P1(n) BITN_1(P1M1,n);BITN_0(P1M0,n); /////////10 高阻 +#define D_OpenD_P1(n) BITN_1(P1M1,n);BITN_1(P1M0,n); /////11 开漏 open-Drain 内部上拉电阻断开 开漏模式既可以度外部状态也可以对外输出高低电平 + +#define D_stdIO_P2(n) BITN_0(P2M1,n);BITN_0(P2M0,n); //////00 准双向口 灌电流20mA 拉电流270-150uS +#define D_HighI_P2(n) BITN_0(P2M1,n);BITN_1(P2M0,n); //////01 推挽输出 20mA 加限流 +#define D_HighR_P2(n) BITN_1(P2M1,n);BITN_0(P2M0,n); /////////10 高阻 +#define D_OpenD_P2(n) BITN_1(P2M1,n);BITN_1(P2M0,n); /////11 开漏 open-Drain 内部上拉电阻断开 开漏模式既可以度外部状态也可以对外输出高低电平 + +#define D_stdIO_P3(n) BITN_0(P3M1,n);BITN_0(P3M0,n); //////00 准双向口 灌电流20mA 拉电流270-150uS +#define D_HighI_P3(n) BITN_0(P3M1,n);BITN_1(P3M0,n); //////01 推挽输出 20mA 加限流 +#define D_HighR_P3(n) BITN_1(P3M1,n);BITN_0(P3M0,n); /////////10 高阻 +#define D_OpenD_P3(n) BITN_1(P3M1,n);BITN_1(P3M0,n); /////11 开漏 open-Drain 内部上拉电阻断开 开漏模式既可以度外部状态也可以对外输出高低电平 + +#define D_stdIO_P4(n) BITN_0(P4M1,n);BITN_0(P4M0,n); //////00 准双向口 灌电流20mA 拉电流270-150uS +#define D_HighI_P4(n) BITN_0(P4M1,n);BITN_1(P4M0,n); //////01 推挽输出 20mA 加限流 +#define D_HighR_P4(n) BITN_1(P4M1,n);BITN_0(P4M0,n); /////////10 高阻 +#define D_OpenD_P4(n) BITN_1(P4M1,n);BITN_1(P4M0,n); /////11 开漏 open-Drain 内部上拉电阻断开 开漏模式既可以度外部状态也可以对外输出高低电平 + +#define D_stdIO_P5(n) BITN_0(P5M1,n);BITN_0(P5M0,n); //////00 准双向口 灌电流20mA 拉电流270-150uS +#define D_HighI_P5(n) BITN_0(P5M1,n);BITN_1(P5M0,n); //////01 推挽输出 20mA 加限流 +#define D_HighR_P5(n) BITN_1(P5M1,n);BITN_0(P5M0,n); /////////10 高阻 +#define D_OpenD_P5(n) BITN_1(P5M1,n);BITN_1(P5M0,n); /////11 开漏 open-Drain 内部上拉电阻断开 开漏模式既可以度外部状态也可以对外输出高低电平 + +#define D_stdIO_P6(n) BITN_0(P6M1,n);BITN_0(P6M0,n); //////00 准双向口 灌电流20mA 拉电流270-150uS +#define D_HighI_P6(n) BITN_0(P6M1,n);BITN_1(P6M0,n); //////01 推挽输出 20mA 加限流 +#define D_HighR_P6(n) BITN_1(P6M1,n);BITN_0(P6M0,n); /////////10 高阻 +#define D_OpenD_P6(n) BITN_1(P6M1,n);BITN_1(P6M0,n); /////11 开漏 open-Drain 内部上拉电阻断开 开漏模式既可以度外部状态也可以对外输出高低电平 + +#define D_stdIO_P7(n) BITN_0(P7M1,n);BITN_0(P7M0,n); //////00 准双向口 灌电流20mA 拉电流270-150uS +#define D_HighI_P7(n) BITN_0(P7M1,n);BITN_1(P7M0,n); //////01 推挽输出 20mA 加限流 +#define D_HighR_P7(n) BITN_1(P7M1,n);BITN_0(P7M0,n); /////////10 高阻 +#define D_OpenD_P7(n) BITN_1(P7M1,n);BITN_1(P7M0,n); /////11 开漏 open-Drain 内部上拉电阻断开 开漏模式既可以度外部状态也可以对外输出高低电平 + +#endif //__STC_MACRO_H_ + + + + + + + diff --git a/source/cpu/stc_stc8hxx.h b/source/cpu/stc_stc8hxx.h new file mode 100644 index 0000000..a279eea --- /dev/null +++ b/source/cpu/stc_stc8hxx.h @@ -0,0 +1,640 @@ +#ifndef __STC8H_H__ +#define __STC8H_H__ + +///////////////////////////////////////////////// + +//ͷļ,ٰ"REG51.H" + +sfr P0 = 0x80; +sbit P00 = P0^0; +sbit P01 = P0^1; +sbit P02 = P0^2; +sbit P03 = P0^3; +sbit P04 = P0^4; +sbit P05 = P0^5; +sbit P06 = P0^6; +sbit P07 = P0^7; +sfr SP = 0x81; +sfr DPL = 0x82; +sfr DPH = 0x83; +sfr S4CON = 0x84; +sfr S4BUF = 0x85; +sfr PCON = 0x87; +sfr TCON = 0x88; +sbit TF1 = TCON^7; +sbit TR1 = TCON^6; +sbit TF0 = TCON^5; +sbit TR0 = TCON^4; +sbit IE1 = TCON^3; +sbit IT1 = TCON^2; +sbit IE0 = TCON^1; +sbit IT0 = TCON^0; +sfr TMOD = 0x89; +sfr TL0 = 0x8a; +sfr TL1 = 0x8b; +sfr TH0 = 0x8c; +sfr TH1 = 0x8d; +sfr AUXR = 0x8e; +sfr INTCLKO = 0x8f; +sfr P1 = 0x90; +sbit P10 = P1^0; +sbit P11 = P1^1; +sbit P12 = P1^2; +sbit P13 = P1^3; +sbit P14 = P1^4; +sbit P15 = P1^5; +sbit P16 = P1^6; +sbit P17 = P1^7; +sfr P1M1 = 0x91; +sfr P1M0 = 0x92; +sfr P0M1 = 0x93; +sfr P0M0 = 0x94; +sfr P2M1 = 0x95; +sfr P2M0 = 0x96; +sfr SCON = 0x98; +sbit SM0 = SCON^7; +sbit SM1 = SCON^6; +sbit SM2 = SCON^5; +sbit REN = SCON^4; +sbit TB8 = SCON^3; +sbit RB8 = SCON^2; +sbit TI = SCON^1; +sbit RI = SCON^0; +sfr SBUF = 0x99; +sfr S2CON = 0x9a; +sfr S2BUF = 0x9b; +sfr IRCBAND = 0x9d; +sfr LIRTRIM = 0x9e; +sfr IRTRIM = 0x9f; +sfr P2 = 0xa0; +sbit P20 = P2^0; +sbit P21 = P2^1; +sbit P22 = P2^2; +sbit P23 = P2^3; +sbit P24 = P2^4; +sbit P25 = P2^5; +sbit P26 = P2^6; +sbit P27 = P2^7; +sfr P_SW1 = 0xa2; +sfr IE = 0xa8; +sbit EA = IE^7; +sbit ELVD = IE^6; +sbit EADC = IE^5; +sbit ES = IE^4; +sbit ET1 = IE^3; +sbit EX1 = IE^2; +sbit ET0 = IE^1; +sbit EX0 = IE^0; +sfr SADDR = 0xa9; +sfr WKTCL = 0xaa; +sfr WKTCH = 0xab; +sfr S3CON = 0xac; +sfr S3BUF = 0xad; +sfr TA = 0xae; +sfr IE2 = 0xaf; +sfr P3 = 0xb0; +sbit P30 = P3^0; +sbit P31 = P3^1; +sbit P32 = P3^2; +sbit P33 = P3^3; +sbit P34 = P3^4; +sbit P35 = P3^5; +sbit P36 = P3^6; +sbit P37 = P3^7; +sfr P3M1 = 0xb1; +sfr P3M0 = 0xb2; +sfr P4M1 = 0xb3; +sfr P4M0 = 0xb4; +sfr IP2 = 0xb5; +sfr IP2H = 0xb6; +sfr IPH = 0xb7; +sfr IP = 0xb8; +sbit PPCA = IP^7; +sbit PLVD = IP^6; +sbit PADC = IP^5; +sbit PS = IP^4; +sbit PT1 = IP^3; +sbit PX1 = IP^2; +sbit PT0 = IP^1; +sbit PX0 = IP^0; +sfr SADEN = 0xb9; +sfr P_SW2 = 0xba; +sfr ADC_CONTR = 0xbc; +sfr ADC_RES = 0xbd; +sfr ADC_RESL = 0xbe; +sfr P4 = 0xc0; +sbit P40 = P4^0; +sbit P41 = P4^1; +sbit P42 = P4^2; +sbit P43 = P4^3; +sbit P44 = P4^4; +sbit P45 = P4^5; +sbit P46 = P4^6; +sbit P47 = P4^7; +sfr WDT_CONTR = 0xc1; +sfr IAP_DATA = 0xc2; +sfr IAP_ADDRH = 0xc3; +sfr IAP_ADDRL = 0xc4; +sfr IAP_CMD = 0xc5; +sfr IAP_TRIG = 0xc6; +sfr IAP_CONTR = 0xc7; +sfr P5 = 0xc8; +sbit P50 = P5^0; +sbit P51 = P5^1; +sbit P52 = P5^2; +sbit P53 = P5^3; +sbit P54 = P5^4; +sbit P55 = P5^5; +sbit P56 = P5^6; +sbit P57 = P5^7; +sfr P5M1 = 0xc9; +sfr P5M0 = 0xca; +sfr P6M1 = 0xcb; +sfr P6M0 = 0xcc; +sfr SPSTAT = 0xcd; +sfr SPCTL = 0xce; +sfr SPDAT = 0xcf; +sfr PSW = 0xd0; +sbit CY = PSW^7; +sbit AC = PSW^6; +sbit F0 = PSW^5; +sbit RS1 = PSW^4; +sbit RS0 = PSW^3; +sbit OV = PSW^2; +sbit F1 = PSW^1; +sbit P = PSW^0; +sfr T4T3M = 0xd1; +sfr T4H = 0xd2; +sfr T4L = 0xd3; +sfr T3H = 0xd4; +sfr T3L = 0xd5; +sfr T2H = 0xd6; +sfr T2L = 0xd7; +sfr USBCLK = 0xdc; +sfr ADCCFG = 0xde; +sfr IP3 = 0xdf; +sfr ACC = 0xe0; +sfr P7M1 = 0xe1; +sfr P7M0 = 0xe2; +sfr DPS = 0xe3; +sfr DPL1 = 0xe4; +sfr DPH1 = 0xe5; +sfr CMPCR1 = 0xe6; +sfr CMPCR2 = 0xe7; +sfr P6 = 0xe8; +sfr USBDAT = 0xec; +sfr IP3H = 0xee; +sfr AUXINTIF = 0xef; +sfr B = 0xf0; +sfr USBCON = 0xf4; +sfr IAP_TPS = 0xf5; +sfr P7 = 0xf8; +sfr USBADR = 0xfc; +sfr RSTCFG = 0xff; + +//⹦ܼĴλչRAM +//ЩĴ,ȽP_SW2BIT7Ϊ1,ſд + +///////////////////////////////////////////////// +//FF00H-FFFFH +///////////////////////////////////////////////// + + + +///////////////////////////////////////////////// +//FE00H-FEFFH +///////////////////////////////////////////////// + +#define CKSEL (*(unsigned char volatile xdata *)0xfe00) +#define CLKDIV (*(unsigned char volatile xdata *)0xfe01) +#define HIRCCR (*(unsigned char volatile xdata *)0xfe02) +#define XOSCCR (*(unsigned char volatile xdata *)0xfe03) +#define IRC32KCR (*(unsigned char volatile xdata *)0xfe04) +#define MCLKOCR (*(unsigned char volatile xdata *)0xfe05) +#define IRCDB (*(unsigned char volatile xdata *)0xfe06) +#define X32KCR (*(unsigned char volatile xdata *)0xfe08) + +#define P0PU (*(unsigned char volatile xdata *)0xfe10) +#define P1PU (*(unsigned char volatile xdata *)0xfe11) +#define P2PU (*(unsigned char volatile xdata *)0xfe12) +#define P3PU (*(unsigned char volatile xdata *)0xfe13) +#define P4PU (*(unsigned char volatile xdata *)0xfe14) +#define P5PU (*(unsigned char volatile xdata *)0xfe15) +#define P6PU (*(unsigned char volatile xdata *)0xfe16) +#define P7PU (*(unsigned char volatile xdata *)0xfe17) +#define P0NCS (*(unsigned char volatile xdata *)0xfe18) +#define P1NCS (*(unsigned char volatile xdata *)0xfe19) +#define P2NCS (*(unsigned char volatile xdata *)0xfe1a) +#define P3NCS (*(unsigned char volatile xdata *)0xfe1b) +#define P4NCS (*(unsigned char volatile xdata *)0xfe1c) +#define P5NCS (*(unsigned char volatile xdata *)0xfe1d) +#define P6NCS (*(unsigned char volatile xdata *)0xfe1e) +#define P7NCS (*(unsigned char volatile xdata *)0xfe1f) +#define P0SR (*(unsigned char volatile xdata *)0xfe20) +#define P1SR (*(unsigned char volatile xdata *)0xfe21) +#define P2SR (*(unsigned char volatile xdata *)0xfe22) +#define P3SR (*(unsigned char volatile xdata *)0xfe23) +#define P4SR (*(unsigned char volatile xdata *)0xfe24) +#define P5SR (*(unsigned char volatile xdata *)0xfe25) +#define P6SR (*(unsigned char volatile xdata *)0xfe26) +#define P7SR (*(unsigned char volatile xdata *)0xfe27) +#define P0DR (*(unsigned char volatile xdata *)0xfe28) +#define P1DR (*(unsigned char volatile xdata *)0xfe29) +#define P2DR (*(unsigned char volatile xdata *)0xfe2a) +#define P3DR (*(unsigned char volatile xdata *)0xfe2b) +#define P4DR (*(unsigned char volatile xdata *)0xfe2c) +#define P5DR (*(unsigned char volatile xdata *)0xfe2d) +#define P6DR (*(unsigned char volatile xdata *)0xfe2e) +#define P7DR (*(unsigned char volatile xdata *)0xfe2f) +#define P0IE (*(unsigned char volatile xdata *)0xfe30) +#define P1IE (*(unsigned char volatile xdata *)0xfe31) +#define P2IE (*(unsigned char volatile xdata *)0xfe32) +#define P3IE (*(unsigned char volatile xdata *)0xfe33) +#define P4IE (*(unsigned char volatile xdata *)0xfe34) +#define P5IE (*(unsigned char volatile xdata *)0xfe35) +#define P6IE (*(unsigned char volatile xdata *)0xfe36) +#define P7IE (*(unsigned char volatile xdata *)0xfe37) + +#define RTCCR (*(unsigned char volatile xdata *)0xfe60) +#define RTCCFG (*(unsigned char volatile xdata *)0xfe61) +#define RTCIEN (*(unsigned char volatile xdata *)0xfe62) +#define RTCIF (*(unsigned char volatile xdata *)0xfe63) +#define ALAHOUR (*(unsigned char volatile xdata *)0xfe64) +#define ALAMIN (*(unsigned char volatile xdata *)0xfe65) +#define ALASEC (*(unsigned char volatile xdata *)0xfe66) +#define ALASSEC (*(unsigned char volatile xdata *)0xfe67) +#define INIYEAR (*(unsigned char volatile xdata *)0xfe68) +#define INIMONTH (*(unsigned char volatile xdata *)0xfe69) +#define INIDAY (*(unsigned char volatile xdata *)0xfe6a) +#define INIHOUR (*(unsigned char volatile xdata *)0xfe6b) +#define INIMIN (*(unsigned char volatile xdata *)0xfe6c) +#define INISEC (*(unsigned char volatile xdata *)0xfe6d) +#define INISSEC (*(unsigned char volatile xdata *)0xfe6e) +#define YEAR (*(unsigned char volatile xdata *)0xfe70) +#define MONTH (*(unsigned char volatile xdata *)0xfe71) +#define DAY (*(unsigned char volatile xdata *)0xfe72) +#define HOUR (*(unsigned char volatile xdata *)0xfe73) +#define MIN (*(unsigned char volatile xdata *)0xfe74) +#define SEC (*(unsigned char volatile xdata *)0xfe75) +#define SSEC (*(unsigned char volatile xdata *)0xfe76) + +#define I2CCFG (*(unsigned char volatile xdata *)0xfe80) +#define I2CMSCR (*(unsigned char volatile xdata *)0xfe81) +#define I2CMSST (*(unsigned char volatile xdata *)0xfe82) +#define I2CSLCR (*(unsigned char volatile xdata *)0xfe83) +#define I2CSLST (*(unsigned char volatile xdata *)0xfe84) +#define I2CSLADR (*(unsigned char volatile xdata *)0xfe85) +#define I2CTXD (*(unsigned char volatile xdata *)0xfe86) +#define I2CRXD (*(unsigned char volatile xdata *)0xfe87) +#define I2CMSAUX (*(unsigned char volatile xdata *)0xfe88) +#define TM2PS (*(unsigned char volatile xdata *)0xfea2) +#define TM3PS (*(unsigned char volatile xdata *)0xfea3) +#define TM4PS (*(unsigned char volatile xdata *)0xfea4) +#define ADCTIM (*(unsigned char volatile xdata *)0xfea8) + +#define PWM1_ETRPS (*(unsigned char volatile xdata *)0xfeb0) +#define PWM1_ENO (*(unsigned char volatile xdata *)0xfeb1) +#define PWM1_PS (*(unsigned char volatile xdata *)0xfeb2) +#define PWM1_IOAUX (*(unsigned char volatile xdata *)0xfeb3) +#define PWM2_ETRPS (*(unsigned char volatile xdata *)0xfeb4) +#define PWM2_ENO (*(unsigned char volatile xdata *)0xfeb5) +#define PWM2_PS (*(unsigned char volatile xdata *)0xfeb6) +#define PWM2_IOAUX (*(unsigned char volatile xdata *)0xfeb7) +#define PWM1_CR1 (*(unsigned char volatile xdata *)0xfec0) +#define PWM1_CR2 (*(unsigned char volatile xdata *)0xfec1) +#define PWM1_SMCR (*(unsigned char volatile xdata *)0xfec2) +#define PWM1_ETR (*(unsigned char volatile xdata *)0xfec3) +#define PWM1_IER (*(unsigned char volatile xdata *)0xfec4) +#define PWM1_SR1 (*(unsigned char volatile xdata *)0xfec5) +#define PWM1_SR2 (*(unsigned char volatile xdata *)0xfec6) +#define PWM1_EGR (*(unsigned char volatile xdata *)0xfec7) +#define PWM1_CCMR1 (*(unsigned char volatile xdata *)0xfec8) +#define PWM1_CCMR2 (*(unsigned char volatile xdata *)0xfec9) +#define PWM1_CCMR3 (*(unsigned char volatile xdata *)0xfeca) +#define PWM1_CCMR4 (*(unsigned char volatile xdata *)0xfecb) +#define PWM1_CCER1 (*(unsigned char volatile xdata *)0xfecc) +#define PWM1_CCER2 (*(unsigned char volatile xdata *)0xfecd) +#define PWM1_CNTR (*(unsigned int volatile xdata *)0xfece) +#define PWM1_CNTRH (*(unsigned char volatile xdata *)0xfece) +#define PWM1_CNTRL (*(unsigned char volatile xdata *)0xfecf) +#define PWM1_PSCR (*(unsigned int volatile xdata *)0xfed0) +#define PWM1_PSCRH (*(unsigned char volatile xdata *)0xfed0) +#define PWM1_PSCRL (*(unsigned char volatile xdata *)0xfed1) +#define PWM1_ARR (*(unsigned int volatile xdata *)0xfed2) +#define PWM1_ARRH (*(unsigned char volatile xdata *)0xfed2) +#define PWM1_ARRL (*(unsigned char volatile xdata *)0xfed3) +#define PWM1_RCR (*(unsigned char volatile xdata *)0xfed4) +#define PWM1_CCR1 (*(unsigned int volatile xdata *)0xfed5) +#define PWM1_CCR1H (*(unsigned char volatile xdata *)0xfed5) +#define PWM1_CCR1L (*(unsigned char volatile xdata *)0xfed6) +#define PWM1_CCR2 (*(unsigned int volatile xdata *)0xfed7) +#define PWM1_CCR2H (*(unsigned char volatile xdata *)0xfed7) +#define PWM1_CCR2L (*(unsigned char volatile xdata *)0xfed8) +#define PWM1_CCR3 (*(unsigned int volatile xdata *)0xfed9) +#define PWM1_CCR3H (*(unsigned char volatile xdata *)0xfed9) +#define PWM1_CCR3L (*(unsigned char volatile xdata *)0xfeda) +#define PWM1_CCR4 (*(unsigned int volatile xdata *)0xfedb) +#define PWM1_CCR4H (*(unsigned char volatile xdata *)0xfedb) +#define PWM1_CCR4L (*(unsigned char volatile xdata *)0xfedc) +#define PWM1_BKR (*(unsigned char volatile xdata *)0xfedd) +#define PWM1_DTR (*(unsigned char volatile xdata *)0xfede) +#define PWM1_OISR (*(unsigned char volatile xdata *)0xfedf) +#define PWM2_CR1 (*(unsigned char volatile xdata *)0xfee0) +#define PWM2_CR2 (*(unsigned char volatile xdata *)0xfee1) +#define PWM2_SMCR (*(unsigned char volatile xdata *)0xfee2) +#define PWM2_ETR (*(unsigned char volatile xdata *)0xfee3) +#define PWM2_IER (*(unsigned char volatile xdata *)0xfee4) +#define PWM2_SR1 (*(unsigned char volatile xdata *)0xfee5) +#define PWM2_SR2 (*(unsigned char volatile xdata *)0xfee6) +#define PWM2_EGR (*(unsigned char volatile xdata *)0xfee7) +#define PWM2_CCMR1 (*(unsigned char volatile xdata *)0xfee8) +#define PWM2_CCMR2 (*(unsigned char volatile xdata *)0xfee9) +#define PWM2_CCMR3 (*(unsigned char volatile xdata *)0xfeea) +#define PWM2_CCMR4 (*(unsigned char volatile xdata *)0xfeeb) +#define PWM2_CCER1 (*(unsigned char volatile xdata *)0xfeec) +#define PWM2_CCER2 (*(unsigned char volatile xdata *)0xfeed) +#define PWM2_CNTR (*(unsigned int volatile xdata *)0xfeee) +#define PWM2_CNTRH (*(unsigned char volatile xdata *)0xfeee) +#define PWM2_CNTRL (*(unsigned char volatile xdata *)0xfeef) +#define PWM2_PSCR (*(unsigned int volatile xdata *)0xfef0) +#define PWM2_PSCRH (*(unsigned char volatile xdata *)0xfef0) +#define PWM2_PSCRL (*(unsigned char volatile xdata *)0xfef1) +#define PWM2_ARR (*(unsigned int volatile xdata *)0xfef2) +#define PWM2_ARRH (*(unsigned char volatile xdata *)0xfef2) +#define PWM2_ARRL (*(unsigned char volatile xdata *)0xfef3) +#define PWM2_RCR (*(unsigned char volatile xdata *)0xfef4) +#define PWM2_CCR1 (*(unsigned int volatile xdata *)0xfef5) +#define PWM2_CCR1H (*(unsigned char volatile xdata *)0xfef5) +#define PWM2_CCR1L (*(unsigned char volatile xdata *)0xfef6) +#define PWM2_CCR2 (*(unsigned int volatile xdata *)0xfef7) +#define PWM2_CCR2H (*(unsigned char volatile xdata *)0xfef7) +#define PWM2_CCR2L (*(unsigned char volatile xdata *)0xfef8) +#define PWM2_CCR3 (*(unsigned int volatile xdata *)0xfef9) +#define PWM2_CCR3H (*(unsigned char volatile xdata *)0xfef9) +#define PWM2_CCR3L (*(unsigned char volatile xdata *)0xfefa) +#define PWM2_CCR4 (*(unsigned int volatile xdata *)0xfefb) +#define PWM2_CCR4H (*(unsigned char volatile xdata *)0xfefb) +#define PWM2_CCR4L (*(unsigned char volatile xdata *)0xfefc) +#define PWM2_BKR (*(unsigned char volatile xdata *)0xfefd) +#define PWM2_DTR (*(unsigned char volatile xdata *)0xfefe) +#define PWM2_OISR (*(unsigned char volatile xdata *)0xfeff) + +#define PWMA_ETRPS (*(unsigned char volatile xdata *)0xfeb0) +#define PWMA_ENO (*(unsigned char volatile xdata *)0xfeb1) +#define PWMA_PS (*(unsigned char volatile xdata *)0xfeb2) +#define PWMA_IOAUX (*(unsigned char volatile xdata *)0xfeb3) +#define PWMB_ETRPS (*(unsigned char volatile xdata *)0xfeb4) +#define PWMB_ENO (*(unsigned char volatile xdata *)0xfeb5) +#define PWMB_PS (*(unsigned char volatile xdata *)0xfeb6) +#define PWMB_IOAUX (*(unsigned char volatile xdata *)0xfeb7) +#define PWMA_CR1 (*(unsigned char volatile xdata *)0xfec0) +#define PWMA_CR2 (*(unsigned char volatile xdata *)0xfec1) +#define PWMA_SMCR (*(unsigned char volatile xdata *)0xfec2) +#define PWMA_ETR (*(unsigned char volatile xdata *)0xfec3) +#define PWMA_IER (*(unsigned char volatile xdata *)0xfec4) +#define PWMA_SR1 (*(unsigned char volatile xdata *)0xfec5) +#define PWMA_SR2 (*(unsigned char volatile xdata *)0xfec6) +#define PWMA_EGR (*(unsigned char volatile xdata *)0xfec7) +#define PWMA_CCMR1 (*(unsigned char volatile xdata *)0xfec8) +#define PWMA_CCMR2 (*(unsigned char volatile xdata *)0xfec9) +#define PWMA_CCMR3 (*(unsigned char volatile xdata *)0xfeca) +#define PWMA_CCMR4 (*(unsigned char volatile xdata *)0xfecb) +#define PWMA_CCER1 (*(unsigned char volatile xdata *)0xfecc) +#define PWMA_CCER2 (*(unsigned char volatile xdata *)0xfecd) +#define PWMA_CNTR (*(unsigned int volatile xdata *)0xfece) +#define PWMA_CNTRH (*(unsigned char volatile xdata *)0xfece) +#define PWMA_CNTRL (*(unsigned char volatile xdata *)0xfecf) +#define PWMA_PSCR (*(unsigned int volatile xdata *)0xfed0) +#define PWMA_PSCRH (*(unsigned char volatile xdata *)0xfed0) +#define PWMA_PSCRL (*(unsigned char volatile xdata *)0xfed1) +#define PWMA_ARR (*(unsigned int volatile xdata *)0xfed2) +#define PWMA_ARRH (*(unsigned char volatile xdata *)0xfed2) +#define PWMA_ARRL (*(unsigned char volatile xdata *)0xfed3) +#define PWMA_RCR (*(unsigned char volatile xdata *)0xfed4) +#define PWMA_CCR1 (*(unsigned int volatile xdata *)0xfed5) +#define PWMA_CCR1H (*(unsigned char volatile xdata *)0xfed5) +#define PWMA_CCR1L (*(unsigned char volatile xdata *)0xfed6) +#define PWMA_CCR2 (*(unsigned int volatile xdata *)0xfed7) +#define PWMA_CCR2H (*(unsigned char volatile xdata *)0xfed7) +#define PWMA_CCR2L (*(unsigned char volatile xdata *)0xfed8) +#define PWMA_CCR3 (*(unsigned int volatile xdata *)0xfed9) +#define PWMA_CCR3H (*(unsigned char volatile xdata *)0xfed9) +#define PWMA_CCR3L (*(unsigned char volatile xdata *)0xfeda) +#define PWMA_CCR4 (*(unsigned int volatile xdata *)0xfedb) +#define PWMA_CCR4H (*(unsigned char volatile xdata *)0xfedb) +#define PWMA_CCR4L (*(unsigned char volatile xdata *)0xfedc) +#define PWMA_BKR (*(unsigned char volatile xdata *)0xfedd) +#define PWMA_DTR (*(unsigned char volatile xdata *)0xfede) +#define PWMA_OISR (*(unsigned char volatile xdata *)0xfedf) +#define PWMB_CR1 (*(unsigned char volatile xdata *)0xfee0) +#define PWMB_CR2 (*(unsigned char volatile xdata *)0xfee1) +#define PWMB_SMCR (*(unsigned char volatile xdata *)0xfee2) +#define PWMB_ETR (*(unsigned char volatile xdata *)0xfee3) +#define PWMB_IER (*(unsigned char volatile xdata *)0xfee4) +#define PWMB_SR1 (*(unsigned char volatile xdata *)0xfee5) +#define PWMB_SR2 (*(unsigned char volatile xdata *)0xfee6) +#define PWMB_EGR (*(unsigned char volatile xdata *)0xfee7) +#define PWMB_CCMR1 (*(unsigned char volatile xdata *)0xfee8) +#define PWMB_CCMR2 (*(unsigned char volatile xdata *)0xfee9) +#define PWMB_CCMR3 (*(unsigned char volatile xdata *)0xfeea) +#define PWMB_CCMR4 (*(unsigned char volatile xdata *)0xfeeb) +#define PWMB_CCER1 (*(unsigned char volatile xdata *)0xfeec) +#define PWMB_CCER2 (*(unsigned char volatile xdata *)0xfeed) +#define PWMB_CNTR (*(unsigned int volatile xdata *)0xfeee) +#define PWMB_CNTRH (*(unsigned char volatile xdata *)0xfeee) +#define PWMB_CNTRL (*(unsigned char volatile xdata *)0xfeef) +#define PWMB_PSCR (*(unsigned int volatile xdata *)0xfef0) +#define PWMB_PSCRH (*(unsigned char volatile xdata *)0xfef0) +#define PWMB_PSCRL (*(unsigned char volatile xdata *)0xfef1) +#define PWMB_ARR (*(unsigned int volatile xdata *)0xfef2) +#define PWMB_ARRH (*(unsigned char volatile xdata *)0xfef2) +#define PWMB_ARRL (*(unsigned char volatile xdata *)0xfef3) +#define PWMB_RCR (*(unsigned char volatile xdata *)0xfef4) +#define PWMB_CCR5 (*(unsigned int volatile xdata *)0xfef5) +#define PWMB_CCR5H (*(unsigned char volatile xdata *)0xfef5) +#define PWMB_CCR5L (*(unsigned char volatile xdata *)0xfef6) +#define PWMB_CCR6 (*(unsigned int volatile xdata *)0xfef7) +#define PWMB_CCR6H (*(unsigned char volatile xdata *)0xfef7) +#define PWMB_CCR6L (*(unsigned char volatile xdata *)0xfef8) +#define PWMB_CCR7 (*(unsigned int volatile xdata *)0xfef9) +#define PWMB_CCR7H (*(unsigned char volatile xdata *)0xfef9) +#define PWMB_CCR7L (*(unsigned char volatile xdata *)0xfefa) +#define PWMB_CCR8 (*(unsigned int volatile xdata *)0xfefb) +#define PWMB_CCR8H (*(unsigned char volatile xdata *)0xfefb) +#define PWMB_CCR8L (*(unsigned char volatile xdata *)0xfefc) +#define PWMB_BKR (*(unsigned char volatile xdata *)0xfefd) +#define PWMB_DTR (*(unsigned char volatile xdata *)0xfefe) +#define PWMB_OISR (*(unsigned char volatile xdata *)0xfeff) + +///////////////////////////////////////////////// +//FD00H-FDFFH +///////////////////////////////////////////////// + +#define P0INTE (*(unsigned char volatile xdata *)0xfd00) +#define P1INTE (*(unsigned char volatile xdata *)0xfd01) +#define P2INTE (*(unsigned char volatile xdata *)0xfd02) +#define P3INTE (*(unsigned char volatile xdata *)0xfd03) +#define P4INTE (*(unsigned char volatile xdata *)0xfd04) +#define P5INTE (*(unsigned char volatile xdata *)0xfd05) +#define P6INTE (*(unsigned char volatile xdata *)0xfd06) +#define P7INTE (*(unsigned char volatile xdata *)0xfd07) +#define P0INTF (*(unsigned char volatile xdata *)0xfd10) +#define P1INTF (*(unsigned char volatile xdata *)0xfd11) +#define P2INTF (*(unsigned char volatile xdata *)0xfd12) +#define P3INTF (*(unsigned char volatile xdata *)0xfd13) +#define P4INTF (*(unsigned char volatile xdata *)0xfd14) +#define P5INTF (*(unsigned char volatile xdata *)0xfd15) +#define P6INTF (*(unsigned char volatile xdata *)0xfd16) +#define P7INTF (*(unsigned char volatile xdata *)0xfd17) +#define P0IM0 (*(unsigned char volatile xdata *)0xfd20) +#define P1IM0 (*(unsigned char volatile xdata *)0xfd21) +#define P2IM0 (*(unsigned char volatile xdata *)0xfd22) +#define P3IM0 (*(unsigned char volatile xdata *)0xfd23) +#define P4IM0 (*(unsigned char volatile xdata *)0xfd24) +#define P5IM0 (*(unsigned char volatile xdata *)0xfd25) +#define P6IM0 (*(unsigned char volatile xdata *)0xfd26) +#define P7IM0 (*(unsigned char volatile xdata *)0xfd27) +#define P0IM1 (*(unsigned char volatile xdata *)0xfd30) +#define P1IM1 (*(unsigned char volatile xdata *)0xfd31) +#define P2IM1 (*(unsigned char volatile xdata *)0xfd32) +#define P3IM1 (*(unsigned char volatile xdata *)0xfd33) +#define P4IM1 (*(unsigned char volatile xdata *)0xfd34) +#define P5IM1 (*(unsigned char volatile xdata *)0xfd35) +#define P6IM1 (*(unsigned char volatile xdata *)0xfd36) +#define P7IM1 (*(unsigned char volatile xdata *)0xfd37) +#define P0WKUE (*(unsigned char volatile xdata *)0xfd40) +#define P1WKUE (*(unsigned char volatile xdata *)0xfd41) +#define P2WKUE (*(unsigned char volatile xdata *)0xfd42) +#define P3WKUE (*(unsigned char volatile xdata *)0xfd43) +#define P4WKUE (*(unsigned char volatile xdata *)0xfd44) +#define P5WKUE (*(unsigned char volatile xdata *)0xfd45) +#define P6WKUE (*(unsigned char volatile xdata *)0xfd46) +#define P7WKUE (*(unsigned char volatile xdata *)0xfd47) +#define PIN_IP (*(unsigned char volatile xdata *)0xfd60) +#define PIN_IPH (*(unsigned char volatile xdata *)0xfd61) + +///////////////////////////////////////////////// +//FC00H-FCFFH +///////////////////////////////////////////////// + +#define MD3 (*(unsigned char volatile xdata *)0xfcf0) +#define MD2 (*(unsigned char volatile xdata *)0xfcf1) +#define MD1 (*(unsigned char volatile xdata *)0xfcf2) +#define MD0 (*(unsigned char volatile xdata *)0xfcf3) +#define MD5 (*(unsigned char volatile xdata *)0xfcf4) +#define MD4 (*(unsigned char volatile xdata *)0xfcf5) +#define ARCON (*(unsigned char volatile xdata *)0xfcf6) +#define OPCON (*(unsigned char volatile xdata *)0xfcf7) + +///////////////////////////////////////////////// +//FB00H-FBFFH +///////////////////////////////////////////////// + +#define COMEN (*(unsigned char volatile xdata *)0xfb00) +#define SEGENL (*(unsigned char volatile xdata *)0xfb01) +#define SEGENH (*(unsigned char volatile xdata *)0xfb02) +#define LEDCTRL (*(unsigned char volatile xdata *)0xfb03) +#define LEDCKS (*(unsigned char volatile xdata *)0xfb04) +#define COM0_DA_L (*(unsigned char volatile xdata *)0xfb10) +#define COM1_DA_L (*(unsigned char volatile xdata *)0xfb11) +#define COM2_DA_L (*(unsigned char volatile xdata *)0xfb12) +#define COM3_DA_L (*(unsigned char volatile xdata *)0xfb13) +#define COM4_DA_L (*(unsigned char volatile xdata *)0xfb14) +#define COM5_DA_L (*(unsigned char volatile xdata *)0xfb15) +#define COM6_DA_L (*(unsigned char volatile xdata *)0xfb16) +#define COM7_DA_L (*(unsigned char volatile xdata *)0xfb17) +#define COM0_DA_H (*(unsigned char volatile xdata *)0xfb18) +#define COM1_DA_H (*(unsigned char volatile xdata *)0xfb19) +#define COM2_DA_H (*(unsigned char volatile xdata *)0xfb1a) +#define COM3_DA_H (*(unsigned char volatile xdata *)0xfb1b) +#define COM4_DA_H (*(unsigned char volatile xdata *)0xfb1c) +#define COM5_DA_H (*(unsigned char volatile xdata *)0xfb1d) +#define COM6_DA_H (*(unsigned char volatile xdata *)0xfb1e) +#define COM7_DA_H (*(unsigned char volatile xdata *)0xfb1f) +#define COM0_DC_L (*(unsigned char volatile xdata *)0xfb20) +#define COM1_DC_L (*(unsigned char volatile xdata *)0xfb21) +#define COM2_DC_L (*(unsigned char volatile xdata *)0xfb22) +#define COM3_DC_L (*(unsigned char volatile xdata *)0xfb23) +#define COM4_DC_L (*(unsigned char volatile xdata *)0xfb24) +#define COM5_DC_L (*(unsigned char volatile xdata *)0xfb25) +#define COM6_DC_L (*(unsigned char volatile xdata *)0xfb26) +#define COM7_DC_L (*(unsigned char volatile xdata *)0xfb27) +#define COM0_DC_H (*(unsigned char volatile xdata *)0xfb28) +#define COM1_DC_H (*(unsigned char volatile xdata *)0xfb29) +#define COM2_DC_H (*(unsigned char volatile xdata *)0xfb2a) +#define COM3_DC_H (*(unsigned char volatile xdata *)0xfb2b) +#define COM4_DC_H (*(unsigned char volatile xdata *)0xfb2c) +#define COM5_DC_H (*(unsigned char volatile xdata *)0xfb2d) +#define COM6_DC_H (*(unsigned char volatile xdata *)0xfb2e) +#define COM7_DC_H (*(unsigned char volatile xdata *)0xfb2f) + +#define TSCHEN1 (*(unsigned char volatile xdata *)0xfb40) +#define TSCHEN2 (*(unsigned char volatile xdata *)0xfb41) +#define TSCFG1 (*(unsigned char volatile xdata *)0xfb42) +#define TSCFG2 (*(unsigned char volatile xdata *)0xfb43) +#define TSWUTC (*(unsigned char volatile xdata *)0xfb44) +#define TSCTRL (*(unsigned char volatile xdata *)0xfb45) +#define TSSTA1 (*(unsigned char volatile xdata *)0xfb46) +#define TSSTA2 (*(unsigned char volatile xdata *)0xfb47) +#define TSRT (*(unsigned char volatile xdata *)0xfb48) +#define TSDAT (*(unsigned int volatile xdata *)0xfb49) +#define TSDATH (*(unsigned char volatile xdata *)0xfb49) +#define TSDATL (*(unsigned char volatile xdata *)0xfb4A) +#define TSTH00 (*(unsigned int volatile xdata *)0xfb50) +#define TSTH00H (*(unsigned char volatile xdata *)0xfb50) +#define TSTH00L (*(unsigned char volatile xdata *)0xfb51) +#define TSTH01 (*(unsigned int volatile xdata *)0xfb52) +#define TSTH01H (*(unsigned char volatile xdata *)0xfb52) +#define TSTH01L (*(unsigned char volatile xdata *)0xfb53) +#define TSTH02 (*(unsigned int volatile xdata *)0xfb54) +#define TSTH02H (*(unsigned char volatile xdata *)0xfb54) +#define TSTH02L (*(unsigned char volatile xdata *)0xfb55) +#define TSTH03 (*(unsigned int volatile xdata *)0xfb56) +#define TSTH03H (*(unsigned char volatile xdata *)0xfb56) +#define TSTH03L (*(unsigned char volatile xdata *)0xfb57) +#define TSTH04 (*(unsigned int volatile xdata *)0xfb58) +#define TSTH04H (*(unsigned char volatile xdata *)0xfb58) +#define TSTH04L (*(unsigned char volatile xdata *)0xfb59) +#define TSTH05 (*(unsigned int volatile xdata *)0xfb5a) +#define TSTH05H (*(unsigned char volatile xdata *)0xfb5a) +#define TSTH05L (*(unsigned char volatile xdata *)0xfb5b) +#define TSTH06 (*(unsigned int volatile xdata *)0xfb5c) +#define TSTH06H (*(unsigned char volatile xdata *)0xfb5c) +#define TSTH06L (*(unsigned char volatile xdata *)0xfb5d) +#define TSTH07 (*(unsigned int volatile xdata *)0xfb5e) +#define TSTH07H (*(unsigned char volatile xdata *)0xfb5e) +#define TSTH07L (*(unsigned char volatile xdata *)0xfb5f) +#define TSTH08 (*(unsigned int volatile xdata *)0xfb60) +#define TSTH08H (*(unsigned char volatile xdata *)0xfb60) +#define TSTH08L (*(unsigned char volatile xdata *)0xfb61) +#define TSTH09 (*(unsigned int volatile xdata *)0xfb62) +#define TSTH09H (*(unsigned char volatile xdata *)0xfb62) +#define TSTH09L (*(unsigned char volatile xdata *)0xfb63) +#define TSTH10 (*(unsigned int volatile xdata *)0xfb64) +#define TSTH10H (*(unsigned char volatile xdata *)0xfb64) +#define TSTH10L (*(unsigned char volatile xdata *)0xfb65) +#define TSTH11 (*(unsigned int volatile xdata *)0xfb66) +#define TSTH11H (*(unsigned char volatile xdata *)0xfb66) +#define TSTH11L (*(unsigned char volatile xdata *)0xfb67) +#define TSTH12 (*(unsigned int volatile xdata *)0xfb68) +#define TSTH12H (*(unsigned char volatile xdata *)0xfb68) +#define TSTH12L (*(unsigned char volatile xdata *)0xfb69) +#define TSTH13 (*(unsigned int volatile xdata *)0xfb6a) +#define TSTH13H (*(unsigned char volatile xdata *)0xfb6a) +#define TSTH13L (*(unsigned char volatile xdata *)0xfb6b) +#define TSTH14 (*(unsigned int volatile xdata *)0xfb6c) +#define TSTH14H (*(unsigned char volatile xdata *)0xfb6c) +#define TSTH14L (*(unsigned char volatile xdata *)0xfb6d) +#define TSTH15 (*(unsigned int volatile xdata *)0xfb6e) +#define TSTH15H (*(unsigned char volatile xdata *)0xfb6e) +#define TSTH15L (*(unsigned char volatile xdata *)0xfb6f) + +///////////////////////////////////////////////// +//FA00H-FAFFH +///////////////////////////////////////////////// + + +///////////////////////////////////////////////// + +#endif + diff --git a/source/msp/UART0.C b/source/msp/UART0.C index c7ac5d3..599914a 100644 --- a/source/msp/UART0.C +++ b/source/msp/UART0.C @@ -374,7 +374,7 @@ void L0_uart0_sendArray(U8 *buf,U16 len) /************************************************* UART 中断 *************************************************/ -void INTERRUPT_UART(void) interrupt D_SERVE_UART// using 2 +void INTERRUPT_UART(void) D_SERVE_UART// using 2 { NOP(); NOP(); NOP(); if(L0_uart0_IntRI() /*&& G.e.mcu_enc_id[5] == eep_enc.enc_val[5]*/) //如果是U0接收中断 @@ -411,7 +411,7 @@ void INTERRUPT_UART(void) interrupt D_SERVE_UART// using 2 } #if 1 -void timer1_isrHanddle (void) interrupt D_ISR_timer1 +void timer1_isrHanddle (void) D_SERVE_TIMER1 {// TF1 = 0; //s_nos_tick.uart0_free = 1; @@ -419,7 +419,7 @@ void timer1_isrHanddle (void) interrupt D_ISR_timer1 if(s_uart0_rec.head == 1) //收到一条协议 { s_uart0_rec.head = 0; - P10 ^= 1; + P17 ^= 1; if(s_uart0_rec.ok == 0) { s_uart0_rec.ok = 1; diff --git a/source/msp/iic_sim.h b/source/msp/iic_sim.h index d3665bd..2147251 100644 --- a/source/msp/iic_sim.h +++ b/source/msp/iic_sim.h @@ -25,7 +25,7 @@ ///>>>˿λ壬޸!!!!!!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> -#include "../cpu/stc_stc8a8k.h" +//#include "../cpu/stc_stc8a8k.h" #include "../cpu/c51_macro.h" #include "../bsp/bsp_config.h" diff --git a/source/msp/msp_eeprom.c b/source/msp/msp_eeprom.c index 3020f46..b4959a9 100644 --- a/source/msp/msp_eeprom.c +++ b/source/msp/msp_eeprom.c @@ -25,8 +25,64 @@ U_F16 uf_ee_add; +//8G8H +void L0_Iap_Idle() +{ + IAP_CONTR = 0; //关闭IAP功能 + IAP_CMD = 0; //清除命令寄存器 + IAP_TRIG = 0; //清除触发寄存器 + IAP_ADDRH = 0x80; //将地址设置到非IAP区域 + IAP_ADDRL = 0; +} +char L0_Iap_Read(vU16 addr) +{ + char dat; + IAP_CONTR = 0x80; //使能IAP + IAP_TPS = 12; + IAP_CMD = 1; //设置IAP读命令 + IAP_ADDRL = addr; //设置IAP低地址 + IAP_ADDRH = addr >> 8; //设置IAP高地址 + IAP_TRIG = 0x5a; //写触发命令(0x5a) + IAP_TRIG = 0xa5; //写触发命令(0xa5) + _nop_(); + dat = IAP_DATA; //读IAP数据 + L0_Iap_Idle(); //关闭IAP功能 + + return dat; +} + +void L0_Iap_Program(vU16 addr, char dat) +{ + IAP_CONTR = 0x80; //使能IAP + IAP_TPS = 12; //设置擦除等待参数 12MHz + IAP_CMD = 2; //设置IAP写命令 + IAP_ADDRL = addr; //设置IAP低地址 + IAP_ADDRH = addr >> 8; //设置IAP高地址 + IAP_DATA = dat; //写IAP数据 + IAP_TRIG = 0x5a; //写触发命令(0x5a) + IAP_TRIG = 0xa5; //写触发命令(0xa5) + _nop_(); + L0_Iap_Idle(); //关闭IAP功能 +} +///每个扇区512字节 +///指定地址可以为当前扇区内的任意地址,都会完整擦除当前扇区 +void L0_Iap_Erase(vU16 addr) +{ + IAP_CONTR = 0x80; //使能IAP + IAP_TPS = 12; //设置擦除等待参数 12MHz + IAP_CMD = 3; //设置IAP擦除命令 + IAP_ADDRL = addr; //设置IAP低地址 + IAP_ADDRH = addr >> 8; //设置IAP高地址 + IAP_TRIG = 0x5a; //写触发命令(0x5a) + IAP_TRIG = 0xa5; //写触发命令(0xa5) + _nop_(); // + L0_Iap_Idle(); //关闭IAP功能 +} + + +#if 0 //8F void L0_Iap_Idle() { IAP_CONTR = 0; //关闭IAP功能 @@ -79,7 +135,7 @@ void L0_Iap_Erase(vU16 addr) _nop_(); // L0_Iap_Idle(); //关闭IAP功能 } - +#endif void L0_Iap_Program_array(vU16 addr,U8 *buf,U8 len) { U8 i = 0; diff --git a/source/msp/msp_eeprom.h b/source/msp/msp_eeprom.h index 61a56e2..1e8ef7d 100644 --- a/source/msp/msp_eeprom.h +++ b/source/msp/msp_eeprom.h @@ -25,9 +25,10 @@ ///>>>端口位定义,可修改!!!!!!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> -#include "../cpu/stc_stc8a8k.h" -#include "../cpu/c51_macro.h" +//#include "../cpu/stc_stc8a8k.h" +#include "../cpu/stc_macro.h" #include "../bsp/bsp_config.h" +#include "../cpu/stc_stc8hxx.h" #include "uart0.h" diff --git a/source/msp/msp_id.c b/source/msp/msp_id.c index c2c345b..f2a6e89 100644 --- a/source/msp/msp_id.c +++ b/source/msp/msp_id.c @@ -26,7 +26,7 @@ void L0_id_get(U8 *id) void L0_id_get_rom(U8 *id) { U8 i = 0; - char *ID = (char code *)0x3ff9; + char *ID = (char code *)(D_MCU_SPEC_PARAM_CHIPID); for(i=0;i>>端口位定义,可修改!!!!!!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> -#include "../cpu/stc_stc8a8k.h" -#include "../cpu/c51_macro.h" #include "../bsp/bsp_config.h" - - #include "uart0.h" extern void L0_id_get(U8 *id); diff --git a/source/msp/time.c b/source/msp/time.c index e34f228..9bc9e70 100644 --- a/source/msp/time.c +++ b/source/msp/time.c @@ -78,7 +78,7 @@ void L0_timer0_Init(void) //25毫秒@11.0592MHz /********************** Timer0中断函数************************/ /// 和 L0_timer0_Init 关联,需要配置 bsp_config.h中的 D_sys_MainFre /// 默认10ms 作为TTSS系统的定时引擎 -void timer0_isrHanddle (void) interrupt D_ISR_timer0 +void timer0_isrHanddle (void) D_SERVE_TIMER0 {// NOP(); NOP(); NOP(); TF0 = 0; diff --git a/sscom5.13.1.exe b/sscom5.13.1.exe new file mode 100644 index 0000000..1fe2df0 Binary files /dev/null and b/sscom5.13.1.exe differ diff --git a/sscom51.ini b/sscom51.ini new file mode 100644 index 0000000..d687618 --- /dev/null +++ b/sscom51.ini @@ -0,0 +1,383 @@ +;ɾļԻָĬֵ +;SSCOMñļ,ڳúõĴڲַݶԶ,òҪⲿ༭Ķļ! +;ļ޸ĺܴ,ɾļ,򽫻Զһµiniļ. +;׵İǷֺעͷ +;ÿжԻس + +;"="HʾǸHEXݴ +;"="AʾǸASCַ +;Nxʾڼַ(1