Page 1 of 1

Flip flop 50HZ

Posted: Fri Apr 06, 2012 5:54 pm
by jgu1
Hi All!

Hope I can get a litlle help.

I'm trying to make a DC12V to 230V inverter by a transformer switching two separate windings on the secondary side. Driven by 2 mosfet. By this way I get 230V out of the Primary side. I've done a flip flop in a Pic 12f675 very simple program, but how do I get the outputs to switch to 50hz without using the delay between the outputs as they have to switch on off like a flip flop with duty cycle 50%.

Thank´s in advance

jgu1

Re: Flip flop 50HZ

Posted: Fri Apr 06, 2012 11:25 pm
by medelec35
Hi jgu1,

This might be what your after?

I have used timer0 interrupt to flip bits 0 and 1 at 50Hz. There should be no delay with 1 bit on and the other bit off

Martin

Re: Flip flop 50HZ

Posted: Sat Apr 07, 2012 7:51 am
by jgu1
Hi Martin!

I am very greatfull, thank´s :D I will test it later today, and you get a reply.

Best regard.

jgu1

Re: Flip flop 50HZ

Posted: Sat Apr 07, 2012 9:18 am
by medelec35
Your welcome jgu1.

I have got a 16F883 in my EB006 programmer, so only selecting a different target device, I sent to chip and here is a screen shot with target device running with internal osc at 4MHz:
Screen_S Scope 50Hz 1.jpg
Screen_S Scope 50Hz 1.jpg (71.96 KiB) Viewed 5090 times
When posted flowchart had not tested on hardware, so was a bit of guess work.

As you can see, frequency is spot on without making any tweaks, but that will depend on your internal osc precision.
You can also see that there is no delay between one pin on, and the other pin going off.
So across both pins you should get a good square wave 10V pk to pk

If you were wondering where I got the value of

Code: Select all

tmr0=178;
from, It was from this excel sheet:
http://www.matrixmultimedia.com/mmforum ... 571#p15894
Alternatively if not got excel then you could use this:
http://eng-serve.com/pic/pic_timer.html

Martin

Re: Flip flop 50HZ

Posted: Sun Apr 08, 2012 12:25 pm
by jgu1
Hi Martin!

As promised, hereby a reply, of course your program work, very nice :D :D

And of course using interrupt is the best way to do it. Once again thank´s.

Best regard

jgu1

Re: Flip flop 50HZ

Posted: Sun Apr 08, 2012 8:34 pm
by medelec35
Hi jgu1,
Glad Flowchart works for you.

Thanks for the update :)

Martin