Flip flop 50HZ

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

jgu1
Posts: 1174
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1100 times
Been thanked: 293 times
Contact:

Flip flop 50HZ

Postby jgu1 » Fri Apr 06, 2012 5:54 pm

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
Attachments
DC_AC.fcf
(7.5 KiB) Downloaded 159 times

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8809
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2553 times
Been thanked: 3712 times
Contact:

Re: Flip flop 50HZ

Postby medelec35 » Fri Apr 06, 2012 11:25 pm

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
Attachments
DC_AC1.fcf
(14 KiB) Downloaded 178 times
These users thanked the author medelec35 for the post:
jgu1 (Sat Apr 07, 2012 7:47 am)
Rating: 5%
 
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

jgu1
Posts: 1174
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1100 times
Been thanked: 293 times
Contact:

Re: Flip flop 50HZ

Postby jgu1 » Sat Apr 07, 2012 7:51 am

Hi Martin!

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

Best regard.

jgu1

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8809
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2553 times
Been thanked: 3712 times
Contact:

Re: Flip flop 50HZ

Postby medelec35 » Sat Apr 07, 2012 9:18 am

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 3180 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:
viewtopic.php?p=14571#p15894
Alternatively if not got excel then you could use this:
http://eng-serve.com/pic/pic_timer.html

Martin
These users thanked the author medelec35 for the post (total 2):
jgu1 (Sun Apr 08, 2012 12:21 pm) • ncc1502 (Sun Apr 08, 2012 11:02 pm)
Rating: 10%
 
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

jgu1
Posts: 1174
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1100 times
Been thanked: 293 times
Contact:

Re: Flip flop 50HZ

Postby jgu1 » Sun Apr 08, 2012 12:25 pm

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

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8809
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2553 times
Been thanked: 3712 times
Contact:

Re: Flip flop 50HZ

Postby medelec35 » Sun Apr 08, 2012 8:34 pm

Hi jgu1,
Glad Flowchart works for you.

Thanks for the update :)

Martin
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.