Silicon ChipFlowcode Graphia I Programming - September 2021 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Subscriptions: PE Subscription
  4. Subscriptions: PicoLog Cloud
  5. Back Issues: PICOLOG
  6. Publisher's Letter
  7. Feature: The Fox Report by Barry Fox
  8. Feature: Techno Talk by Mark Nelson
  9. Feature: Net Work by Alan Winstanley
  10. Project: USB SUPERCODEC by Phil Prosser
  11. Project: USB Supercodec by Andrew Woodfield
  12. Project: High-power Ultrasonic Cleaner Part 1 by John Clarke
  13. Project: Night Keeper Lighthouse by Andrew Woodfield
  14. Feature: AUDIO OUT by Jake Rothman
  15. Feature: Max’s Cool Beans by Max the Magnificent
  16. Feature: Flowcode Graphia I Programming by Martin Whitlock
  17. Feature: PIC n’Mix by Mike Hibbett
  18. Feature: Practically Speaking by Jake Rothman
  19. Feature: Circuit Surgery by Ian Bell
  20. PCB Order Form
  21. Advertising Index

This is only a preview of the September 2021 issue of Practical Electronics.

You can view 0 of the 72 pages in the full issue.

Articles in this series:
  • (November 2020)
  • Techno Talk (December 2020)
  • Techno Talk (January 2021)
  • Techno Talk (February 2021)
  • Techno Talk (March 2021)
  • Techno Talk (April 2021)
  • Techno Talk (May 2021)
  • Techno Talk (June 2021)
  • Techno Talk (July 2021)
  • Techno Talk (August 2021)
  • Techno Talk (September 2021)
  • Techno Talk (October 2021)
  • Techno Talk (November 2021)
  • Techno Talk (December 2021)
  • Communing with nature (January 2022)
  • Should we be worried? (February 2022)
  • How resilient is your lifeline? (March 2022)
  • Go eco, get ethical! (April 2022)
  • From nano to bio (May 2022)
  • Positivity follows the gloom (June 2022)
  • Mixed menu (July 2022)
  • Time for a total rethink? (August 2022)
  • What’s in a name? (September 2022)
  • Forget leaves on the line! (October 2022)
  • Giant Boost for Batteries (December 2022)
  • Raudive Voices Revisited (January 2023)
  • A thousand words (February 2023)
  • It’s handover time (March 2023)
  • AI, Robots, Horticulture and Agriculture (April 2023)
  • Prophecy can be perplexing (May 2023)
  • Technology comes in different shapes and sizes (June 2023)
  • AI and robots – what could possibly go wrong? (July 2023)
  • How long until we’re all out of work? (August 2023)
  • We both have truths, are mine the same as yours? (September 2023)
  • Holy Spheres, Batman! (October 2023)
  • Where’s my pneumatic car? (November 2023)
  • Good grief! (December 2023)
  • Cheeky chiplets (January 2024)
  • Cheeky chiplets (February 2024)
  • The Wibbly-Wobbly World of Quantum (March 2024)
  • Techno Talk - Wait! What? Really? (April 2024)
  • Techno Talk - One step closer to a dystopian abyss? (May 2024)
  • Techno Talk - Program that! (June 2024)
  • Techno Talk (July 2024)
  • Techno Talk - That makes so much sense! (August 2024)
  • Techno Talk - I don’t want to be a Norbert... (September 2024)
  • Techno Talk - Sticking the landing (October 2024)
  • Techno Talk (November 2024)
  • Techno Talk (December 2024)
  • Techno Talk (January 2025)
  • Techno Talk (February 2025)
  • Techno Talk (March 2025)
  • Techno Talk (April 2025)
  • Techno Talk (May 2025)
  • Techno Talk (June 2025)
F lowcode G r a p h i ca l P r o g r a m m in g F lowcode C v o id in te r r u p t( v o id ) { if ( in tc o n & 4 ) { c le a r _ b it( in tc o n , 2 ) ; F C M _ IN T E R R U P T _ T M R o (); A ssemb ly movlw D′7′ b s f S T A T U S , R P 0 b c f S T A T U S , R P 1 m o v w f _ a d c o n 1 movlw D′192′ m o v w f _ o p tio n _ r e g H ex :0 4 0 0 0 0 0 0 8 A 0 1 1 2 2 8 3 7 :0 8 0 0 0 8 0 0 F 0 0 0 F 0 0 S 0 3 0 E F 1 0 0 0 0 :1 0 0 0 1 0 0 0 0 4 0 E F 2 0 0 0 A 0 E F 3 0 0 B A 1 1 0 A 1 2 2 9 2 8 3 5 2 8 6 C :2 0 0 0 2 0 0 D 9 2 8 F E 2 8 0 7 3 Introducing Flowcode I n this article – the start of an occasional series – Martin Whitlock discusses an easy route to programming microcontrollers and avoiding the steep learning curve of writing C code. Picture the scene. You’re reading your favourite electronics magazine – Practical Electronics, naturally – and you see a fascinating project that involves a microcontroller IC or board, typically a PIC, Arduino or Raspberry Pi. The source code for running the microcontroller is available for download from the PE website and you decide to build it. Success! The project works and you’re pleased with the result, but why stop there? Wouldn’t it be great if you could alter the code and make your own tweaks and subtle changes to what the project can do? Unfortunately, at this point you may hit a brick wall. Either the code is only available in hex, and hence not readable/editable, or it’s supplied in C, a feature-rich, sophisticated but complicated and time-consuming language to learn, let alone use to edit a program or even write one from scratch. At this point, you suspect your projectimprovement ideas come to an end… Fig.1. This is the kind of code-free flowchart that is easily generated in Flowcode and which is then used to generate your microcontroller’s code. 48 or do they? How about using a software package that makes programming as easy as drag and drop? Flowcode for Windows is one of the most advanced graphical programming languages for microcontrollers (including the later ESP32 ranges). It involves no complex C coding; in fact, you don’t need any programming experience to create and develop a complex electronic system in a remarkably short timeframe. Using Flowcode means you don’t need to limit yourself to modifying other people’s projects, you can design, build and program your own projects with fully tested and simulated code. Whether you are a complete beginner or an advanced coder, Flowcode’s powerful simulator lets you build and test your own design before uploading it to your microcontroller hardware. Drag and drop So how does it work? Essentially, you just choose the components you would like to use and then ‘drag and drop’ them onto a 2D ‘dashboard’. Then you link them up. You can include displays (LCD and LED), switches, sensors (for example, to measure temperature and humidity), servo and stepper motors, keypads and a whole host of other parts. You won’t get very far in modern microcontroller design without using communication protocols, and Flowcode works with the most important ones: CAN, RS232, SPI, I2C, One wire, USB Serial, IoT and more. This lets you quickly and easy interconnect sub-systems and peripherals using wellestablished protocols. Trust us, building a USB interface from scratch is no one’s idea of fun, but with Flowcode it is straightforward. All the complexity is taken care of under the bonnet, leaving you to focus on the overall design. Fig.1 shows the kind of construction you build in Flowcode – in this case, to make a simple decision. As you can see, there’s no code involved, just the intuitive use of a flowchart, which of course is why we call it ‘Flowcode’. Fig.2. This simple ‘Hello World’ Flowcode example is quick and easy to set up. Practical Electronics | September | 2021 We’ll create a nice simple beginner’s project with a step-by-step guide to creating a microcontroller-driven LED traffic light. Fig.3. Some of Flowcode’s simulation and debug options – we will return to these in a future article when we explain in detail how to use Flowcode. Design example When learning a computer language, the classic first program is often a little exercise to write the words, ‘Hello World’. Fig.2 shows how you could do this in Flowcode, but with the bonus of displaying the text on a four-line LCD connected to a microcontroller. It also shows the display time in seconds. Once you’ve built your flowchart, Flowcode lets you run a simulation to check that it works. This is an important advantage of Flowcode – you can run your program without the extra, time-consuming step of repeatedly uploading it to the microcontroller during the early test-and-design stage. Your simulation will let you check the program’s operation quickly and efficiently. To do this, select the Debug Ribbon, which will present you with the options shown in Fig.3. In Fig.2’s simulation you can see from the simulated LCD that our flowchart is displaying our chosen message. In Fig.4 you can also see ‘code profiling’ in action (the red elements), which is a very useful debugging feature. This lets you check during the simulation which functions are being accessed (or not). This is especially handy with larger, more complex flowcharts, helping you to troubleshoot problems and finetune operation. Real-world operation Once the ‘Hello World’ program was running correctly in simulation, it was time to transfer it to some real hardware – in this case, a Sparkfun RedBoard. These are 100% compatible with Arduino UNO, inexpensive and great for prototyping (see Fig.5). We could have used other hardware – Flowcode works with many of the important ones – but we like this one. Setting up Flowcode for any target device (the microcontroller) is simple. You will need the drivers for your microcontroller of choice, in this case the RedBoard (these are available from: https://ftdichip.com/drivers/ vcp-drivers/). Given the RedBoard’s Arduino UNO compatibility, to upload the code, all we have to do is:  Select the Build Ribbon, Project Options from Flowcode’s menus  Select Free targets in the Choose a Target area  Scroll down to the Arduino targets  Choose R3 SMD, but any UNO target will work  Select the COM port for the RedBoard and Click Modify  Select the Build Ribbon  Choose Compile to Target icon In the meantime, for more information please visit: https://flowcode.co.uk/ download where you will find numerous guides. In particular, the Embedded Guide and Arduino Guide are recommended for beginners. Try it for free We hope you’ve found this introduction interesting, and if you’d like to try Flowcode for free then just go to https:// flowcode.co.uk/download/ and download the code. You’ll get a 30-day free trial of the full version – but that’s not all. Even after the 30 days are up your copy of Flowcode will continue to work, but at a reduced level with a limit on the size of program you can run and access to a more basic set of parts. However, for beginners it is still an ideal platform with which you can build and run programs, on for example, an Arduino Uno or a PIC 16F88. Only when you are really sure that you want to use Flowcode do you need buy inexpensive access to say a Raspberry Pi or Bluetooth module (see: https:// flowcode.co.uk/buy/process/ for all the modules available and what they contain). What’s more, as soon as you buy any module, the restrictions on the size of your code are removed. PE discount! One more thing, Flowcode is deliberately designed to be inexpensive, but PE readers can get a further 20% discount when they use the code PE20 at checkout. Martin Whitlock is Applications Engineer at Matrix TSL – the company behind Flowcode. For our example project, the LCD hardware worked the first time – it really is that easy and simple! Coming up next Fig.4. The ‘Hello World’ program running code profiling during simulation. Practical Electronics | September | 2021 This has been a very brief introductory overview of Flowcode – we haven’t covered any design details or much of the process of getting your code into a microcontroller. This will happen in our next article when we’ll create our first flowchart, debug it and show you how to upload Fig.5. The ‘Hello World’ program running on a Sparkfun the code to hardware. RedBoard. 49