May 16, 2017 10:38
Competition time: Introducing STM32 ARM support in Flowcode V7
Graphical programming environment, Flowcode 7 has now introduced support for STMicroelectronics 32F range of ARM®-based Cortex® MCU’s meaning it’s now easier than ever before for you to develop programs for the ST microcontrollers.
In this article, we will introduce you to this in more detail, and show you how the powerful simulation capabilities of Flowcode, combined with its ease-of-use to program some of the most popular STM32 boards make Flowcode 7 a popular tool for professional developers and academics around the World.
What’s more, we two exciting prizes to give away. We’ve partnered with STMicroelectronics to offer 2 prizes consisting of a fully functional Flowcode 7 Professional licence with all features and two of each of the development boards at the links below, which are available from RS Online.
Entering this competition is completely free of charge and two entrants will be selected at random on Thursday 25 May. To enter, simply complete your details on the website of Matrix TSL (the developers of Flowcode 7)
Flowcode 7 not only supports many of the chip level devices, but also a range of the STM32F development boards, such as the cost effective Nucleo and feature rich Discovery boards. Developing powerful applications has never been easier!
Here we’ll show you how to get a touch screen application up and running in minutes.
For this demonstration we are using the STM32F746 Discovery Kit, so to get started simply select the ARM ST F7 32F746Discovery target as a new project in Flowcode.
This project will create a simple touch screen drawing application with a button in the bottom right of the screen that will trigger a clearing of the screen when pressed.
For this application we will be using the touch sensitive gLCD screen to draw on, so select the GLCD (STM32F746) component from the “Displays” menu and place it on the panel.
Now to get coding: For our Main code section we need to select and drag the “Initialise” macro from the gLCD component.
Then create a new macro called “Clear”: Here we clear the display and create a button with a rectangle and button text.
Add a call to this macro by adding it to our Main flowchart together with a “While” loop in which we will place our main processing.
Create some variables to store values: “touch” as a byte, “tx” and “ty” as integers to store touch coordinates (see image below).
Our processing code goes inside the while loop and consists of testing for a touch event by calling the GetTouchCoordinates() which returns a value of 1 if a touch has been detected. So we place this returned value into the “touch” variable. We then test for this in the decision and branch if it is true. In this case we read the value of the touch point x and y values by calling ReadTouchCoordinates().
We can then either draw a point circle, or clear the screen if the touch coordinates are within our “Clear” button.
We can now test our application in the Flowcode IDE, simply click on the “Run” button to start the flowchart simulation. Use the mouse, click and drag, to draw on the simulated touch screen.
If all is well, then simply connect the Discover board via USB to your PC and click the “Compile to Chip” button on the Flowcode action ribbon.
Here is the application running on the Discovery Kit: