Difference between revisions of "Exercise - Using Simulation Macros"

From Flowcode Help
Jump to navigationJump to search
Line 1: Line 1:
Simulation macros are simulation-only Component macros - they provide a similar purpose, although they can only be used in simulation and cannot be run on hardware.
+
Simulation macros are simulation-only Component macros. Their purpose is to make simulation more relaistic by adding physical components to the electronic devices.Flowcode programs are first compiled into C before being crunched down eventually into hex code.  
 
 
C code is a high-level programming language widely used in industry.<br />
 
It has spawned a number of other programming languages, such as C#, C++, Java and Python.  
 
 
 
Flowcode programs are first compiled into C before being crunched down eventually into hex code.  
 
 
 
There are two mechanisms for adding your own C code to a Flowcode flowchart:
 
[[File:Exercise_InsCode_C_suppcode.jpg|right|350px]]
 
* using the 'C Code' icon  [[File:Btn C Code.gif|border]] ;
 
* using the 'Use supplementary code' facility within 'Project Options', shown opposite:
 
  
  
Line 17: Line 7:
 
==Why would you want to?==
 
==Why would you want to?==
  
* Flowcode programs are compiled to 'C', but produce many lines of code.
+
* Flowcode  
: They do so because they must be able to cope with any function or structure that the designer wishes to use.
 
: Experienced C programmers may wish to use code more efficiently, and so insert a few lines of code to replace many lines which Flowcode would generate. (This usually applies to the 'Adding supplementary code' option.)
 
 
 
* Experienced programmers can insert a short section of C code in order to reduce the length, or complexity, of the Flowcode program.
 
  
* Students learning to program in C can test short sections of code by inserting them into a Flowcode program. This avoids having to write the full program in C.
+
* Experienced
  
 +
* Students
  
 
==Adding supplementary code==
 
==Adding supplementary code==
  
This feature is used when you have blocks of code containing routines, definitions, lookup tables, etc. 
+
This feature  
[[File:Gen_Supplementary_Code_01.png|right|frameless]]
 
 
 
  
 
'''Definitions and function declarations:'''
 
'''Definitions and function declarations:'''
  
This is the first section. It allows users to initialise the program, by adding structures such as 'defines', 'includes', and other function declarations.  This section must be placed at the beginning of the C file so that the code is 'visible' to all parts of the program.
+
This is  
 
 
 
   
 
   
 
'''Function implementations:'''
 
'''Function implementations:'''

Revision as of 17:25, 23 August 2013

Simulation macros are simulation-only Component macros. Their purpose is to make simulation more relaistic by adding physical components to the electronic devices.Flowcode programs are first compiled into C before being crunched down eventually into hex code.



Why would you want to?

  • Flowcode
  • Experienced
  • Students

Adding supplementary code

This feature

Definitions and function declarations:

This is

Function implementations: