Auto Operate switches/Function generator

Please add any feature requests for Flowcode version 6 here

Moderator: Benj

Forum rules
Only feature requests will be considered here. General questions should not be posted in this forum.
Post Reply
medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Auto Operate switches/Function generator

Post by medelec35 »

Not sure if this already exist as it has been mentioned in the past.
If it does I have not found it yet.

FC5 and below had a mapping function that I used with a 3rd party software to rapidly activate switch.
I can still do that with FC6 (not by mapping though), but its not ideal.

Since there is a finite switch operation time, a function generator could be better suited than mapping (or have both).
It there a way currently to either operate a switch for say x amount of times for y amount of time period?
Or just a constant say square wave at 1KHz that will change say pin a0
Or a waveform with adjustable frequency & duty for a set period of time will be ideal.
Martin

User avatar
JonnyW
Posts: 1230
Joined: Fri Oct 29, 2010 9:13 am
Location: Matrix Multimedia Ltd
Has thanked: 63 times
Been thanked: 290 times
Contact:

Re: Auto Operate switches/Function generator

Post by JonnyW »

Hi Martin. There is no component for this at present (that I know of - perhaps Bens injector components would do the trick).

Here is a simple program that uses a timer to toggle a pin every 500ms or so. The code will not be added on download but may be useful for testing.
timer_pin_01.fcfx
(5.42 KiB) Downloaded 222 times
It uses events Simulation.Start to start the timer, System.Timer to toggle the pin and Simulation.Stop to stop the timer. Note this is injection for outputs - because switches force the pin states you would have to call the switch code directly, and I don't think there is such a call available at present. It should be simple enough to add one though, I think.

Jonny

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

Re: Auto Operate switches/Function generator

Post by medelec35 »

Thanks Jonny.
Just so I'm clear on this.
Do I just use timer_pin_01.fcfx as main flowchart to run as what ever is placed in main will have A0 pin triggered.
Or
Is timer_pin_01.fcfx used to create a component?
If so how is it used within an existing flowchart if not downloadable?
Martin

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

Re: Auto Operate switches/Function generator

Post by medelec35 »

Hi Jonny, Still not worked out how I can implement the flowchart you posted.
My brain is struggling to think.
Hopefully family issues will be sorted soon so all can go back to normal.
Martin

User avatar
JonnyW
Posts: 1230
Joined: Fri Oct 29, 2010 9:13 am
Location: Matrix Multimedia Ltd
Has thanked: 63 times
Been thanked: 290 times
Contact:

Re: Auto Operate switches/Function generator

Post by JonnyW »

Hi Martin.

The program I posted will just generate a square wave using events on $PORTA.0. Because the code is all in events it will not be downloaded. You could have added the same macros to your code, but it was more of an example than anything - sorry, wasn't thinking, it would have been better to be a component.

I will turn this into a component and have the pin on a property. This should toggle the pin during simulation and optionally show it on the scope.

To keep things together I have added the component in the New Components forum:
http://www.matrixmultimedia.com/mmforum ... 58&t=12852

Have a play and see if this works for you. I wanted to be able to generate any function, but there is a bug in the property compiler that the order of the properties compiled matters, so this fails. I have fixed the bug and will package a proper general purpose version of this in the next release (if its any good).

Cheers,

Jonny

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

Re: Auto Operate switches/Function generator

Post by medelec35 »

Hi Jonny,
Thank you, it sounds great!

I will have a play then report about it on the thread with the attachment

Martin
Martin

Post Reply