element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Personal Blogs
  • Community Hub
  • More
Personal Blogs
Legacy Personal Blogs Assembler vs C vs Flowcode ..3..2..1..Fight!
  • Blog
  • Documents
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: benmatrix
  • Date Created: 7 Feb 2014 4:45 PM Date Created
  • Views 885 views
  • Likes 0 likes
  • Comments 3 comments
  • flowcode
  • assembler
Related
Recommended

Assembler vs C vs Flowcode ..3..2..1..Fight!

benmatrix
benmatrix
7 Feb 2014

I briefly want to go over some of the upsides and downsides to programming based on the popular embedded languages assembler and C, show how they are used in the field and then compare these to Flowcode.

 

Assembler

This is basically writing code down at the machine level, you essentially get one line of code per instruction on the processor which gives you full control over the device down to the instruction. This allows you to create very optimised programs to do simple tasks. As your having to write each and every operation the code can get very messy even to do some simple things like control a standard alphanumeric LCD. This means that as a program grows in complexity the complications surrounding the assembler code increase exponentially leading to incredibly hard to find bugs in systems that quite honestly should be easy to pull off.

 

image

I remember being back in college and beating my head against a bit of assembler code that worked well until I tried to do anything meaningful with it. The coder had made the program so optimised that it was actually a very precise balancing act and the slightest change sent the code crumbling down.

 

When I speak about writing assembler I talk from the point of view of writing it for a Microchip PIC device. These are basically designed to simplify assembler by having limiting mechanisms like register banking to simplify the code. On the other hand AVR and ARM chips are basically designed for C so writing assembler for these is much more complex and I wouldn't even attempt it unless forced to.

 

C code

C code is a way of coding using more human recognisable syntax like if, else and while to achieve a higher level of abstraction from the underlying machine code. The C commands have to be run through a compiler which uses libraries to efficiently convert the code into the machine code. Larger, more complicated programs can now be achieved and in large left to the compiler to do the heavy optimisations. By creating libraries of C function you can easily call in advanced routines to your program without having to reinvent the wheel each time you move projects. The downside to C is that the code is often highly compiler specific meaning code that works on one compiler isn't likely to work with another. The task of moving between compilers is often referred to as "porting".

 

Again going back to my college days I remember thinking so how do you know what is valid syntax for the specific compiler your using. You might be lucky enough to find example code for what you want to do but with all the different compilers out there it is hard to know if it is going to work or if your going to struggle getting someone else's code to compile. Even if you have the code compiling you then have to read through and make sense of what it's doing to allow you to use it correctly.

 

Arduino use C code and a built in library of functions along with an active community to do their Sketch programming. A downfall with this is that simple mistakes like typo's can throw a novice user, discouraging them from reaching their goal. Even when doing my master course in embedded engineering it was surprising how many people were completely thrown by a C compilation error caused by a typo.

 

Typo's aren't the only problem with C, there is no fixed way of doing things which means some compilers may be better or worse at doing a specific task and means that you get weird syntax like in some of the Microchip examples where they like to occasionally throw in a pragma or non-before mentioned built in macro.

 

Flowcode

Flowcode is built on top of standard embedded C compilers so provides pretty much all of the positive aspects of the C language. On top of this you have features like syntax checking to ensure you cannot enter a typo without knowing about it. There is also the CAL (Code Abstraction Layer) which was introduced in version 5 and then taken further in version 6 which basically allows the Flowcode generated C to compile and work with any of the built in compilers allowing one program to run on a wide range of devices. This makes it much easier to share examples and to get straight down to coding rather than worrying about the specifics of the chip and compiler.

 

Flowcode also has a wide range of fully documented built in components to do a wide range of the things that you would want to do with your microcontroller. With the introduction of version 6 there is now the ability to convert a Flowcode program into a component basically allowing you to replicate the C type library approach but in a much easier way.

 

Flowcode version 6 also comes with an documented API of commands to do things in the Flowcode simulation. This allows you to wrap your code libraries with test environments allowing you to double check your code before it gets anywhere near a microcontroller. Take for example our 3D printer demo, we can take a file from a SD card (file located on the PC in simulation) Parse through the file and control stepper motors (movement on 3D models in simulation) to create a component that both simulates a 3D print and works on an embedded target to drive an actual 3D printer. That component can then be shared as an example and someone else looking at the file can use it in their own way without having to know all the internal complications required to build the component.

 

Flowcode also creates the C and Assembler versions of the project file allowing you to view them and gain a better understanding of what is going on behind the scenes. As well as this there is a C icon allowing you to enter C or Assembler code directly into the program should you wish.

 

One key downside to Flowcode over C and Assembler is price, however some C compilers alone can run up to thousands of pounds so we feel it is as competitively priced as we can achieve without selling too low for this somewhat niche area and becoming bankrupt.

 

Another downside is that Flowcode tries to be all things for all components on all devices. Now this is really hard to pull off though we do a good job of it. We add newer devices as soon as they are supported by the compiler but it means that we sometimes cannot test all devices as thoroughly as we would like. If you find a device related issue then let us know and we will do our best to jump on it and get it resolved.

 

Summation

All three programming languages have their own strengths and weaknesses. I have come from a C and assembler background and love to program in C. However I now find myself using Flowcode more and more as it just saves a dramatic amount of debugging time and comes with other advantages like being able to properly simulate the code. My last few projects Infinity Table (Shown Below), MIAC Underfloor Heating System, LED Cube etc have all been written entirely in the Flowcode software. I even wrote an ARM bootloader using Flowcode though this did involve playing around with header files etc.

 

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

From speaking to other expert C programmers I feel a similar thought process going on in their heads as I explain the situation. A typical conversation will start with "I've seen flowcode and like the looks of it but I've been coding in C for years so why should I move away from this". After pointing out the ability to interact, simulate, syntax check and graphically debug the code they are starting to come around. I then start to show some of the other features like the project explorer pane, the scope and console windows and the XML based language behind the Flowchart and definition files. Usually by the end of the conversation they are sold and looking forward to having a play with the software to see what new things they can pull off.

 

We are currently offering a free 30-day unrestricted trial of the Flowcode 6 software which can be found here:

 

You can sign up for a matrix account to activate your copy:

 

Got an opinion? Then we would love to hear it, either here on the Blog, on our User Forums or even via an email if you don't want your comments to be public.

  • Sign in to reply

Top Comments

  • DAB
    DAB over 11 years ago +1
    Hi Ben, Good post. A little bit of history, the assembly coding was standard when I began programming and every computer was slightly different. It kept us on our toes. C was created as a portable language…
  • johnbeetem
    johnbeetem over 11 years ago +1
    There's an interesting discussion going on at Slashdot on this topic: Ask Slashdot: Why Are We Still Writing Text-Based Code? Usually Slashdot has an interesting topic followed by pages of inane comments…
  • DAB
    DAB over 11 years ago in reply to johnbeetem +1
    Hi John, Yes, the computer language wars just never seem to end and every year a new one pops up claiming to be better than the rest. I have always used flow charts or diagrams to begin to partition system…
  • DAB
    DAB over 11 years ago in reply to johnbeetem

    Hi John,

     

    Yes, the computer language wars just never seem to end and every year a new one pops up claiming to be better than the rest.

    I have always used flow charts or diagrams to begin to partition system designs down to simple levels.  If they set up a hierarchical level to flow code, there is no reason why it could not work with larger projects.  If you use good design techniques and coding standards with distributed software, it should not matter except in the time critical areas of the code.

     

    In my day timing was the main driver, but with processing power ramping up every year, I worry less about timing issues than I do other issues.

    I was greatly entertained by the sudden drive for low power.  Almost every technic  for low power are nearly the same set that you use for timing issues.

     

    I do like the simplicity of the Flowcode approach for teaching logical thinking and execution sequence ideas.  Once people grasp those basic concepts they can quickly progress to more complex programming tasks.

     

    As for history, who knew that so many people would still champion programming languages more than fifty years old.

     

    DAB

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • johnbeetem
    johnbeetem over 11 years ago

    There's an interesting discussion going on at Slashdot on this topic: Ask Slashdot: Why Are We Still Writing Text-Based Code?

     

    Usually Slashdot has an interesting topic followed by pages of inane comments, but in this case many of the comments are worth reading.  I've been interested in this topic for decades, and here's my general opinion:  Graphical methods are terrific for illustrating programming concepts like conditions and loops, and they are IMO vitally important for helping people get started programming.  When I was a student, we were required to draw flowcharts.  (This was back when you could buy an IBM flowcharting template for US$1.)  Most students found flowcharts a tedious burden and only did them at the end.  I found flowcharts very valuable when I got started with assembly language, since it was easier to fix problems at the flowchart level, and writing correct ASM was much easier with a flowchart to base it on.

     

    However, as pointed out by some of the comments chez Slashdot, while graphical methods are good for simple programs, when a program gets large the graphics quickly get too complex to be useful.  In this case the conciseness of a textual programming language that's suited to the task is a huge advantage.  In my case, this meant graduating from flowcharts to pseudo-code.

     

    One commenter at Slashdot pointed out that people use graphics (schematics) to design hardware.  Someone responded that this was true in the past, but nowadays complex digital design (ASICs and FPGAs) are almost always done in Verilog or VHDL, both of which look like programming languages.  Again, logic diagrams and Karnaugh maps are IMO essential tools for learning logic design, but once you've mastered the basics I think writing Boolean equations in textual form is a lot more concise and a lot more productive.

     

    The history of programming languages and hardware descriptions is littered with graphical methods that have been proposed and fizzled out.  They tend to work well for small designs -- e.g., USB state machine diagrams -- but once you get beyond what you can fit on a few pages they tend to break down and text wins.

     

    Maybe Flowcode will have better luck and be the first to overcome history.  You never know.

     

    JMO/YMMV a lot

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • DAB
    DAB over 11 years ago

    Hi Ben,

     

    Good post.

    A little bit of history, the assembly coding was standard when I began programming and every computer was slightly different.  It kept us on our toes.

    C was created as a portable language so that you could write an algorithm and run it on another computer after compiling it on your target machine.  Very useful in its day, but it still a pretty low level language.

    I look upon Flowcode as a good modern object oriented language aimed at separating the user from programing details.  For the average person I think this is an excellent approach to quickly allow novice programmers to implement their ideas regardless of the computer they are working on.

    Granted, C would be faster, but I do not believe that speed is as important as it used to be (each assembly instruction taking several microseconds to execute) and the whole promise of computers were that they could be used by anyone.

     

    From what I have seen, I find Flowcode very interesting.  So I look forward to seeing additional posts showing its use.

     

    I really like the infinity table.  You did a very good job and it looks awesome.

     

    DAB

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube