Clone and alter a signal

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
stabmegane
Posts: 7
Joined: Thu Dec 22, 2011 3:42 pm
Has thanked: 1 time
Contact:

Clone and alter a signal

Post by stabmegane »

Hi, I 'm trying to build a program in flowcode with not much success.
I'm kind of new , but managed to do many different things except playing a lot with interrupts.
What i want to do is capture a signal from an input, the signal would be just 5 volts , but i want to change it's pulse width and then send it back to an output.
i guess i have to count it's period and pulse width and then create a pulse with the changed pulse width. The signal is very slow , i mean it has a period of around 0.25 Hz, which means i have a 1 for 1 second and then a 0 for three seconds. These numbers are just an estimate , but i would really like your opinion and advice on doing this.

Thank you for your time reading this,
Stab.

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: Clone and alter a signal

Post by medelec35 »

Hi Stab,
I recently did a similar thing with a Flowcode.
Using a minimal amount of components. Target device is a 12F617 using its internal osc.
I have got a 100Hz signal with a varying duty, and I required a higher frequency PWM in which its duty varied in proportion with the i/p duty.
The recoded i/p duly was spot on the the Scope reading.
I have also got two trimmers to set min o/p duty and max output duty.
Due to the nature of the i/p duty I need to set the o/p duty to a smaller value then i/p, so there is a good range of adjustment.
Duty measured can range from 0% to 100% since that is taken into account.
How the measuring works is it involves two timer variables. One times out if 0 or 100% duty is present.
the other variable starts a timer is a positive going pulse is detected, when pulse falls to 0V the Duty is derive from the duration of the positive pulse.
Flow chart was created for my application, so you may find it a bit complex for what your after, but betwwn us i'm sure we can talor it more towards your needs.
That is of course if your still after a solution?

If so then let me know and I will post flowchart.

Martin
Martin

stabmegane
Posts: 7
Joined: Thu Dec 22, 2011 3:42 pm
Has thanked: 1 time
Contact:

Re: Clone and alter a signal

Post by stabmegane »

Medelec,
Thank you for your asnwer. I tried some solutions, which they work, ummmm, not as they are supposed to , so i guess i could use your program, as a start and change it, if it 's possible yes, i would like to see your flowchart and work on it.
Waiting for your reply.
Thanks again

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: Clone and alter a signal

Post by medelec35 »

My flowchart was created with Flowcode V5. I will need to adapt to your version of Flowcode.

1) What is your version of Flowcode?

2) What do you want the PWM out put frequency to be? Is it the same frequency but with a different duty, like a pulse stretcher (that what I'm assuming from your post). or a different frequency?

3) Do you want preset's allowing a trimming of o/p duty?


4) What is your target device and osc speed?

Martin
Martin

stabmegane
Posts: 7
Joined: Thu Dec 22, 2011 3:42 pm
Has thanked: 1 time
Contact:

Re: Clone and alter a signal

Post by stabmegane »

Thanks again for your quick reply.
1.I use Flowcode 4
2. Yes , you are right, i want a pulse stretcher or shrinker depending on an input i have, but i guess i can deal with that later.
3. i guess you can leave it as it is (with the trimmer) and then i can change it as needed.
4. i work with PIC 18f452 at 8 MHZ or 16f877 at 8 MHz .

Thanks again,
Stab

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: Clone and alter a signal

Post by medelec35 »

Hi Stab,
To be honest Flowchart I created for my application would not be suitable for your application therefore I have created a new flowchart tailored to your application.

Only when pulse on B4 is detected, the pulse o/p on A1 will vary in duration (10 - 240ms) depending on pot setting.
I have also built in a fail safe so A1 is forced off after a 250ms but independent of i/p pulse width. So in effect Flowchart is a pulse narrower and pulse stretcher all in one.

Not tested on hardware, so hopefully it will work.
Would you mind letting me know please?

Martin
Attachments
Pulse Changer FC4.fcf
(14.5 KiB) Downloaded 310 times
Martin

Post Reply