Interfacing MOSFET to PIC 16F1827

Status
Not open for further replies.

jean12

Advanced Member level 2
Joined
Aug 27, 2013
Messages
529
Helped
5
Reputation
12
Reaction score
6
Trophy points
18
www.ntigltd.com
Activity points
5,497
Hello,there I want ot control my H-bridge with a PIC16F1827 but I am having a problem.
I generated with the PIC16F1827 a PWM signal as described in TAHMID's blog but I don't have the MOSFET drives so I want to design them with BJT transistors,can anyone of you help me to do that?
So that I can interface my PIC to that H_Bridge?

Please help.

Thanks.
 

What is the H bridge you are controlling? Have you designed it from discrete parts, or is it an integrated component? What voltages are you operating the bridge and load with? Do you need high voltage isolation? Without knowing some of these things it is difficult to give you specific part numbers and values that would be cost effective.
I look at Tahmid's blog (if I found the one you are referring to) and I see that he has basic circuits on his blog pages for driving MOSFETs for low and high side drivers, and the ones I looked at appear to be correct. you could also use a logic-level compatible high/low side MOSFET driver integrated chip, such as IR2110 - IR211x, unless you have higher frequency needs or other specific requirements.
Without more specific information, it is not possible to provide a specific answer.
 

Hello,thanks for your reply,the H-bridge is made up by discrets components 4 MOSFET which is switching 300VDC,and I need the output of 220VAC.
The MOSFET drive I have which I can use is HV400IP and then those are commanded by a PIC which must give a SPWM signal at 16KHZ.
But When reading Tahmid's blog also it has been very difficult for me to create the SPWM with ECCP module of PIC16F1827.If you know something on it you can help me on that also.

Thanks.
 

The HV400IP is an older part, and from what I can tell it is going obsolete. It does need 15mA - 22mA on its input pins, fortunately the PIC 16F1827 can support up to 25mA on its output pins, assuming you are using ECCP1 on the part for full bridge capability. I am not familiar with using the ECCP1 port on these PIC for driving bridge circuits with the HV400IP, but I would also check that your code does properly configure the PWM operation and pins, and also doesn't attempt to perform any read-modify-writes on that port as I/O during operation. Can you try changing the PWM frequency and see if the waveforms look the same, only with different period?

A schematic including the MOSFETs would be helpful to observe for analog circuit problems. Also. Depending on how your circuitry is wired/layed out, the large HV current pulses could potentially be going into the logic ground return and glitching the PIC's outputs & ground reference. Try using lower voltage < 300VDC and lower frequency, and/or ensure that the MOSFET current ground path returns to the HV DC supply return before encountering the PIC ground connection or PIC's logic VCC supply in the wiring layout.
 

The 300VDC is a must be the great problem is that I am not even getting the signal only with the PIC on the project board.
So if you can help me to solve the issue of just generating the SPWM you can help.

Thanks.
 

Hello jayanth.devarayanadurga, I used the transistors but no success, I get the MOSFET drive HV400IP are the one I am gonna trying with but I am not sure if they will help.

Any suggestion?

Please help!!
 

I want to generate an SPWM signal with PIC16F1827 which I can use for controlling the H_Bridge,I am referring to Tahmid's blog https://tahmidmc.blogspot.com/2012/10/generation-of-sine-wave-using-spwm-in_10.html but calculating the Sine_Table values is a problem for me.
Can you help on those values ?
I am using a quartz of 12MHz,PIC16F1827 and I want to control the H_Bridge at 50Hz but generating a sginal of 16KHz.

Thanks.
 

No no,I think it has to change because I am not getting the good output graph when I maintain the one here on the web,but also the main problem may be coming from the SET_FREQ value =256and TBL_POINTER_SHIFT = TBL_POINTER_NEW >> 10;;unfortunately with the calculations using the formula Tahmid has showed I am getting bad graph .

Please consider my codes here:
PHP:
unsigned char sin_table[64]={0, 12, 25, 37, 50, 62, 74, 86, 97, 108,
 120, 130, 141, 151, 161, 170, 179, 187, 195, 203, 210, 217, 222, 
 228, 233, 237, 241, 244, 246, 248, 249, 250, 250, 249, 248, 246, 
 244, 241, 237, 233, 228, 222, 217, 210, 203, 195, 187, 179, 170, 161, 151,
 141, 130, 120, 108, 97, 86, 74, 62, 50, 37, 25, 12,0};


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

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
        }
        TBL_POINTER_SHIFT = TBL_POINTER_NEW >> 10;
        DUTY_CYCLE = TBL_POINTER_SHIFT;
        CCPR1L = sin_table[DUTY_CYCLE];
        TBL_POINTER_OLD = TBL_POINTER_NEW;
        TMR2IF_bit = 0;
     }
}

void main() {
     SET_FREQ = 256;
     TBL_POINTER_SHIFT = 0;
     TBL_POINTER_NEW = 0;
     TBL_POINTER_OLD = 0;
     DUTY_CYCLE = 0;
      PR2=149; ///for 20Khz at 12MHZ of quartz
      TRISB=0x00;
    // CCP1CON=0x4D;
       CCP1CON=0x4C;
     TMR2IF_bit = 0;
     T2CON = 4; //TMR2 on, prescaler and postscaler 1:1
     while (TMR2IF_bit == 0);
     TMR2IF_bit = 0;
     TRISB=0;
     TMR2IE_bit = 1;
     GIE_bit = 1;
     PEIE_bit = 1;

     while(1);
}

Please help,thanks.
 

I don't have a proteus file because the PIC16F1827 I am using doesn't appear in proteus 7.7 I have but I can give you the Mikroc Porject I created.
the graphs I am analyzing are from the physical implementation on the project board not from simulation.
Really, I am not using the complete cycle but I only increased the values in the sine table (I am using 64 but Tamid was using 32).You can do so using Smart Sine table.


Thanks,please help.!!
 

Attachments

  • SPWM.zip
    30.7 KB · Views: 101

Hello here is the H_Bridge I want to control.
The signals A,B,C and D are generated by the PIC and has to be applied on the Gate of each MOSFET.

So the problem up to the time is the codes for getting a conveniable signal because the ones posted above are not giving the good signal.

Please help.

Thanks.!!
 

Attachments

  • H_Bridge.zip
    150 bytes · Views: 104

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…