-
谁能帮我看看n76e003可调电源的程序
开机后oled上ADC电压值有变化,旋转编码器后,oled就显示一个值没有变化 #include
#include "N76E003.h" #include "Common.h" #include "Delay.h" #include "SFR_Macro.h" #include "Function_Define.h" #include "oled.h" #include "bmp.h" UINT8 temp=0xD7; UINT8 temp1=0x02; void ADC_ISR (void) interrupt 11 { if(ADCF) { clr_ADCF; set_ADCS; //printf ("\n Value = 0x%bx",ADCRH); } } void show() { uint16_t BandGap_H, BandGap_L,BandGap_v; uint16_t voltage = 0; char aa[10]; float v; BandGap_H = ADCRH; BandGap_L = ADCRL; BandGap_v = BandGap_H << 4 | BandGap_L; v=(float)BandGap_v*(3.3/4096); v*=10; sprintf(aa,"%5.2f",v); OLED_ShowString(0,0,aa); } void main (void) { // unsigned char t; // uint16_t BandGap_H, BandGap_L,BandGap_v,temp; // uint16_t voltage = 0; // // char aa[10]; // float v; Set_All_GPIO_Quasi_Mode; // Define in Function_define.h P17_Input_Mode; P30_Input_Mode; set_EPI; clr_PIPS1; set_PIPS0; Enable_BIT7_RasingEdge_Trig; Enable_ADC_AIN2; // Enable AIN0 P1.7 as ADC input set_EADC; // Enable ADC interrupt (if use interrupt) set_EPWM;//?? PWM_INT_PWM4; PWM_FALLING_INT; PWM4_P01_OUTPUT_ENABLE; clr_PWMTYP;//?????? clr_PWMMOD0;//????????? clr_PWMMOD1; PWM_CLOCK_DIV_8;//8???? PWMPH = 0x07; //Setting PWM value PWMPL = 0xCF; set_SFRPAGE;//PWM4 and PWM5 duty seting is in SFP page 1 PWM4H = 0x02;//500(Dec) PWM4L = 0xD7; clr_SFRPAGE; set_LOAD; // PWM run set_PWMRUN; set_EA; set_ADCS; InitialUART0_Timer3(115200); set_CLOEN; OLED_Init(); //³õʼ»¯OLED // t=' '; while(1) { show(); Timer0_Delay1ms(300); } } void PWMISR() interrupt 13 { if(PWMF)//???????? { clr_LOAD;//???????? clr_PWMF;//??PWM????? set_SFRPAGE;//PWM4 and PWM5 duty seting is in SFP page 1 PWM4H=temp1; PWM4L=temp; clr_SFRPAGE; set_LOAD;//????,???? clr_PWMF; } } void PinInterrupt (void) interrupt 7 { if(PIF==0x80&&P17) { Timer0_Delay1ms(1); if(P17) { if(P30) { temp+=30; if(temp<30) { if(temp1==7){temp=0xc0;}else{temp1+=1;}} //Timer0_Delay1ms(500); } else{ temp-=30; if(temp<30){ if(temp1==0){temp=0x30;}else{temp1-=1;temp=0xff;}} //Timer0_Delay1ms(500); } } } PIF=0; PWMF=1; } 900浏览量 4回复量 关注量 -
使用可调电源模块DIY的可调电源怎样?
我最近想入手一个可调电源,根据最近需要的和渴望的,网上的价格是差不多是300左右,可是某天在网上看到别人自制的可调电源,能可调电源和电压而且达到30V/5A程度的,成本在100以下,最贵的那个可调电源模块是60左右,只是不知道性能和功能怎样,会出现什么问题,有没有这方面的高手可以解答下?
1326浏览量 2回复量 关注量