Squarewave generator (sim only)

A forum where Flowcode v6 user created components can be shared, discussed and reviewed.

Moderator: Benj

Post Reply
User avatar
JonnyW
Posts: 1230
Joined: Fri Oct 29, 2010 9:13 am
Location: Matrix Multimedia Ltd
Contact:

Squarewave generator (sim only)

Post by JonnyW »

This component generates a square wave during simulation.

Time interval is in milliseconds and approximate (to about 10ms).

The source for this is here, export as a fcpx file to your components folder to include - it will be in the misc category:
squarewave.fcfx
Source code
(10.65 KiB) Downloaded 329 times
A demo of this (just an empty loop) is here:
SquareWave_Test.fcfx
Example
(4.23 KiB) Downloaded 284 times
Open the Data Scope (Menu->View->Scope) to see the wave during simulation.
squarewave.png
(28.48 KiB) Downloaded 5868 times
Jonny
Attachments
squarewave.fcpx
Compiled
(1.55 KiB) Downloaded 273 times

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 9019
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: Squarewave generator (sim only)

Post by medelec35 »

Hi Jonny, added component (thanks for posting :) ) to components directory.
Unfortunantly component won't add to Dashboard panel:
Failed to add.png
(38.11 KiB) Downloaded 5862 times
Also when loading

Code: Select all

SquareWave_Test.fcfx
the following message is displayed:
Failed to open.png
(19.34 KiB) Downloaded 5862 times
Then Flowcode closes.

Edit:
Same thing happens when trying to open squarewave.fcfx
Flowocde shows failed to document (array not found ) then closes.
Martin

User avatar
JonnyW
Posts: 1230
Joined: Fri Oct 29, 2010 9:13 am
Location: Matrix Multimedia Ltd
Contact:

Re: Squarewave generator (sim only)

Post by JonnyW »

Hi. Sorry Martin!

I have been adding multi-dimensional array support, so the 'array' attribute of variables has been removed and added as a tag list instead. I didn't think about this as I did it a couple of days ago, and this will work with the next patch, but anything I output now will have this issue.

Very sorry again for this, its a good point - I better not roll this out around the office until a patch is out!

EDIT: I have modded the executable to output temporarily backwards compatible files, and the above attachments should work OK now.

Jonny

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 9019
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: Squarewave generator (sim only)

Post by medelec35 »

Hi Jonny,
JonnyW wrote:Very sorry again for this, its a good point
No worries, it does not matter to me if it does not work at first since it's trial and error.
So long at it works in the end.

Thanks for reposting files.
Unfortunately its still not working for me.
I have added only the the latest squarewave.fcpx
Flowcode now opens, but the red square waveform is missing from component that's on the System panel.
The connection is missing from the scope.
When trying to add the squarewave component I get failed to add etc.:
Squarewave.png
(83.11 KiB) Downloaded 5850 times
Martin
Martin

User avatar
JonnyW
Posts: 1230
Joined: Fri Oct 29, 2010 9:13 am
Location: Matrix Multimedia Ltd
Contact:

Re: Squarewave generator (sim only)

Post by JonnyW »

OK, must still be somewhere else I have changed the component, or not compiled/uploaded it correctly.

I will ensure this is done properly and works 100% in the next patch, should be today or more likely sometime tomorrow.

Jonny

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 9019
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: Squarewave generator (sim only)

Post by medelec35 »

Thanks Jonny,
Will wait for the patch.


Martin
Martin

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 9019
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: Squarewave generator (sim only)

Post by medelec35 »

Hi Jonny,
Just an update.
When I got home, I loaded squarewave.fcfx
changed Type of macro to simulation
Created component.
Now it works perfect!
I got it to trigger int interrupt on portB.
Waveform is showing correctly on the simulation scope, and number of detections showing on LCD is increasing as expected at the correct interval.:
Squarewave works.png
(75.77 KiB) Downloaded 5828 times
I have altered the interval to 200ms so it will look a bit different to your scope.
Some tweaks may be necessary in the finished version, but overall very happy with the generator so far.
Big improvement over Flwocode V5

So Thanks again for what you have done :)

Martin
Martin

User avatar
JonnyW
Posts: 1230
Joined: Fri Oct 29, 2010 9:13 am
Location: Matrix Multimedia Ltd
Contact:

Re: Squarewave generator (sim only)

Post by JonnyW »

Hi Martin, good news.

There was a bug in Flowcode where it was only compiling the properties in a certain order, so I couldn't add to that version what I wanted, which is a general purpose generator. If you add a list of features you wuld like to see, I'm sure we can sort something.

Jonny

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 9019
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: Squarewave generator (sim only)

Post by medelec35 »

Hi Jonny Thanks.
Here is my list:
On duration
Off duration
selectable Period Time or Frequency
Keys to press for Start, Pause, Continue and Stop. (Perhaps selectable from dropdown list?)

Hope I'm not asking for too much?
Also if anyone else would like to post on this thread what functions they would like to see that would be helpful.

Re scope.
I would like scope to show what pin is being used and if possible a x time scale perhaps in milliseconds?

Martin
Martin

Post Reply