Expanding Flowcode’s usability using DLLs

Flowcode is a highly developed language for generating firmware to run on-board microcontroller devices in an embedded context. Prior to version 6 this was our main focus and the simulation aspects were designed only to allow the user’s code to be sanity checked before downloading to the embedded device.

With the launch of Flowcode v6 we can now focus on a lot more than simple embedded devices. Flowcode itself is now capable of communicating via USB, Bluetooth, Ethernet, Wifi etc as well as producing things like sounds effects or even automated speech. This means we can not only use Flowcode to produce the code for the embedded targets but also produce environments where lots of embedded devices can be brought together into a basic SCADA type context. An example of this could be an automated test procedure where we use some embedded hardware to control a device under test and by monitoring the device Flowcode can simply present a pass or fail to the test engineer.

The Serial COM port and Ethernet functionality have both been added into Flowcode with the use of DLLs or Dynamic Link Libraries which act like regular macros as far as the Flowcode flow charts are concerned but call code outside of the Flowcode environment.

A very simple example of the DLL functionality is the time and date DLL we use to do things like simulate real time clocks or to help populate the GPS injector signals. The DLL has two functions, one that returns the current time of the PC in hours, minutes and seconds and the other that returns the date in day, month and year. The two macros are included directly below and can be imported into your Flowcode program using the Macro -> Import menu in Flowcode v6. If you import the macro into your program then you can see how the specific DLL function is being referenced.



Taking this further we could create a simple program that used for example the MIAC USB Slave component to control the MIAC and get it to do things like open the curtains in the morning and close them at night. Or another example might be to control a surface mount oven and allow the temperature profile to be controlled and logged via the scope interface and file read/write functionality. Taking the idea further, the PC running Flowcode is likely to be connected to the internet and so we can start to add in control and diagnostics to allow say our mobile phones to connect to and monitor or control the system from anywhere in the world. The possibilities are pretty much endless.

Should you need to create your own DLLs to interact with your hardware or to do other things like adding mathematical functions or interfacing other software this is fairly simple to do.

There is a tutorial here using the express edition of Microsoft visual studio: http://msdn.microsoft.com/en-us/library/ms235636.aspx

Also provided here is the actual source of the DateTime DLL so you can see the code we have used to generate the DLL packaged with Flowcode v6, sometimes an example goes a long way in helping get up and running without reading reams of documentation. The DLL was created using Visual Studio 2008 but should also work ok in the latest free versions of Visual Studio express edition.

Time Date String


Any DLL references can then be wrapped up inside a component to allow the user to create components with extended functionality in a modular way similar to the way the COM port component plugs into the RS232 and Bluetooth components.

For more help with DLLs please refer to this page of the Flowcode 6 help Wiki: http://www.matrixmultimedia.com/wiki/index.php?title=DLL_Support

11,271 total views, 2 views today

Leave a Reply