Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About Shree

  • Rank
  • Birthday 01/22/1977

Contact Methods

  • Website URL
  • ICQ
  • Yahoo

Profile Information

  • Gender
  • Location
  1. Hello Dave, Thanks for that piece of advice. I have done most of the things you mentioned. Would have to try to sheild the controller though and yes its a real nice project, although there are been similar products existing here in the market, but they either have lot of failure rate or cost above $20. So if I am been able to do that, it would help ppl a lot. The cost of solar panel is also a cause of concern. Thanks alot again for your advice. Regards Shree
  2. Hello everyone, I came across this problem when I was making a small high frequency inverter of upto 50W (extremely low cost; system cost approx less then $10) for rural areas in india, where there is no electricity. The battery for this inverter would charge from a solar panel and provide energy to the load (CFL: Compact Flouroscent Lamps) in the night. I used PIC16F684 and deployed its PWM module. everything worked fine in the initial stages. But when I created a PCB, all the problems started. Now the problem is that whenever I switch On the supply, the controller keeps on reseting until I dont place my hand on the negetive/negetive track of the battery. If I place my hand on the negetive, it starts working fine. I tried everything from using filter caps to tranzorbs across 7805. But nothing worked. Lastly I tried taking a wire from earthing and directly shorted it to the negetive of the battery. Voila!!! Now there were no problems! But now my problem is that I am not sure I will have the luxury of 'Earthing' for my product as the electricity condition in rural india is more then pathetic. Can anybody suggest me what can be done to resolve this issue? For Info: The inverter voltage is created by applying 12V DC to the central tap of a ferrite core transformer, of which the ends of winding are connected to the ground through MOSFETs. So the MOSFETs act as switches (PUSH-PULL Config) and hence create a stepped up high freq square wave (40Khz) of 200V AC approximately at secondary of the transformer. This square wave is rectified by fullwave rectifier and used to power load (CFLs, which have a ballast in built, so they work on DC as it is). So we get a output of 250V DC . The switching of MOSFETs is done by PIC micro and the voltage conversion(5V controller signals to 12V MOSFET gate voltage) is done by using transistors and a TOTEM POLE configured transistor stage is further added to ensure proper switching. The pic micro is 16F684 and works on 8Mhz internal clock. PWM module used in PUSH-PULL mode is used to generate gate voltages and a dead band delay of 1.5uSec is programmed in between the switching of 2 gates. MCLR, Power-Up Timer, Brown-Out detect all are turned off. I am utterly confused as what should I do now to eliminate this noise issue. I tried re-designing the PCB thrice. I hope somebody can guide me through this. Thanks and Regards Shree
  3. Hello All, Came across the code below. Could not figure out exactly what it does. Can somebody please tell me what exactly the code does. especially, the "for" is used in a different way it seems. Just confused about it . char * Somevalue(char * X, const char * Y) { char * d ; d = X; for(;*X++ = *Y++ ; return d; } Thanks & Regards Shree
  4. Hello Guys, Yes! thats what I wanted to know. Thanks a million both of you Trossin and Jorge. LUT was a mystery for me for a long time, until I thought of asking about it here. Jorge you were apt and correct about what I wanted to know about them and explained it to the point and like many others, I am a huge fan of Trossin and have been learning about PIC and C programming with his projects right from the day one. Thanks again guys for all the valuable explaination. Regards Shree
  5. Hello Jorge, Thanks alot for your reply. But I think I need to know more about the things you explained, because I couldnt grasp them. The link you forwarded was a inverter, but in PUSH PULL configuration, where as for more efficient output, I am thinking of going for a H-Bridge Configuration (as mentioned in earlier post). About the Sine wave look up table, to be more generic, the PWM pulses switching time is directly proportional to amplitude of the sinewave output signal, and since the output waveform is having a sine relation between its X and Y axis (At any given point of distance on X-axis in degrees/Radians, (0-360), the amplitude is Sine value of that distance in Degrees/Radians into the maximum amplitude), I think that there might be some application of sine factor in the PWM switching calculation. But ofcourse other parameters would add too and here is where I am stuck. I dont know how to calculate those values in the lookup table. My static values in one of the coloums of the LUT would correspond to 3,6,9,12,15...180 (3 degrees sampling rate). Hope I dont sound jumbling. But again thanks for your help. Regards Shree
  6. Hi, I am trying to create a sine wave inverter using MOSFETs in H-bridge mode. DC supply 12V is switched by the MOSFETs to create a sine wave and this sine wave would be fed to a step up transformer giving 230V / 50 Hertz AC Sine wave. After I googled on how to develop this concept using a PIC, Most of the guys out there have suggested to use a sine wave PWM for the same and for generating sinewave PWM I have to use lookup table. Now I know fundamentally what is a lookup table. If I am right a LUT (lookup table) is a table which has precalculated values corresponding to the variables which are frequently used in the calculations. As in my case suppose there are MOSFETS A,B,C,D in the bridge, where A and D are diagonal to each other and B and C are diagonal and the transformer is connected at the Source-Drain Junction of A-C and B-D, in order to get an AC waveform, I would need to give a PWM input on A, Compliment of A on C, MOSFET D must be kept ON and B MOSFET would be OFF in order to get 1 half cycle. For the other half cycle, PWM input is given to B, Compliment of B on D, C is kept ON and MOFET A is OFF. This half cycle is exactly the same as the previous, but its direction is opposite to that of the previous (due to transformer). So I need a Sine PWM for 180 degress and for the next 180 deg, I will simply switch the other side of bridge with the same PWM. Now if we consider an O/P of 50Hz, half of it would be 100 Hz (Or 50Hz=20mS; 100Hz=10mS) and say I decide to take a sine sample at every 3 degrees for 180 degress (i.e. 10mS), I would have 60 samples of 3 degrees each. So my each sample would be (10mS/60 Samples = 167uS OR 6KHz). Hence the ON Time of my waveform per sample would be 167 X sine value at that particular instance. [This is what my understanding is. Please correct it if thats not the case]. So the sine lookup table should be sine values of 3, 6, 9, 12, 15....180 etc, which would all be floating points (except for 90 deg and 180 Deg). But I am puzzled on seeing none of the lookup tables shown on various forums have any float value, instead all of them had some decimal values ranging from 0 to 1024 or 0 to 255 or atleast 0 to 64. How are these values computed and in the above case what would these values be and in case I am taking a feedback of output voltage with an ADC in order to control the amplitude of the sinewave (O/P voltage) how will the values in this table get affected (The proposed 12V supply is a battery so as it discharges, the output voltage would also fall, hence there might be a need to increase the pulse width accordingly). Also how would this be implemented in the PIC? I am thinking of using 16F887. I am trying to present the maximum facts that I understood, but I know that I can confuse the most precious brains with my stupid vocabulary. So please bear with me if anybody finds it confusing. Thanks and Regards Shree
  7. Hello Wizards, Is it possible to use the LCD library provided with SB without any modifications for driving a LCD display of 4 lines with each line of 20 Characters (20X4)? The module which I have is implemented using driver chip S6A0073 equivalent Make: AV displays. Thanks in Advance Shree
  8. Thanks for the Caution! Would keep that in mind Regards Shree
  9. Hello David, Thanks a lot for your reply. Atleast I know now what direction I must proceed! Regards Shree
  10. Hello Wizards, I have got a requirement where by I want to charge a capacitor to 2000V in 30mSec or less. The capacitance value is 190uFD. I dont know how to calculate current required to charge this capacitor within this time and how can I check it using a controller? Regards Shree
  11. Hello, I think I figured it out! Actually the value of CCPR1L is only 8 MSBs of the 10Bit register of the period hence whatever might be the total value would be shifted right 2 places, which makes it value divide by 4. So if we have PR2+1 is 64 the CCPR1L value would indeed be 32 and thats what I was reasoning! By the way its working now! Thanks a million for being for me all the time and trying to figure it out for me. Regards Shree
  12. Dear sir, Please allow me to differ with you here. I think its the time which becomes half of the total ccp. So the freq would be double. Please correct me if I am wrong as I am a novoice. I still think that the CCPR1L's value must be half of the value of period register value in order to get a 50% duty cycle. Am I wrong? Further more I was just wondering whether the ECCP o/p keeps on running in background, allowing me to do any other jobs with my pic (like continously monitering the adc channel, making some ports high or low etc?) Thanks for your efforts and support Regards Shree
  13. Hello, Thanks so much for being a help. I think I am getting a bit of it. But I didnt get the concept of the duty cycle and the total period. Considering your example, we have a 10ms period which would load the PR2 register with a value of 155 for 1MHz clock Freq and 1:16 prescaler for TMR2. Now as said by you the ON time of the pulse is determined by 10 bits of CCPR1L and CCP1CON<5:4>. If I consider that the pulse has duty cycle of 50% i.e. it remains ON for 5mS and off for 5mS, the formula stated for getting the values in the above 10bit yeilds a result 0f 312.5 (which is double of the PR2+1 value). I am confused about how can the ON time value be more then the total period value? Secondly I am trying to use a ECCP in half bridge mode. I wanted to know the exact coding method that is to be followed for implementing the ECCP in halfbridge. Have the interrupts to be used even if I want a fixed frequency (say 50% duty cycle) output on P1A and P1B pins, which would drive a MOSFET drive in Push-pull mode. Further more there is a deadband control register PWM1CON, the value entered in which would create a deadband of that value multiplied by 4Tosc. But nothing is mentioned about the value in CCPR1L register with this deadband. I mean say if I want a deadband of 1mS in 5mS ON time, i.e. the actaul ON time is only 4mS, then what should be the CCPR1L value? Should it be 312(for 5mS) as in above example or should it be calibareted for 4mS? I hope I am not making a mess and thanks for your efforts to explain the concept in detail. For sure I know much more now then before. Regards Shree
  14. Hello Wizards, Sorry for being such a confused soul. But I am going berserk trying to implement a half bridge E-PWM module in order to drive 2 MOSFETS in push pull mode. I wrote the following code: #include <system.h> #pragma CLOCK_FREQ 8000000 #pragma DATA _CONFIG, _WDT_OFF & _INTOSCIO & _CP_OFF & _PWRTE_ON & _IESO_OFF & _FCMEN_OFF & _CPD_OFF & _MCLRE_OFF & _BOR_ON void main() { //Setting up internal oscillator of 8MHz osccon.IRCF2=1; osccon.IRCF1=1; osccon.IRCF0=1; osccon.OSTS=0; osccon.SCS=0; trisc=0; portc=0; pr2=63; // 32uS=[PR2+1] * 4 * 125nS *1 [PWM Period= ((PR2+1)*4*Tosc*TMR2 Prescaler)] ccpr1l=128; //16uS=[DCB:DCB0] * 125nS *1 [Pulse Width=(CCPR1L:CCP1CON<5:4>) *Tosc* TMR2 Prescale] ccp1con=0x8c; //Half Bridge Mode and PWM mode all pins active high pwm1con=4; //dead band Delay of 4*Tosc * n: 4*125nS*4= 2uS t2con=4; //TMR2 On with pre and post scaler 1:1 while(1){;} } From the above program I am trying to get two complimentory pulses of 16uS (2uS deadband delay + 14uS ON) and 16uS off on pin P1A and P1B. Both are being used as active high. So total period on each pin is 32uS. My first confusion is if the period is total of ON time and OFF time, then how could the value loaded in PR2 registor is lesser then that in CCPR1L (In my case double as the duty cyle is 50%) and secondly is there something more to be added to the above code to acheive my task? I checked the O/P on the scope, but only P1A is showing some erraneous output. Guys I was never so much confused. Is this so hard to do? plz help me Thanks in advance Shree
  • Create New...