Pārlūkot izejas kodu

直流新4路控制板

liyi 1 gadu atpakaļ
vecāks
revīzija
600eb4ae55

+ 2 - 2
control/PDU-DC_UPGRADE/ARM/System/startup_gd32e230.s

@@ -38,7 +38,7 @@
 ;   <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
 ; </h>
 
-Stack_Size      EQU     0x00000400
+Stack_Size      EQU     0x00000600
 
                 AREA    STACK, NOINIT, READWRITE, ALIGN=3
 Stack_Mem       SPACE   Stack_Size
@@ -49,7 +49,7 @@ __initial_sp
 ;   <o>  Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
 ; </h>
 
-Heap_Size       EQU     0x00000400
+Heap_Size       EQU     0x00000200
 
                 AREA    HEAP, NOINIT, READWRITE, ALIGN=3
 __heap_base

+ 7 - 0
control/PDU-DC_UPGRADE/App/ADC/ADC.c

@@ -189,10 +189,17 @@ uint32_t DC_I_calfunction(uint16_t da,uint8_t channel)
 		switch(channel)
 		{
 	#if SPPPORT_BIG_HAL
+			#if SUPPORT_4_GATE_ADC
+			case 0:
+			case 1:
+			case 2:
+			case 3:			
+			#else
 			case 0:
 			case 1:
 			case 4:
 			case 5:
+		#endif
 			{
 				temp_v = da;
 				if(da < 0xA)

+ 40 - 17
control/PDU-DC_UPGRADE/App/Main/Main.c

@@ -194,7 +194,7 @@ static void app_init(META_DATA_S *meta)
 {
 	flash_get_meta_data(meta);
 	FfLASH = NVIC_VECTTAB_FLASH;
-	nvic_vector_table_set(NVIC_VECTTAB_FLASH,meta->rom_addr - NVIC_VECTTAB_FLASH);
+	nvic_vector_table_set(NVIC_VECTTAB_FLASH,0X08004000 - NVIC_VECTTAB_FLASH);
 	__enable_irq();
 }
 
@@ -683,7 +683,7 @@ void switch_recode()
 		{
 			handle_detection[0] = 1;
 			uint8_t value = 0xFF;
-			for(int i = RELAY_ChN_default-1;i >=0;i--)
+			for(int i = 0 ;i < RELAY_ChN_default;i++)
 			{
 				if(handle_status[i])
 				{
@@ -844,10 +844,9 @@ int main(void)
 static  uint8_t write_iic_flash = 0;
 	while(1)
 	{
-		
-#if 0
-		if((detection_value & 0x2) == 0)
-		{
+//#if 1
+//		if((detection_value & 0x1) == 0)
+//		{
 //			for(int i = 0; i <RELAY_ChN_default / 2;i++)
 //			{
 
@@ -858,8 +857,32 @@ static  uint8_t write_iic_flash = 0;
 //					//E
 //					//AT24CxxWriteOneByte(ERom_RL_ST_Addr,Eeprom_Rbuf[ERom_RL_ST_Addr]);
 //			}
+//		}
 //			Eeprom_Rbuf[ERom_RL_ST_Addr] = DCPDU_Modbus_Reg[Mb_Dbuff_RL_ST_Addr] & Active_state_bit;
 //			RL_Rx_state = Eeprom_Rbuf[ERom_RL_ST_Addr];
+//			Write_74hc573();
+//			uint8_t data = RL_Rx_state;
+//			RL_Rx_state = 0xF0;
+//			RL_Rx_state &= data;		
+//		
+//#endif
+		
+		
+#if 0
+		if((detection_value & 0x2) == 0)
+		{
+			for(int i = 0; i <RELAY_ChN_default / 2;i++)
+			{
+
+					uint8_t temp0 = 0x01 << i;
+					Relayx_Onoff_state(i,RELAY_OFF);
+					temp0 = ~temp0;
+					DCPDU_Modbus_Reg[Mb_Dbuff_RL_ST_Addr] &= temp0;
+					//E
+					//AT24CxxWriteOneByte(ERom_RL_ST_Addr,Eeprom_Rbuf[ERom_RL_ST_Addr]);
+			}
+			Eeprom_Rbuf[ERom_RL_ST_Addr] = DCPDU_Modbus_Reg[Mb_Dbuff_RL_ST_Addr] & Active_state_bit;
+			RL_Rx_state = Eeprom_Rbuf[ERom_RL_ST_Addr];
 //			Write_74hc573();
 				uint8_t data = RL_Rx_state;
 				RL_Rx_state = 0xF0;
@@ -867,18 +890,18 @@ static  uint8_t write_iic_flash = 0;
 		}
 		if((detection_value & 0x1) == 0)
 		{
-//			for(int i = RELAY_ChN_default / 2; i <RELAY_ChN_default;i++)
-//			{
+			for(int i = RELAY_ChN_default / 2; i <RELAY_ChN_default;i++)
+			{
 
-//					uint8_t temp0 = 0x01 << i;
-//					Relayx_Onoff_state(i,RELAY_OFF);
-//					temp0 = ~temp0;
-//					DCPDU_Modbus_Reg[Mb_Dbuff_RL_ST_Addr] &= temp0;
-//					//E
-//					//AT24CxxWriteOneByte(ERom_RL_ST_Addr,Eeprom_Rbuf[ERom_RL_ST_Addr]);
-//			}
-//			Eeprom_Rbuf[ERom_RL_ST_Addr] = DCPDU_Modbus_Reg[Mb_Dbuff_RL_ST_Addr] & Active_state_bit;
-//			RL_Rx_state = Eeprom_Rbuf[ERom_RL_ST_Addr];
+					uint8_t temp0 = 0x01 << i;
+					Relayx_Onoff_state(i,RELAY_OFF);
+					temp0 = ~temp0;
+					DCPDU_Modbus_Reg[Mb_Dbuff_RL_ST_Addr] &= temp0;
+					//E
+					//AT24CxxWriteOneByte(ERom_RL_ST_Addr,Eeprom_Rbuf[ERom_RL_ST_Addr]);
+			}
+			Eeprom_Rbuf[ERom_RL_ST_Addr] = DCPDU_Modbus_Reg[Mb_Dbuff_RL_ST_Addr] & Active_state_bit;
+			RL_Rx_state = Eeprom_Rbuf[ERom_RL_ST_Addr];
 //			Write_74hc573();
 			uint8_t data = RL_Rx_state;
 			RL_Rx_state = 0x0F;

+ 11 - 1
control/PDU-DC_UPGRADE/App/Main/board_cnf.h

@@ -11,8 +11,9 @@
 #define                 PRJ_ADC_V_DC_7_1                          0
 #define                 PRJ_ADC_V_DC_4_4                          0
 #define                 PRJ_ADC_V_DC_NEW_8                        0
-#define                 PRJ_ADC_V_DC_NEW_7                        1
+#define                 PRJ_ADC_V_DC_NEW_7                        0
 #define                 PRJ_ADC_V_DC_NEW_6                        0
+#define                 PRJ_ADC_V_DC_NEW_4                        1
 #if   PRJ_BASE_DC_8
 	#define RELAY_ChN_default             		8
 	#define SUPPORT_IM1253E										1
@@ -52,6 +53,15 @@
 	#define SUPPORT_DETECTION               	0
 	#define SUPPORT_STM32_ADC                 1
 	#define SUPPORT_SWITCH_REMENBER           0
+#elif 	PRJ_ADC_V_DC_NEW_4	
+	#define RELAY_ChN_default             		4
+	#define SURPPOT_ALL_ON_ALL_OFF          	1
+	#define SUPPORT_DETECTION               	1
+	#define SUPPORT_STM32_ADC                 1
+	#define SUPPORT_SWITCH_REMENBER           1
+	#define SUPPORT_4_GATE_ADC                1
+	#define SPPPORT_BIG_HAL										1
+#elif
 #endif
 
 

+ 2 - 2
control/PDU-DC_UPGRADE/App/detection/detection.c

@@ -30,9 +30,9 @@ void detection_Init()
 uint8_t get_detection()
 {
 	uint8_t value = 0;
-	if(gpio_input_bit_get(GPIOB,GPIO_PIN_3)==0)
-		value |= 1;
 	if(gpio_input_bit_get(GPIOA,GPIO_PIN_11)==0)
+		value |= 1;
+	if(gpio_input_bit_get(GPIOB,GPIO_PIN_3)==0)
 		value |= 2;
 	return value;
 }