Manycircuits Blogspot Com 2018 04 Dspic30f2010 Inverter With Charger HTML
Manycircuits Blogspot Com 2018 04 Dspic30f2010 Inverter With Charger HTML
블로그 만들기 로그인
Many circuits
This is an electronic circuit sharing and tutorial blog which offers designed and tested circuits for free.
7/05/2018 Search This Blog
Search
DSPIC30f2010 PURE SINE INVERTER CIRCUIT WITH
CHARGER Pages
This is a highly reliable sine wave inverter circuit designed using digital signal Home
processing IC (DSP30f2010) made by microchip.
DSP30f2010 PURE SINE INVERTER WITH CHARGER
Read dsp30f2010 mppt from HERE
Repair your inverter
THE DSP30f2010 INVERTER .
The circuit am sharing today is an inverter circuit which can also charge every
inverter/solar battery with a selected charge current.
As said earlier, the inverter / circuit runs on a digital signal processing micro
controller made by microchip. You can download the datasheet by clicking
Here. Blog Archive
Jun 15 (1)
Mar 03 (1)
Jun 24 (1)
Mar 31 (1)
Oct 09 (1)
Jul 20 (1)
Jul 05 (2)
Sep 25 (1)
May 24 (6)
May 22 (5)
May 20 (2)
May 17 (6)
Apr 05 (1)
Labels
DC TO DC CONVERTERS
After testing the code and the hardware as designed by Mr. Sanjay, I decided
ELECTRONICS
to modify it so that it can be able to stand all tests of time. After the modification
of hardware and code, the system has truly become 99% reliable and has the
Report Abuse
following functions and protections.
Subscribe To
1. Ability to work as inverter or UPS.
Posts
Comments
2. Mosfet protection interrupt
Translate
3. Better battery charging algorithm
Recent Post
4. Low voltage protection
Popular Posts
5. high voltage Protection MUST, POWER STAR, FELICITY
INVERTER REPAIRS
Today am going to show you how to
6. Works on 12V, 24V, 48V, 96V, 120V repair all the inverter brands that uses
the control boards below. MUST
INVERTERS, FELICITY I...
7. Overload protection DSPIC30f2010 PURE SINE
INVERTER CIRCUIT WITH
CHARGER
8. Over charging protection This is a highly reliable sine wave
This is a highly reliable sine wave
inverter circuit designed using digital
signal processing IC (DSP30f2010)
made by microchip . ...
9. Over battery protection
EGS002 SINE WAVE INVERTER
CIRCUIT
10. Load display In KVA This is a simple sine wave inverter
circuit without programming. Pure
sine wave inverter circuit with no
11. Cooling fan failure detection and tripping with alarm center tap design has become sim...
MAKE INVERTER TRANSFORMER
12. NTC sensor failure detection and tripping with alarm Inverter transformers are just like any
other power transformers except that
inverter transformers works in the
reversed form of the standa...
13. Over Temperature protection
MPPT CIRCUIT dsPIC30f2010
MPPT CHARGE CONTROLLER
14. The circuit board can be used to repair all pure sine inverters. Detecting your power needs and
delivering exactly what you need is a
fantastic work of the MAXIMUM
15. Set your own maximum load, charging current and set almost everything by POWER POINT ...
yourself if you don't want the default values SG3524 PWM INVERTER CIRCUIT
PWM Inverter circuit with charger
using a single transformer. The circuit
16. Low battery alarm is based on SG3524 IC. Inverters are
electronic device...
17. Low Battery cutoff DC TO DC CONVERTER 2
DC to DC converter steps up low DC
voltage or steps down high DC
voltage to a more acceptable voltages
to be used on control boards and
oth...
INVERTER BATTERY CHARGER
CIRCUIT
In inverter designing, one of the most
required tasks is a good charging
system. A good inverter charger will
increase battery life span an...
HOW TO MAKE SMPS FERRITE
TRANSFORMER (CHOPPER)
We are going to make a ferrite or
chopper transformer in a very simple
and more understanding way.
Chopper transformers or ferrite core
tra...
SOLAR BATTERY CHARGER
CIRCUIT
18. The board can be used for control board replacement for all single phase Solar charge controller circuit that is
low frequency pure sine wave inverters (MUST, POWER STAR, FELICITY, used to charge inverter batteries and
car batteries using the solar energy.
KAMA POWER, POWER JACK etc. ) 12V, ...
19. The control board can be used to build high current 3 stages charger with Blogger templates
current rating from 1A100A
20. will use either 16x2 or 16x4 LCD
21. Source code can be use for SMPS INVERTERS AS WELL
12V120V INVERTER PURE SINE WAVE CONTROL
BOARD CIRCUIT
VERSION 3.0
to make your own inverter transformer for this circuit click
below
Read more on make inverter transformer
YOU CAN READ ON HOW TO MAKE SMPS TRANSFORMER BY CLICKING
THIS TEXT
MOSFET BRIDGE CIRCUIT (POWER AMPLIFIER
CIRCUIT)
The mosfet bridge circuit for pure sine inverters is also know as Hbridge or
Power amplifying Stage. Click below to read more
about mosfet bridge circuit and how it works.
BUY MOSFET H BRIDGE BOARD
DSP30F2010 INVERTER CONTROL BOARD
Below are pictures of the professional inverter board.
it can be used for 12V systems, 24V systems, 48V system with no modification
to the parts. 96V and 120V systems will need to change R11 to a higher value.
BUY CONTROL BOARD WITH OR WITHOUT COMPONENTS
If you are interested in buying the control boards together with a programmed
DSPIC30f2010, kindly send me email
[email protected]
BUY PLAIN BOARD WITH PROGRAMMED IC
BUY ASSEMBLED PCB WITH PROGRAMMED IC
You can buy either PCB with the micro controller which is already programmed
or buy only the programmed micro controller and use the circuit on this site to
build your own PCB.
SIGNAL FROM MOSFET DRIVE WITH 20KHz. PWM
BUY PROGRAM SOURCE CODE
If anyone is intrested in buying the source code for programing the PIC micro
controller for this inverter, You can contact.
Mr. SANJAY by sending him mail on [email protected]
You can also buy source code from me by sending me mail on
[email protected].
People who are not into C programming can buy just the HEX file to program
the ic without edditing. You should therefore state what you need in your mail.
CODE FOR DSPIC30F2010 PURE SINE INVERTER WITH CHARGER
//////////////////////////////////////////////////////////////////////
#include <p30f2010.h>
#include <libpic30.h>
_FOSC(CSW_ON_FSCM_OFF & XT_PLL16);
_FWDT(WDT_OFF);
_FBORPOR(MCLR_EN & PBOR_ON & BORV_42 & RST_PWMPIN & PWMxH_ACT_HI &
PWMxL_ACT_HI);
_FGS (CODE_PROT_ON)
#define buzzer LATEbits.LATE4
#define change LATDbits.LATD1
#define stbyinv 1
#define upsmode 2
#define invmode 3
#define modekey 4
#define upkey 5
#define downkey 6
#define stbyups 7
#define fanheat 700
///////////////////////////////////////////////////////////////////////////////////////////
const signed int sine_table[91]=
{0,174,348,523,697,871,1045,1218,1391,1564,1736,1908,2079,2249,2419,2588,2756,2923,3090,
3255,3420,3583,3746,3907,4067,4226,4383,4539,4694,4848,5000,5150,5299,5446,
5591,5735,5877,6018,6156,6293,6427,6560,6691,6819,6946,7071,7193,7313,7431,7547,7660,7771,
7880,7986,8090,8191,8290,8386,8480,8571,8660,8746,8829,8910,8987,9063,9135,9205,9271,9335,
9396,9455,9510,9563,9612,9659,9702,9743,9781,9616,9848,9876,9902,9925,9945,9961,9975,9986,
9993,10000,10000};
signed int factory[17]={3,12,0,350,220,250,400,180,400,180,141,104,102,117,50,10};
signed int setting[17];
char arr[4];
struct
{
unsigned int batt_full:1;
unsigned int frstdisp:1;
unsigned int setup:1;
unsigned int gravity:1;
unsigned int onflag:1;
unsigned int vcorrect:1;
unsigned int chrcorrect:1;
unsigned int chon:1;
unsigned int swon:1;
unsigned int nofeed:1;
unsigned int shorttrip:1;
unsigned int zincfail:1;
unsigned int mainsok:1;
unsigned int lbwarn:1;
unsigned int olwarn:1;
unsigned int olcut:1;
unsigned int lbcut:1;
unsigned int fault:1;
unsigned int hiload:1;
unsigned int msgrtn:1;
unsigned int chrmsgrtn:1;
unsigned int firston:1;
unsigned int fan_error:1;
unsigned int over_battery:1;
unsigned int ntc_fail:1;
}flags;
unsigned int chshoot;
unsigned int chshootdly=0;
unsigned int flicker=0;
int *adjust;
char *ptr;
int adj;
int *value;
unsigned int chadj;
unsigned int champs1;
signed int duty_cycle_1;
signed int p=0,flag=1,rising=1;
signed int pr=0,kflag=1,rising1=1;
unsigned int amplitude=0;
unsigned int pb,qb,cth,ctl;
unsigned int pb,qb,cth,ctl;
////////////////////////////////
/*
///my settings to display load in wattage//
unsigned int overload_1;
unsigned int overload_2;
unsigned int max_load;
unsigned int total_load;
unsigned int load_decimal;
unsigned int ld_p;
*/
///////////////////////////////
unsigned int battery_full;
unsigned int setdly;
unsigned int menudelay;
unsigned int lcdtmr;
unsigned int lcdtmr1;
unsigned int counter;
unsigned int resumedelay;
unsigned int buzzcount;
unsigned int buzzdelay;
unsigned int buzzoftme;
unsigned int buzzontme;
unsigned int peakfail;
unsigned int oldelay;
unsigned int tripdly;
unsigned int rounds;
unsigned int chrdly;
unsigned int slowdly;
unsigned int fbdly;
unsigned int ctfaildly;
unsigned int deadshortdly;
unsigned int lbdly;
unsigned int acdly;
unsigned int keydly;
unsigned int msgrtndly;
unsigned int gravitydly;
unsigned int fltdly;
unsigned int blinkdly;
unsigned int startdly;
////////////////////////////////
unsigned long endtimer;
unsigned long controlavg;
unsigned long mainsavg;
unsigned long outavg;
unsigned long wattsavg;
unsigned long batavg;
unsigned long keyavg;
unsigned long heatavg;
unsigned int modeavg;
/////////////////////////////////
unsigned int indummy;
unsigned int outdummy;
unsigned int ctdummy;
unsigned int keys;
unsigned int ntcvalue;
unsigned int batts;
unsigned int batrecharge;
//////////////////////////////////
//////////////////////////////////
unsigned int total_loaddisp;
unsigned int loaddisp;
unsigned int acoutdisp;
unsigned int mainsdisp;
unsigned int battdisp;
unsigned int battvolts;
unsigned int batrestart;
unsigned int loadpercent;
unsigned int champs;
unsigned int chdisp;
unsigned int mainsvolt;
unsigned int acout;
unsigned int keyvalue;
unsigned int key;
unsigned int heat;
unsigned int post;
unsigned int err;
unsigned int cherr;
unsigned int prect;
unsigned int initcount;
int yaxis;
///////////////////////////////////
signed int upspeak;
signed int acpeak;
signed int ctpeak;
signed int batclb;
signed int mainsclb;
unsigned int chrclb;
unsigned int loadclb;
unsigned int pdctemp;
////////////////////////////////////
unsigned int deadshort;
unsigned int controlvolt;
unsigned int setvout;
unsigned int setchramp;
unsigned int setoverload;
unsigned int setupshi;
unsigned int setupslo;
unsigned int setinvhi;
unsigned int setinvlo;
unsigned int setbatful;
unsigned int setbatwrn;
unsigned int setbatlo;
unsigned int setbatres;
unsigned int defaults;
unsigned int setmaxwatts;
/////////////////////////////////////
unsigned int x,y,u;
unsigned long Ax,bx,Wt;
unsigned int aclo;
unsigned int achi;
unsigned int zinc;
/////////////////////////////////////
void InitADC1();
extern void Eeprom_WriteWord(unsigned short pushAddressOffset, unsigned short value);
extern unsigned short Eeprom_ReadWord(unsigned short pushAddressOffset);
void delay_ms(unsigned int gs);
void delay_ms(unsigned int gs);
void delay_us(unsigned int gs);
///////////////////////////////////////////////
const char str0[17]= "SYSTEM SETTINGS" ;
const char str20[17]=" BATTERY : V" ;
//const char str24[17]="SWITCH IS ON ";
const char str25[17]="MAINS INPUT: V";
const char str26[17]=" OUTPUT : V ";
const char str27[17]=" LOAD : % ";
//////////////////////////////////////////
const char str29[17]="SORRY BATT. LOW" ;
const char str30[17]="WAS OVERLOADED " ;
const char str31[17]="SHORT CCT FAULT" ;
const char str32[17]=" LOW BATTERY" ;
const char str33[17]=" OVER LOADING" ;
const char str34[17]=" NO OUTPUT " ;
const char str35[17]="TRIP:SYNC FAULT ";
const char str36[17]="CHRGING.CUR: ";
const char str38[17]="MANY CIRCUITS ";
//const char str40[17]=" FAULT";
const char str41[17]=" CHECK OUPUT ";
const char str42[17]=" CHK FET/FORMER ";
const char str43[17]=" SYSTEM IS OFF ";
const char str44[17]="! REDUCE LOAD ";
const char str45[17]="CONNECT CHARGER ";
const char str46[17]=" AUTO START ON ";
const char str47[17]=" CHARGING MODE ";
const char str48[17]="BATTERIES ERROR ";
const char str49[17]="REDUCE BATTERIES";
const char str50[17]="BATTERY IS FULL ";
const char str51[17]="CHGING COMPLETE ";
//const char str52[17]="LOAD: WATT";
const char str53[17]="TEMPERATURE HIGH";
const char str54[17]=" CHECK FAN" ;
const char str55[17]="HEAT SENSOR ERR" ;
const char str56[17]=" CHECK NTC ";
const char str58[17]=" COMPLETE" ;
#include "lcdsoft.h"
#include "functions.h"
void clear_flag();
void trip(int s);
int getvalue(int ch);
void chargeron();
void chroff();
void invon();
void invoff();
void stabilise();
void Modulate();
void find_key();
int findpeak(int ct);
void mains_stat_check();
void find_mainsvolt();
void find_batvolt();
void find_champs();
void find_upsvolt();
void find_load();
void overload_check();
void lobat_check();
void lobat_check();
void chr_stabilize();
////////////////////////////////////
void feed_buzz(int a,int b,int c)
{
buzzdelay=0;
buzzoftme=b;
buzzontme=a;
buzzcount=c;
}
//////////////////////////////////////////////////////
void __attribute__((__interrupt__,no_auto_psv)) _FLTAInterrupt(void)
{
_FLTAIF = 0;
}
//////////////////////////////////////////////////////////
void __attribute__((__interrupt__, __auto_psv__)) _T1Interrupt(void)
{
_T1IF = 0; // Clear interrupt flag
if(PORTEbits.RE8==0)
{
fltdly++;
if(fltdly>3000)
{
flags.olcut=1;
__asm__ volatile ("reset");
}
}
counter++;
acpeak=getvalue(0); //4.4 us
indummy=acpeak;
acpeak=indummy508;
if(acpeak<0)
{
acpeak=508indummy;
if(!flags.onflag)
{
rising=0;
flag=0;
}
}
mainsavg+=acpeak;
if(flags.setup)
{
OVDCON= 0X0000;
change=0;
buzzer=0;
}
if(!flags.setup)
{
if((indummy<600)&&(indummy>400)&&(flags.swon))
{
if(peakfail<150)
{
peakfail++;
}
if(peakfail==149)
if(peakfail==149)
{
if(flags.vcorrect)
{
invon(150);
}
}
}
else
{
peakfail=0;
}
if(flags.onflag)
{
Modulate(); //4.4 us ///MODULATE SINE PWM OVER 50 HZ/////////////
upspeak=getvalue(1); //4.4 us
outdummy=upspeak;
upspeak=outdummy508;
if(upspeak<0)
upspeak=508outdummy;
outavg+=upspeak;
if(upspeak<150)
{
fbdly++;
if(fbdly>30000) // IF NO FEED BACK DETECTED///////////////
{
flags.fault=1; // TRIP: FB FAULT
trip(5);
}
}
else
fbdly=0;
}
else
{
rising=1;
flag=1;
loadpercent=0;
acout=0;
}
ctpeak=getvalue(2);
if(flags.onflag)
{
if((ctpeak>750)||(ctpeak<250))
{
deadshortdly++; //OUTPUT DEAD SHORT TRIP//////////SHORT CKT FAULT
if(deadshortdly>1500)
{
deadshort=1;
OVDCON= 0X0000;
trip(1);
}
}
}
else
{
if(flags.chon==1)
if(flags.chon==1)
{
if((ctpeak<508)||(ctpeak>512))
ctfaildly=0;
else
{
ctfaildly++;
if(ctfaildly>10000) // IF CT FEEDBACK FAIL, CHARGER OFF!
{
chroff();
}
}
}
}
if(ctpeak>506)
{
pb=ctpeak506;
if(cth<pb)
cth=pb;
}
if(ctpeak<506)
{
qb=506ctpeak;
if(ctl<qb)
ctl=qb;
}
wattsavg+=cth+ctl;
ctl=cth=0;
heat=getvalue(3); // GET NTC VALUE FOR FAN FUNCTION
}
batavg+=getvalue(5);
lcdtmr1++;
lcdtmr++;
if(counter==359)////////////////////// 20 milli sec checking sequence /////////////////
{
mainsvolt=__builtin_divud(mainsavg,288)+mainsclb; //2.2 microseconds
mainsavg=0;
if(mainsvolt<90)
{
mainsvolt=0;
mainsdisp=0;
}
else
{
if((indummy>180)&&(indummy<900))
{
if(mainsdisp==0)
{
mainsdisp=mainsvolt80;
}
if(mainsdisp<mainsvolt2)
{
mainsdisp++;
}
if(mainsdisp>mainsvolt+2)
if(mainsdisp>mainsvolt+2)
{
mainsdisp;
}
}
}
find_batvolt(); //get battery voltage
keyavg+=getvalue(4); // get switch status
keydly++;
if(keydly==10)
find_key();
if(!flags.setup)
{
mains_stat_check(); // mains voltage status checking
if(flags.onflag==1)
{
acout=__builtin_divud(outavg,285);
outavg=0;
if(acoutdisp<acout2)
acoutdisp++;
if(acoutdisp>acout+2)
acoutdisp;
find_load();
overload_check();
lobat_check();
}
}
wattsavg=0;
if(buzzcount>0)
{
buzzdelay++;
if(buzzdelay<=buzzontme)
buzzer=1;
else
{
buzzer=0;
if(buzzdelay>=buzzoftme)
{
buzzdelay=0;
buzzcount;
fltdly=0;
}
}
}
else
{
FLTACON=0x0001;
IEC2bits.FLTAIE = 1;
if(rounds>0)
{
if((!flags.onflag)&&(flags.swon)&&(rounds<4))
{
if(mainsvolt<110)
{
{
clear_flag();
invon(0);
}
}
}
if(rounds==4)
change=0;
}
if(!flags.setup)
{
if(flicker==0)
{
if((resumedelay==200)||(flags.mainsok==1))
{
LCD_DB6=1;
if(flags.swon==1)
{
blinkdly++;
if(blinkdly<30)
LCD_DB7=1;
else
LCD_DB7=0;
if(blinkdly>60)
blinkdly=0;
}
else
LCD_DB7=0;
}
else
{
LCD_DB6=0;
if(flags.onflag==1)
LCD_DB7=1;
else
LCD_DB7=0;
}
}
if((key==modekey)&&(flags.setup==0))
{
menudelay++;
if(menudelay>124)
flags.setup=1;
}
else
menudelay=0;
}
if(flags.setup==1)
{
setdly++;
if(setdly>3000)
__asm__ volatile ("reset");
}
counter=0;
}
cherr=mainsvolt;
cherr=mainsvolt;
}
//////////////////////////////////////
void init_PWM()
{
PTCON= 0XE003;
PTMR = 0x0000;
PTPER = PDC1=PDC2= 1230; //20 khz pwm
SEVTCMP = 0x0000;
PWMCON1 = 0x0033;
PWMCON2 = 0x0000;
DTCON1= 0X0059; // 3.5 us dead band delay
FLTACON = 0x0000;
OVDCON= 0X0000;
PTCONbits.PTEN = 1;
IEC2bits.PWMIE = 0; // disable PWM interrupts
T1CON = 0XE000;
TMR1 = 0;
PR1 = 1355; //20 khz timer
_T1IF = 0;
_T1IE = 1; // enable timer interrupts
}
/////////////////////////////////////////////////
void memread()
{
int x;
for(x=0;x<16;x++)
{
setting[x]=Eeprom_ReadWord(x);
}
}
//////////////////////////////////////////////////////////
void memwrite()
{
int x;
for(x=0;x<16;x++)
{
if(flags.setup==0)
Eeprom_WriteWord(x,factory[x]);
else
Eeprom_WriteWord(x,setting[x]);
}
}
//////////////////////////////////////////////
/*
void modedisp()
{
if(flags.msgrtn)
return;
if((key==upsmode)||(key==stbyups))
{
//printmes(str22,100,1); //"\fU.P.S MODE ON";
if(key==upsmode)
{
aclo=setupslo;
achi=setupshi;
}
}
}
}
//if((key==invmode)||(key==stbyinv));
//"\fINVERTER MODE ON";
}*/
//////////////////////////////////////////////////////
/*void swdisp()
{
if(flags.msgrtn)
return;
if((key==stbyinv)||(key==stbyups)) //"\fSBY SWITCH OFF";
{
aclo=setinvlo;
achi=setinvhi;
}
}
*/
// MAIN ROUTINE
//*****************************************************************************/
int main()
{
TRISF=0X0000;
TRISE=0X010F;
TRISD=0X0000;
TRISC=0X0000;
TRISB=0XFFFF;
OVDCON=0X0000;
PWMCON1 = 0x0000;
PTCONbits.PTEN = 0;
buzzer=0;
lcd_init();
InitADC1();
init_PWM();
keyvalue=getvalue(4);
if(((keyvalue>660)&&(keyvalue<680))||((keyvalue>560)&&(keyvalue<575)))
{
flags.swon=1;
flags.firston=1;
}
prect=getvalue(2);
flags.frstdisp=0;
defaults=Eeprom_ReadWord(14);
if(defaults!=50)
{
memwrite();
}
while(1)
{
while(PORTEbits.RE7==0)
{
flags.msgrtn=0;
printmes(str31,100,1); // SHORT CKT FAULT
printmes(str41,100,2); // check output
printmes(str41,100,2); // check output
if(flags.swon==0)
__asm__ volatile ("reset");
}
while(flags.nofeed==1)
{
flags.msgrtn=0;
printmes(str34,100,1); // NO FEED BACK
printmes(str42,100,2); // CHK FET/FORMER
if(flags.swon==0)
__asm__ volatile ("reset");
while(flags.lbcut==1)
{
flags.msgrtn=0;
printmes(str29,100,1); //" TRIP:LOWBATTERY ";
printmes(str43,100,2); //SYSTEM IS OFF;
if((flags.swon==0)||(resumedelay>175))
__asm__ volatile ("reset");
}
while((flags.olcut==1)||(flags.olwarn))
{
flags.msgrtn=0;
printmes(str30,100,1); //" TRIP:OVERLOAD ";
printmes(str44,100,2); // PLS REDUCE LOAD
if((flags.swon==0)||(resumedelay>175))
__asm__ volatile ("reset");
}
while(flags.olwarn)
{
flags.msgrtn=0;
//printmes(str33,100,1); //" WARN:OVERLOAD ";
printmes(str44,100,2); // PLS REDUCE LOAD
if(flags.swon==0)
__asm__ volatile ("reset");
}
while(flags.lbwarn==1)
{
flags.msgrtn=0;
feed_buzz(2,50,25);
printmes(str32,100,1); //"WARN:LOWBATTERY";
printmes(str45,100,2); //CONNECT CHARGER
printmes(str20,1,2); //battery
if(flags.swon==0)
__asm__ volatile ("reset");
}
if(!flags.onflag==1)
{
//printmes(str59,100,1); //"\fTITLE NAME
printmes(str38,100,1); //"\fTITLE NAME
printmes(str43,100,2); // //"\system is off:";
printmes(str20,1,1); // 0/0/"\fBATTERY V:";
}
if(mainsvolt>aclo+10)
{
printmes(str25,2,2); // //"\fMAINS VOLT:";
}
while(flags.chon==1)
{
if(champs==0)
goto outmes;
printmes(str36,3,1); //"AC CHARGR:";
printmes(str20,1,2); // 0/0/"\fBATTERY V:";
printmes(str25,2,2); //"\fMAINS VOLT:"
if((change==0)&&(flags.swon==1))
{
printmes(str25,2,2); //"\fMAINS VOLT:"
}
if((battvolts>=setbatful)&&(champs<=40))
{
printmes(str50,100,1); // battery is full
// printmes(str51,100,2); //charging complete
}
}
outmes:
if((key==upsmode)||(key==invmode))
{
if(flags.onflag==1)
{
lcd_init();
printmes(str26,0,1); //"\fINVERTER V:";
printmes(str27,4,2); //"\fTOTAL LOAD:";;
printmes(str20,1,1); // 0/0/"\fBATTERY V:"
//printmes(str25,2,2); // //"\fMAINS VOLT:";
//printmes(str52,4,2); //"\fTOTAL WATT:";
}
}
/*else
{
//modedisp();
//swdisp();
printmes(str25,2,2); //"\fMAINS VOLT:";
}
*/
if(heat<=fanheat65)
{
feed_buzz(20,48,25);
printmes(str53,100,1);
printmes(str54,100,2);
if(flags.swon==1)
__asm__ volatile ("reset");
}
if(heat>=fanheat+320)
{
feed_buzz(2,48,25);
printmes(str55,100,1);
printmes(str55,100,1);
printmes(str56,100,2);
if(flags.swon==1)
__asm__ volatile ("reset");
}
if(battvolts>155)
{
printmes(str48,100,1); ///over battery
printmes(str49,100,2);
}
if(menudelay>=125)
{
flags.setup=1;
menudelay=0;
printmes(str0,100,1); //"\fCALIBRATION MENU";
while(key==modekey);
while(1)
{
if(key==modekey)
{
setchramp=setting[5]/10;
loadclb=setting[3];
functions();
memwrite();
flags.setup=0;
__asm__ volatile ("reset");
}
}
//main
///////////////////////////////////////////////////////////////////////////////////////
void InitADC1()
{
ADPCFG = 0; // Lowest 6 PORTB pins are analog inputs
ADCON1 = 0; // Manually clear SAMP to end sampling, start conversion
ADCON2 = 0; // Voltage reference from AVDD and AVSS
ADCON3 = 0x0003; // Manual Sample, ADCS=5 > Tad = 3*Tcy
ADCON1bits.ADON = 1; // Turn ADC ON
}
//////////////////////////////////////////
void delay_ms(unsigned int gs)
{
while(gs)
{
__delay32(55000);
}
///////////////////////////////////////////////////////////
void delay_us(unsigned int gs)
void delay_us(unsigned int gs)
{
while(gs)
__delay32(3000);
}
int getvalue(int ch)
{
ADCON1bits.DONE=0;
ADCHS = ch;
ADCON1bits.SAMP = 1;
__delay32(50);
ADCON1bits.SAMP = 0;
while (!ADCON1bits.DONE);
return ADCBUF0;
}
//////////////////////////////////
void clear_flag()
{
flags.olwarn=0;
flags.lbwarn=0;
flags.olcut=0;
flags.lbcut=0;
flags.nofeed=0;
flags.zincfail=0;
}
////////////////////////////////////
void trip(int s)
{
invoff();
clear_flag();
if(s==1)
flags.olcut=1;
if(s==2)
flags.lbcut=1;
if(s==4)
flags.zincfail=1;
if(s==5)
flags.nofeed=1;
if(s>2)
{
feed_buzz(8,48,25);
flags.fault=1;
rounds=0;
}
else
{
rounds++;
feed_buzz(8,48,25);
}
flags.msgrtn=1;
}
/////////////////////////////////////
void chargeron()
{
if(heat>=fanheat+300)
return;
if(heat<=fanheat60)
return;
if(flags.onflag)
return;
chdisp=0;
if(battvolts<90)
if(battvolts<90)
return;
if(battvolts>155)
return;
if(flags.chon==1)
return;
if(mainsvolt<150)
return;
if(chrdly<500)
chrdly++;
if(chrdly==499)
{
if(flags.gravity==1)
{
if(battvolts>batrestart)
{
chrdly=0;
return;
}
gravitydly++;
if(gravitydly<20)
{
chrdly=0;
return;
}
gravitydly=0;
}
flags.gravity=0;
PTCON= 0XE002;
PTPER = 615;
PWMCON1 = 0x0330;
OVDCON=0X0A05;
DTCON1=0X0000;
PDC1=PDC2=0;
flags.chon=1;
chrdly=0;
endtimer=0;
}
}
///////////////////////////////////////
void chroff()
{
OVDCON = 0x0000;
PWMCON1 = 0x0033;
DTCON1=0X0030;
PTPER = 1230;
PDC1=PDC2=0;
flags.chon=0;
champs=0;
chrdly=0;
}
/////////////////////////////////////////////////
void chr_stabilize()
{
int kdly;
if(flags.onflag)
return;
if(mainsvolt>cherr+5)
{
{
chroff();
return;
}
if((battvolts>155)||(battvolts<90))
{
chroff();
return;
}
if(mainsvolt<150)
{
chroff();
return;
}
//////////////////////////////////////////////////////////////
if(battvolts>setbatful+1)
{
flags.chrcorrect=1;
if(champs>35)
{
PDC1;
PDC2;
}
}
if(champs<30)
kdly=0;
else
kdly=4;
if(battvolts<=setbatful)
{
if(flags.chrcorrect==0)
{
slowdly++;
if(slowdly<kdly)
return;
slowdly=0;
}
if(champs<setchramp)
{
if(PDC1<900)
{
PDC1++;
PDC2++;
if(flags.chrcorrect==0)
{
if((champs<35)&&(champs>25))
flags.frstdisp=1;
}
}
}
if(champs>setchramp)
{
{
flags.chrcorrect=1;
if(PDC1>1)
{
PDC1;
PDC2;
}
}
}
}
//void batt_full()
//{
// if((battvolts>=setbatful+1)&&(champs<=40))
// flags.batt_full=1;
//}
////////////////////////////////////////////////
void find_champs()
{
x=__builtin_divud(wattsavg,359); //1.03 microseconds
Ax=__builtin_muluu(x,mainsdisp);
bx=__builtin_divsd(Ax,battvolts);
Ax=__builtin_muluu(bx,1000);
bx=__builtin_divsd(Ax,450chrclb);
champs=bx;
if(flags.chrcorrect==1)
{
chshootdly++;
if(chshootdly==20)
{
if(setchramp>chshoot)
setchramp;
chshootdly=0;
}
}
if(champs<10)
{
champs=0;
chdisp=0;
}
if((battvolts<setbatful+2)&&(champs>35))
{
if(chdisp<champs1)
chdisp++;
if(chdisp>champs+1)
chdisp;
endtimer=0;
}
if((battvolts>=setbatful+2)&&(champs<35))
{
endtimer++;
if(endtimer>100)
{
if(chdisp>12)
chdisp;
chdisp;
else
{
flags.gravity=1;
chroff();
}
endtimer=0;
}
}
if(chdisp>chshoot)
chdisp=chshoot;
pb=qb=ctl=cth=0;
}
//////////////////////////////////////
void invon(int k)
{
if(heat>=fanheat+300)
return;
if(heat<=fanheat60)
return;
if(battvolts>155)
return;
if(flags.olcut==1)
return;
if(flags.lbcut==1)
return;
if(flags.fault==1)
return;
if(flags.setup)
return;
if(flags.onflag)
return;
OVDCON = 0x0000;
flags.onflag=1;
flags.chon=0;
IEC2bits.FLTAIE = 0;
FLTACON=0x0000;
ctfaildly=0;
fbdly=0;
lbdly=0;
oldelay=0;
deadshortdly=0;
chrdly=0;
champs=0;
ctfaildly=0;
loadpercent=0;
resumedelay=0;
deadshort=0;
flags.gravity=0;
if(flag==0)
p=90;
else
p=0;
p=0;
amplitude=k;
buzzontme=51;
buzzcount=1;
buzzdelay=0;
controlavg=u=0;
change=1;
PWMCON1 = 0x0033;
DTCON1=0X0059;
PTPER = 1230;
OVDCON = 0x0F0f;
}
////////////////////////////////////
void invoff()
{
if(flags.onflag==0)
return;
flags.onflag=0;
OVDCON = 0x0000;
buzzer=0;
flags.vcorrect=0;
counter=0;
}
//////////////////////////////////////////////////
void stabilise()
{
controlvolt=__builtin_divud(controlavg,90);
controlvolt+=43;
if(controlvolt<setvout)
{
err=setvoutcontrolvolt;
if(flags.vcorrect)
amplitude+=err;
else
amplitude++;
}
else
{
flags.vcorrect=1;
}
if(controlvolt>setvout)
{
err=controlvoltsetvout;
if(flags.vcorrect)
amplitude=err;
}
controlavg=0;
}
///////////////////////////////////////
void Modulate()
{
if(flags.onflag==0)
return;
if(rising==1)
{
p++;
if((mainsvolt<50)&&(flags.mainsok==0))
{
if(p==45)
if(p==45)
{
if(flag==1)
{
if(outdummy<200)
{
trip(4);// flags.zincfail=1;
}
}
}
}
u++;
controlavg+=upspeak;
}
if(p==91)
{
rising=0;
p=90;
u=0;
stabilise();
if(resumedelay==200)
{
if((indummy<400))
{
IEC2bits.FLTAIE = 0;
FLTACON=0x0000;
flags.mainsok=1;
change=0;
__delay32(50000);
flags.onflag=0;
OVDCON = 0x0000;
feed_buzz(10,50,3);
peakfail=0;
resumedelay=0;
}
}
}
if(rising==0)
{
p;
u++;
controlavg+=upspeak;
}
if(p<0)
{
rising=1;
p=0;
u=0;
stabilise();
if(flag==1)
{
flag=0;
}
else
{
{
flag=1;
}
}
duty_cycle_1=sine_table[p];
duty_cycle_1=((long)duty_cycle_1*amplitude)>>11;
if(duty_cycle_1>1230)
{
duty_cycle_1=1230;
}
if(duty_cycle_1<=0)
{
duty_cycle_1=0;
}
if(flag==1)
{
PDC1=1230+duty_cycle_1;
PDC2=1230duty_cycle_1;
}
if(flag==0)
{
PDC1=1230duty_cycle_1;
PDC2=1230+duty_cycle_1;
}
}
////////////////////////////////////////
void find_key()
{
keyvalue=__builtin_divsd(keyavg,10);
keyavg=0;
keydly=0;
if(keyvalue>750)
{
key=7;//stbyups;
if(keyvalue>850)
{
key=1;//stbymode;
}
if(flags.swon==1)
{
flags.swon=0;
if((!flags.chon)&&(!flags.setup))
__asm__ volatile ("reset");
}
flags.firston=1;
peakfail=0;
aclo=setinvlo;
achi=setinvhi;
return;
}
if((keyvalue>510)&&(keyvalue<530))
{
key=4;//modekey
setdly=0;
return;
}
if(flags.setup)
{
if((keyvalue>680)&&(keyvalue<705))
{
key=6;//downkey
setdly=0;
return;
}
if((keyvalue>590)&&(keyvalue<610))
{
key=5;//upkey
setdly=0;
return;
}
}
if((keyvalue>660)&&(keyvalue<700))
{
if(flags.swon==0)
{
flags.swon=1;
if(resumedelay==0)
invon(0);
}
aclo=setinvlo;
achi=setinvhi;
key=3;//invmode
return;
}
if((keyvalue>560)&&(keyvalue<575))
{
if(flags.swon==0)
{
flags.swon=1;
if(resumedelay==0)
invon(0);
}
aclo=setupslo;
achi=setupshi;
key=2;//upsmode;
return;
}
}
//////////////////////////////////////////////////
void mains_stat_check()
{
if(flags.fault==1)
return;
if((mainsvolt>aclo+10)&&(mainsvolt<achi10))
{
if(resumedelay<200)
resumedelay++;
if(resumedelay==199)
{
clear_flag();
rounds=0;
setchramp=setting[5]+40;
setchramp=setting[5]+40;
}
if((key==3)||(key==2))
{
if(flags.firston==1)
{
flags.vcorrect=1;
flags.firston=0;
}
}
if(!flags.onflag)
{
if(resumedelay==200)
{
change=0;
if(flags.chon==0)
{
slowdly=0;
chargeron();
flags.chrcorrect=0;
}
else
{
find_champs();
chr_stabilize();
}
}
}
}
else
{
if((mainsvolt<aclo)||(mainsvolt>achi))
{
if(flags.chon)
chroff();
flags.mainsok=0;
resumedelay=0;
if(flags.firston==0)
{
if((key==3)||(key==2))
{
startdly++;
if(startdly>10)
{
invon(150);
startdly=0;
}
}
else
startdly=0;
startdly=0;
}
}
}
}
/////////////////////////////////////////////////
void find_batvolt()
{
battvolts=__builtin_divsd(batavg,366); ///1.307 microseconds
__asm__ volatile ("mov _battvolts, w3");
__asm__ volatile ("mov #0xffff, w1");
__asm__ volatile ("mul.uu w3,w1,w2");
__asm__ volatile ("mov w3,_battvolts");
battvolts+=batclb+17;
batavg=0;
if(battdisp<battvolts)
battdisp++;
if(battdisp>battvolts)
battdisp;
if(battvolts>=setbatful+1)
battdisp=setbatful+1;
}
////////////////////////////////////////////////
////////////////////////////////////////////////
void find_load()
{
x=__builtin_divud(wattsavg,loadclb); //1.03 microseconds
Ax=__builtin_muluu(x,125);
bx=__builtin_divud(Ax,100); //2.25 microseconds
x=bx ;
loadpercent=x; // 1.2 microseconds
if(loadpercent<10)
{
loadpercent=0;
loaddisp=0;
}
if(loaddisp<loadpercent)
loaddisp++;
if(loaddisp>loadpercent)
loaddisp;
}
/////////////////////////////////////////////////
void overload_check()
{
if(flags.fault==1)
return;
if(loadpercent>=100)
{
oldelay++;
if(loadpercent>110)
tripdly=20;
else if(loadpercent>105)
tripdly=40;
else
tripdly=60;
if(tripdly==60)
{
if(oldelay>tripdly)
{
if(!flags.lbwarn)
{
if(!flags.olwarn)
{
flags.olwarn=1;
if(!flags.lbwarn)
flags.msgrtn=1;
feed_buzz(10,50,7800);
}
}
}
}
else
{
if(oldelay>tripdly)
{
if(!flags.olcut)
{
trip(1);
}
}
}
}
else
{
if(flags.olwarn)
{
buzzer=0;
buzzcount=0;
flags.olwarn=0;
flags.msgrtn=0;
}
oldelay=0;
}
}
/////////////////////////////////////////////////
void lobat_check()
{
if(flags.fault==1)
return;
if(flags.onflag==0)
return;
if(battvolts<setbatwrn)
{
lbdly++;
if(lbdly>150)
{
if(!flags.lbwarn)
{
flags.olwarn=0;
flags.lbwarn=1;
flags.msgrtn=1;
}
}
if(battvolts<setbatlo)
{
trip(2);
}
}
}
else
lbdly=0;
if(battvolts>setbatwrn)
{
if(flags.lbwarn)
{
flags.lbwarn=0;
}
}
}
//////////////////////////////////////////////////////////////////////////////
By Opanin17 July 05, 2018
Labels: ELECTRONICS
32 comments:
Anonymous April 04, 2018
Hi there! I just want to give you a huge thumbs up for the excellent information you've got right here on this
post.
I will be returning to your site for more soon.
Reply
Unknown April 05, 2018
Good work, Thanks for presenting DSPIC30F2010 code on your site. it is very helpful.
Reply
Anonymous April 06, 2018
You actually make it appear really easy together with your presentation but I to find this topic
to be actually one thing that I think I'd by no means understand.
It kind of feels too complicated and extremely broad for me.
I'm looking forward for your next put up, I will attempt to get the dangle of it!
Reply
Anonymous April 07, 2018
Thanks for finally talking about >"PURE SINE WAVE INVERTER CIRCUIT WITH CHARGER DSPIC30f2010"
<Liked it!
Reply
Ehi April 20, 2018
can the above code be turn to hex with maplab
Reply
Anonymous April 22, 2018
can u turn the above code to hex with mplab
Reply
Replies
Opanin17 April 22, 2018
Yes you can
Reply
Anonymous April 25, 2018
Everything is very open with a clear description of the
issues. It was definitely informative. Your site is extremely helpful.
Thanks for sharing!
Reply
Anonymous April 27, 2018
Hey There. I found your blog using msn. This is a really well written article.
I will make sure to bookmark it and return to read more of your useful information. Thanks for the post.
I will certainly comeback.
Reply
Unknown April 28, 2018
Contact number please
Reply
Replies
Opanin17 April 28, 2018
00233273315313
Reply
Anonymous April 30, 2018
I ᴡant to to thak you for this wondeful гead!!
I certainly lovd every little bіt of it. I've g t you saved ɑs
a favorite to check ut neww things you post…
Reply
Anonymous May 10, 2018
Reply
Replies
Opanin17 June 03, 2018
Thanks
Reply
Anonymous May 23, 2018
Ηi,і feel tһat i noticed y u visited my weblog so i ggot heгe to return the prefer?.Ӏ am attempting toο
in finding issues to enhance my website!I guess іts ok to սse ѕome f your ideas!!
Reply
Anonymous May 30, 2018
Thank you for the insiteful content. I have shared
it on my twitter page.
Reply
Replies
Opanin17 June 03, 2018
Thanks also
Reply
Anonymous July 09, 2018
hello!,I really like your writing very so much!
proportion we be in contact extra approximately your article on AOL?
I require a specialist on this space to solve my problem.
Maybe that's you! Looking ahead to see you.
Reply
Anonymous July 19, 2018
Hi, I do believe this is an excellent site. I stumbledupon it ;)
I may come back yet again since i have bookmarked it. Money and freedom is
the best way to change, may you be rich and continue to
guide others.
Reply
Anonymous August 10, 2018
I like this site greatly,thanks
Reply
Frankonero September 13, 2018
your blog is wonderful. do you sell a completed board?
I reside in Nigeria
Reply
Replies
Opanin17 September 14, 2018
Yes i sell complete board (its plain so you assemble yourself)
Reply
Frankonero September 13, 2018
thanks
Reply
Unknown October 25, 2018
sir thanks so much pls your phone number a day ur whatsapp contact
Reply
Lijo varghese November 02, 2018
Thank you very much sir.I have one doubt, it it possible to change the charging current,changing voltage and
out put voltage of programed board, if it possible kindly give the detailed procedure for me.
Reply
Replies
Opanin17 November 02, 2018
yes. its very much possible. You can change all in settings menu
Reply
Aron Makhane December 06, 2018
Please someone clarify me about transformer connection in this diagram.
Reply
Unknown January 12, 2019
Hi,
I need a complete control board for a MUST inverter 24vdc/3kv,220VAC to replace my faulty one.Can you
help me ?
Reply
Replies
Opanin17 January 12, 2019
Do you need both control board and mosfet bridge board, or you want only the control board?
Kindly send me mail [email protected]
Opanin17 January 12, 2019
Do you need both control board and mosfet bridge board, or you want only the control board?
Kindly send me mail [email protected]
Reply
Mgani Jackson December 18, 2021
Good explaination but I have a question, you have mention that your selling source code,but at the same
time I see u have posted it openly,What does it means or may be these source code are not working, or
buying is just like donation, where its an option.
Reply
Anonymous April 15, 2022
The code have some missing library. its not the complete code
Reply
Enter Comment
TYPE YOUR QUESTION OR COMMENT HERE
Subscribe to: Post Comments (Atom)
Featured Post
MAKE INVERTER TRANSFORMER
Inverter transformers are just like any other power transformers except that inverter transformers works in the reversed
form of the standa...
EGS002 SINE WAVE INVERTER CIRCUIT
This is a simple sine wave inverter circuit without programming. Pure sine wave inverter circuit with
no center tap design has become sim...
MUST, POWER STAR, FELICITY INVERTER REPAIRS
Today am going to show you how to repair all the inverter brands that uses the control boards
below. MUST INVERTERS, FELICITY I...
DSPIC30f2010 PURE SINE INVERTER CIRCUIT WITH CHARGER
This is a highly reliable sine wave inverter circuit designed using digital signal processing IC
(DSP30f2010) made by microchip . ...
Contributors
ANNABEL
Opanin17
Simple theme. Powered by Blogger.