static void ADCTaskStart(void *p_arg) { p_arg = p_arg; data_V = 0; data_T = 0; value_V = 0; value_T = 0; port180_V = 0; port180_T = 0; GPIO_Config (GPIO1,0x0003,GPIO_HI_AIN_TRI); GPIO_Config (GPIO1,0x6000,GPIO_OUT_PP); GPIO_Config (GPIO2,0x0400,GPIO_OUT_PP); DispInitBT(); ADC12_Init(); ADC12_ITConfig(DISABLE); ADC12_PrescalerConfig(100); ADC12_ModeConfig(ADC12_SINGLE); for(;;) { while(port180_V <= 59) { ADC_bit_init_V(port180_V); ADC12_ChannelSelect(ADC12_CHANNEL0); ADC12_ConversionStart(); while(ADC12_FlagStatus(ADC12_DA0) == RESET); data_V = ADC12_ConversionValue(ADC12_CHANNEL0); value_V = ADC12_Calib(data_V); if(port180_V <= 59) { result_V[port180_V] = value_V; port180_V++; } } while(port180_T <= 59) { ADC_bit_init_T(port180_T); ADC12_ChannelSelect(ADC12_CHANNEL0); ADC12_ConversionStart(); while(ADC12_FlagStatus(ADC12_DA0) == RESET); data_T = ADC12_ConversionValue(ADC12_CHANNEL0); value_T = ADC12_Calib(data_T); if(port180_T <= 59) { result_T[port180_T] = value_T; port180_T++; } } ADC_Current(); // DispClear(); DispStart(); OSTimeDlyHMSM(0, 0, 0, 50); } } 第一个while循环出不去,死锁了。考虑与数组的定义有关。 unsigned char port180_V; unsigned char port180_T; unsigned short data_V; unsigned short data_T; unsigned short data_C; unsigned short value_V,value_T,value_C,result_C; unsigned short result_V[90] = {0}; unsigned short result_T[90] = {0}; void ADC_bit_init_V(unsigned char port_V); void ADC_bit_init_T(unsigned char port_T); void ADC_Current(); void DispStart(); void Generic_Wait(unsigned long TimeSet); void DispRefresh(); void DispClear(); void DispClearPart(unsigned char PageWantSet); void DispInitBT(); unsigned short ADC12_Calib(unsigned short Conv_Res); void Disp_ByteSend(unsigned char DataWantSend); void DispStartPart();
unsigned char const Disp0[16] = {0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00}; unsigned char const Disp1[16] = {0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00}; 。。。
不定一成const,例如定义成如下 unsigned char Disp0[16] = {0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00}; 就不死机,但在显示屏上出现规则的奇怪图标。 |