Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

pic16f72 pure sine wave inverter

Status
Not open for further replies.
(Possibly off topic)
Dan1138 - MPLAB is the IDE only; you really need to look at the compiler that did the actual work which was probably an old version of C18. MPASM typically codes as part of the compiler package (IIRC)
Using a supported compiler (XC8) and IDE (MPLABx) would be the way to go now.
Susan (being a bit picky!)
 

(Possibly off topic)
Dan1138 - MPLAB is the IDE only; you really need to look at the compiler that did the actual work which was probably an old version of C18. MPASM typically codes as part of the compiler package (IIRC)
For the 16-bit and 32-bit PIC targets you are absolutely correct. In the PIC 8-bit family the assembler is still part of the IDE installation. While the XC8 compiler has its own assembler (ASPIC) this is an undocumented (since the HI-TECH purchase by Microchip) assembler that has no useful support from Microchip.

The only "officially" supported assembler for 8-bit PIC devices is the MPASM tools.
 

please let us forget the attached code and circuit if no solution can come from it.
Now can someone help me write a program for a pure sine wave inverter using any pic of his choice and also the circuit diagram.
If it is possible to write the code using pic16f886 since i have about 10 pics of it, it would be better otherewise use any pic of ur choice to help me.
Thanks
Wissy.
 

Hi,

Now can someone help me write a program for a pure sine wave inverter
Yes, there will be people to help you wrting the code.

But helping means: you do the main job.
So what is your job? Not the schematic and not the hardware. ... as it seems.
Did you write down some specifications or a flow chart? When you give a job to a software engineer he needs the hardware or at least the schematic and a very detailed information what and how to do.

Klaus
 

Thanks Klaus, the previously circuit and its explaination is the concept i have in mind.
i need that generates 4 output signals from the MCU which will be sent to two MOSFET drivers ( ir2110) connected in bridge form.
when the voltage on the battery falls below 10.5v it beeps low battery and shut down the inverter.
also when mains is available it changes over to mains and start charging the battery through the bridge mosfet.
 

wissy, So far I have got from your posts, you lack the basic concept of SPWM inverter. So it will be a cumbersome job for you as well as for the well-wishers trying to help you to make a success of the project. You better to study related topic and grasp the idea. An excellent article posted by Tahmid Mahbub on this issue. here is the link.

https://tahmidmc.blogspot.in/2013/02/generation-of-sine-wave-without-eccp_16.html
 

thanks Swapan, this is the code from Tahmid


Code:
//----------------------------------------------------------------------------------------
//Programmer:  Syed Tahmid Mahbub
//Target Microcontroller: PIC16F877A
//Compiler: mikroC PRO for PIC (Can easily port to any other compiler)
//-----------------------------------------------------------------------------------------


unsigned char sin_table[32]={0, 25, 50, 75, 99, 121, 143, 163, 181,
198, 212, 224, 234, 242, 247, 250, 250, 247, 242, 234, 224, 212, 198,
181, 163, 143, 121, 99, 75, 50, 25,0};


unsigned int TBL_POINTER_NEW, TBL_POINTER_OLD, TBL_POINTER_SHIFT, SET_FREQ;
unsigned int TBL_temp;
unsigned char DUTY_CYCLE;

sbit MOSA at RD0_bit;
sbit MOSB at RD1_bit;
sbit MOSC at RD2_bit;
sbit MOSD at RD3_bit;

unsigned char FlagReg;
sbit Direction at FlagReg.B0;
//0 -> MOS A + D
//1 -> MOS B + C

void interrupt(){
     if (TMR2IF_bit == 1){
        TBL_POINTER_NEW = TBL_POINTER_OLD + SET_FREQ;
        if (TBL_POINTER_NEW < TBL_POINTER_OLD){
           //CCP1CON.P1M1 = ~CCP1CON.P1M1; //Reverse direction of full-bridge
           if (Direction == 0){
              MOSA = 0;
              MOSD = 0;
              MOSB = 1;
              MOSC = 1;
              Direction = 1;
           }
           else{
                MOSB = 0;
                MOSC = 0;
                MOSA = 1;
                MOSD = 1;
                Direction = 0;
           }
        }
        TBL_POINTER_SHIFT = TBL_POINTER_NEW >> 11;
        DUTY_CYCLE = TBL_POINTER_SHIFT;
        CCPR1L = sin_table[DUTY_CYCLE];
        TBL_POINTER_OLD = TBL_POINTER_NEW;
        TMR2IF_bit = 0;
     }
}

void main() {
     SET_FREQ = 410;
     PORTD = 0;
     TRISD = 0;
     PR2 = 249; // 16kHz
     CCPR1L = 0;
     CCP1CON = 12; //PWM mode
     TRISC = 0xFF;
     TMR2IF_bit = 0;
     T2CON = 0x04; //TMR2 on
     while (TMR2IF_bit == 0);
     TMR2IF_bit = 0; //Clear TMR2IF
     PORTC = 0;
     TRISC = 0;
     TMR2IE_bit = 1;
     GIE_bit = 1;
     PEIE_bit = 1;
    
     while (1);
    
}

please can i use any other MCU? if yes, do i need any change in the program?
i can match the pins of pic16f877a to pic16f886 but do i need any alteration in the code?
 
Last edited by a moderator:

please can i use any other MCU? if yes, do i need any change in the program?
i can match the pins of pic16f877a to pic16f886 but do i need any alteration in the code?

This was already answered almost 3 days ago, but you are apparently disregarding or not reading others recomendations; In addition, I have not seen significant progress on your own so far, on the contrary, only a recurring attempt that others do what is expected of you, which should read dataseets and implement for yourself what has been recommended; I think you will lose less of yours and others time if you start with another project having the required specifications, once for free nobody will do what you want, at least it is not the way things work on forums.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top