Hello, I’m Austin.
When I was introduced to Flowcode formally 3/4 months ago, I had a mild learning curve to familiarise myself with the software; as I’m from a background in programming PIC microcontrollers with C. Hopefully by reading some of my articles, I’ll exemplify and explain some of the really handy and innovative new features of Flowcode for microcontroller programming.
First-off, is consoles. Consoles can be used within your project as a means of debugging or generating logs of program operation in simulation. They are not included in compilation, as it is meant for demonstration and reporting of the program’s operation.
My interpretation of consoles is that they would generally be used as an accompaniment to a pre-conceived application. In this article, I’ll use the simple application of reading ADC values and apply consoles to show how data can be put onto a console.
Interfacing with a console, is the same as any other Flowcode component, whereby there are component macros available to control the consoles output and these are included in the flowchart at the user’s discretion.
Next I’ll create the simple example ADC data acquisition routine and apply a console to give a readout of key variables used in the flowchart.
Shown below is the endless ADC read operation. I declare variables to contain ADC data, and calculate the voltage equivalent of the received ADC data. ADCvalSTR is used later, when the console is applied.
Now the console can be used as a sort of probe, to parts of the flowchart. In this example, I want to see the ADC value returned, and the respective calculated voltage for that reading. These variables are already available as part of the example, so I can just use them as arguments to console macros as shown below.
To obtain the hex expression for the sampled ADCval, I used the provided textual conversion function “NumberToHex”. This returns a string containing the respective hexadecimal number for the number passed to it.
When the flowchart is simulated, you can see that as the potentiometer in the simulation is moved, the readout on the console changes appropriately. Hopefully this has shown how simple it is to apply console readouts to any application just by dropping console read-out macro’s at applicable places throughout the flowchart.
Now, I could achieve a similar effect by watching the simulation debugger window, and adding all variables I want to watch to that window. But for demonstrations and reporting of live data, this isn’t ideal, as the program must be paused for the values in that window to populate. See below where the program is running, but the debugger window hasn’t populated.
Further uses of this component bear on the same principle, in that data can be viewed as the flowchart is being executed.
Consoles really come into their own when used with external sources. They can provide near-essential insight into the data received from (for example) hardware connected to Flowcode. Incorrect data from a serial connection brought into Flowcode can be spotted very quickly, for example, and thus remedied.
That concludes this week’s blog. Next week, I’ll cover component creation, and how to extract data from the project file for use within flowcharts.
13,588 total views, 4 views today