Electronic system debugging using Flowcode 7
When developing electronic or electromechanical systems, debugging your designs can be tricky, especially if you are unfamiliar with a specific routine and the way it is meant to behave. Engineers are always looking for ways that will help them firstly, debug their systems in an easy and effective manner and secondly, speed up the process from development of their project to launching the project.
From the perspective of a professional engineer, a teacher or an engineer studying embedded systems; Flowcode is a superb platform for debugging systems.
With Flowcode, there are a number of features within the software which allow users to test and debug systems more conclusively and, most importantly, easier than when developing projects using textual based code and other languages. Here, we talk about how these features help with both the development process and the learning process for microcontrollers.
One of the core features of Flowcode is simulation. Simulation can be used to light the way as users can instantly run their program without having to compile or download and check it is doing what they want it to.
This simulation shows the car seat of a vehicle and how automotive engineers can replicate the motor and actuator movement on the car seat and how this is controlled using microcontrollers, by using Flowcode 7.
Simulation gives users the ability to check their designs are working correctly, before compiling to hardware. The Simulation debugger window becomes active during simulation and is used to monitor both the values of the variables in your program and the macros which are being called. This allows the user to monitor the process of the microcontroller running the program. As a plus point the values of the variables can be changed while the simulation is paused allowing for specific case testing to be performed.
By using the 'Step Into' and 'Step Over' simulation controls you can accurately monitor and debug your flowchart program. Breakpoints can also be set so you can pause the program automatically whenever you hit the breakpoint enabled icon.
You can actively change the speed of the simulation using the slider at the top left of the Simulation Debugger window, the default simulation speed is 'Normal' though there is also a 'As fast as possible' mode which favours calculation speed over more mundane things like graphics handling. The speed of simulation can also be reduced right the way down to 0.25Hz, this will result in the simulation going through each icon individually at the specified speed.
The simulation debugger in Flowcode
Code profiling is a new feature that will be launched for the first time in Flowcode 7. This feature shows when icons have been ‘hit’ during a simulation run, highlighting sections of code that may be deemed redundant and other parts which are executed more often and may need optimising to improve program efficiency.
Meanwhile, a new and improved oscilloscope will be launched in Flowcode 7 which will include triggering. This will make Ghost technology on Matrix hardware easier and quicker than ever before. The existing data scope is still there but has now been renamed the data recorder. We hope these features will help revolutionise the capabilities of all users, from learning programming to developing products.
Ghost technology is compatible when users are using E-blocks hardware developed by Matrix. The boards supported include the EB006 and EB091 PIC and dsPIC multi-programmer boards plus the new FlowKit 2 which can be connected to microcontroller based hardware systems to provide test and debug features for third party hardware. These are available from RS.
Ghost provides a real time log of the status of all the pins (analogue and digital) on the real world microcontroller. This data can be displayed on the oscilloscope or the data recorder within Flowcode. This is called ‘In-Circuit-Test’ (ICT).
Another part of “Ghost” is ‘In-Circuit Debug’ (ICD). This invaluable feature allows you to step through the flowchart program and use breakpoints in a similar way to the simulation, but this time your program is running on the actual hardware. You can even pause the microcontroller in real time and monitor or start changing the values of variables.
ICT data can be viewed on the Flowcode scope at the same time as the flowchart program is being executed. With both ICT and ICD enabled you can run, pause, and step through your program and view Ghost data at the same time.
When this data is combined with the PC-side processing capabilities of Flowcode it provides a very powerful debugging and learning tool.
This saves huge amounts of development time - whether you are working at a pin level and getting your first program to work, or whether you are an advanced user wanting to perform a sanity check to make sure communications baud rates are set at the correct speed.
Both analogue and digital data is gathered through Ghost and displayed on the Flowcode scope. For communications busses decoding overlays for SPI, I2C, and other comms standards are available. Ghost data can also be passed to simulation/SCADA components in Flowcode to provide Human Machine Interface style debug features or automated test features.
Flowcode’s online Wiki is a massive resource that has example programs and descriptions of many aspects of using Flowcode. Flowcode also has an active online community on the Matrix user forums where help and advice is given from practising engineers and dedicated Matrix staff.
The Matrix user forums are a great place to get help and support on your Flowcode designs from Matrix engineers.
If you cannot find a solution to your problem on the Wiki or the forum, then signup and report your problem on the forum, providing as much detail as you can to allow others to replicate the problem. Attaching your Flowcode project file to the post and describing your hardware setup is usually an easy way to ensure that others are able to help you around any potential pitfalls or problems.
Over the coming weeks, keep a look out for a number of more detailed articles from us which will put more detail towards the plans for Flowcode 7 and its capabilities. Flowcode is available for programming 8bit, 16bit and 32bit PIC, AVR, Arduino and ARM microcontrollers.
Flowcode 7 can be downloaded for free in a simualtion only copy here. Standard and professional licences can be purchased from RS Online.