Take off device for RC plane

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

Post Reply
jjw
Posts: 78
Joined: Sat Aug 25, 2012 5:35 am
Has thanked: 71 times
Been thanked: 9 times
Contact:

Take off device for RC plane

Post by jjw »

I’m doing a take off device for RC plane. It will be connected between speed controller and receiver. The program should work like this:
- when power is switched on during the next 6 seconds power is reduced into 50%.

- after 6 seconds the power should be 100%. In appendix is my try out which won’t
work.
I hope that someone can help me finalyze my flowchart. I have looked over it so many times and my eyes are getting crossed.

jjw
Attachments
Motor_delay_6s.fcf
(20.01 KiB) Downloaded 633 times

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Take off device for RC plane

Post by medelec35 »

Hi jjw,
You will need to:
1) Change statement within interrupt to

Code: Select all

int_count < 61
(See if you can work out why).

2) int_count must be initialised with 0.

3) In Project options select

Code: Select all

Auto clear watchdog
4) I would reset

Code: Select all

second_count
& int_count on first detection of switch (rising edge).

5) The PWM value should be set to 50% I would assume only when pulse is detected (only from then should seconds start to increment?) and then if less than 6 seconds has elapsed.
When 6 seconds has elapsed then stop seconds from counting since when seconds reach 255 then if one is added seconds = 0. Set PWM = 100%

If you make the above corrections we can take it from there.

Martin
Martin

jjw
Posts: 78
Joined: Sat Aug 25, 2012 5:35 am
Has thanked: 71 times
Been thanked: 9 times
Contact:

Re: Take off device for RC plane

Post by jjw »

Hi Martin,
Not knowing if did those changes you described right... Anyway the second try out here...... :D


jjw
Attachments
Motor_delay_6s_v1.fcf
(19.99 KiB) Downloaded 583 times

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Take off device for RC plane

Post by medelec35 »

I have made some mods for you.
I have modified so that if switch is activated again then duty will drop to 50% for another 6 seconds.

Martin
Attachments
Motor_delay_6s V2.fcf
(19.77 KiB) Downloaded 601 times
Martin

jjw
Posts: 78
Joined: Sat Aug 25, 2012 5:35 am
Has thanked: 71 times
Been thanked: 9 times
Contact:

Re: Take off device for RC plane

Post by jjw »

Hi Martin,
Thanks again Martin of your great help for me!
I put in appendix a scheme in order to check that we both have understood this program in a same way. The switch was only to demonstrate those two states 50 % and 100 %. There aren’t such a switch only power on/off switch. My purpose was to to keep this simple only few other components not even a pot having a fixed delay. I tried to test this with Real Pic simulator but without any big success....
Can’t test this with hardware until next month.
Hope this helps.

jjw
Attachments
Take off timer.jpg
Take off timer.jpg (56.4 KiB) Viewed 12753 times

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Take off device for RC plane

Post by medelec35 »

Hi jjw
jjw wrote:switch was only to demonstrate those two states 50 % and 100 %. There aren’t such a switch only power on/off switch. My purpose was to to keep this simple only few other components not even a pot having a fixed delay.
In that case the attached file is a lot simpler.
I started it from scratch.
Latest version is also not tested in real pic but I cant see why it should not work.

Martin
Attachments
Motor_delay_6s V3.fcf
(7 KiB) Downloaded 619 times
Martin

jjw
Posts: 78
Joined: Sat Aug 25, 2012 5:35 am
Has thanked: 71 times
Been thanked: 9 times
Contact:

Re: Take off device for RC plane

Post by jjw »

Hi Martin,
Tested with Real Pic Simulator works fine. It really looks simple now :D . Thanks for your help.

jjw

jjw
Posts: 78
Joined: Sat Aug 25, 2012 5:35 am
Has thanked: 71 times
Been thanked: 9 times
Contact:

Re: Take off device for RC plane

Post by jjw »

Hi Martin,
Tested the program with the hardware but without any success. Now I wonder how to check that pin 4 (input pulse from receiver) and pin 5 (pulse from speed controller) are in a program equal with my scheme above?

jjw

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Take off device for RC plane

Post by medelec35 »

Hi jjw
jjw wrote:Tested the program with the hardware but without any success. Now I wonder how to check that pin 4 (input pulse from receiver) and pin 5 (pulse from speed controller)
The thing is, the pulse input to MCLR has to go & stay high for this to work.
Since you stated at the start:
jjw wrote:- when power is switched on during the next 6 seconds power is reduced into 50%.

- after 6 seconds the power should be 100%.
This is no mention of a trigger pulse.
So its MCLR = low, code not running.
MCLR high = code running so start at 50% then rise to 100 after a period of time elapsed.

If you want to change so a pulse triggers duty to 50 % then 100% it's a different design.

What I thought you was going to do from the initial spec is just have MCLR on internal. then connect receiver supply to microcontroller supply so both are powered up at the same time.

Martin
Martin

jjw
Posts: 78
Joined: Sat Aug 25, 2012 5:35 am
Has thanked: 71 times
Been thanked: 9 times
Contact:

Re: Take off device for RC plane

Post by jjw »

You wrote:
“If you want to change so a pulse triggers duty to 50 % then 100% it's a different design.”
I don’t exactly understand what do you mean with a different design. As far as I understand your comment is to add a pot with it can be reduced power from 50% to 100%.
”What I thought you was going to do from the initial spec is just have MCLR on internal. then connect receiver supply to microcontroller supply so both are powered up at the same time”
Yes MCU and receiver will powered at the same time.

So any idea what to do?

jjw

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Take off device for RC plane

Post by medelec35 »

In that case you don'r require MCLR.
You can disable it and just connect PMW o/p to the speed controller.
When power is 1st applied to microcontroller duty will start at 50%, then goes to 100% after 6 seconds.

Martin
Martin

Post Reply