实验原理:
STM32内部集成三个12位ADC,GMT43的所有电源经过电阻分压接
入到ADC的输入通道内,输入电流经过高端电流检测芯片ZXCT1009F输入
到ADC的输入通道内,从而实现电源监控功能。
示例截图:
源代码下载链接:
链接: 密码:rxhp
GMT43购买链接:
核心代码:
static void frame_process(void){ int i; GUI_CURSOR_Show(); WM_SetCreateFlags(WM_CF_MEMDEV); GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbDialog, WM_HBKWIN, 0, 0); while(1){ if(power_flag == 1){ power_flag = 0; for(i = 0;i < 4;i++){ adc.read(i); memset(power_buffer[i],0,sizeof(power_buffer[i])); } sprintf(power_buffer[0],"%.2f",adc.value[0] * 500); sprintf(power_buffer[1],"%.2f",adc.value[1] * 6); sprintf(power_buffer[2],"%.2f",adc.value[2] * 2); sprintf(power_buffer[3],"%.2f",adc.value[0] * 15); for( i = 0; i < 4; i++){ EDIT_SetText(h_edit[i],power_buffer[i]); } } GUI_Exec(); }}