Visual Programming to Embedded ‘C’ Code

DOI : 10.17577/IJERTV4IS060413

Download Full-Text PDF Cite this Publication

Text Only Version

Visual Programming to Embedded ‘C’ Code

Miss Tejaswi Mahaling Jadhav

Dept. of Electronics Engineering, Government polytechnic, Tasgaon, Sangli (M.H) India

Abstract This paper proposed a programming system called Flow C. Flow C for creating C program automatically from the flowcharts. Flow C allows designing of ARM-based programs, simply by drawing a flow chart of the desired program. The system will convert it into a C program which is compatible to ARM 7 microcontroller (LPC 2138).Flow chart is an easy way to describe programmer's idea.Flow C allows creating simple microcontroller applications by dragging and dropping icons and connecting them form a flowchart and then converting the flowchart into a C program that is compatible with LPC 2138.

KEY WORDS- Flowchart, VisualBasic.net, Embedded c Programming (LPC 2138)

  1. INTRODUCTION

    Computer programming, now a day has become a required fundamental knowledge for people studies or working in computer field, e.g. computer engineering, computer science, information technology etc. Writing a computer program is a difficult task, especially for a beginner. A novice often uses a flowchart as a tool to help him summarize the idea into all necessary steps of solution, but this flowchart needs to be converted to a program for using it with an ARM controller

    There are more than 50 programming languages in the world. Some languages are used as general purpose whilst other languages are employed for specific purpose. These computer programming languages, however, are only the tools used for programmers to communicate with and order the computer to do as they desire. More important thing in writing a program is a design of an algorithm. An inexperienced programmer is always attracted by the syntax of the computer language, and overlooks the significance of algorithm design.

    The immature programmer who is not familiar with the syntax of the programming language writes the wrong code frequently. The difficulties of reading and understanding the program in the format of coding is the principal reason of this logical errors.

    There are two softwares available in markets which have similar functionally 1) structured design using flowchart and 2) visual programming using flowchart.

    • Structured design using flowchart (SFC) means is useful for designing and presenting structured flowcharts. SFC is automatically generating pseudo code for a flowchart.

      Visual programming using flowchart allows the programmer to write the program in the format of flowchart, then compiles and run, without the coding steps. This tool aids in the cyclical nature of the algorithm development process as changes can be made rapidly to test new ideas

      According to survey, the cost of available software in market is very high; but this concept is very useful. So we try to implement this concept.

  2. SOFTWARE DESIGN

    The generated C code will be compiled using Keil compiler and test will be taken on simulation software Proteus.

    GRAPHICS USER INTERFACE

    TEXT FILE

    CONVERTING CODE

    PROTUES

    KEIL COMPILER

    C CODE

    Fig 1 blocks of software design

    The above figure shows the design flow of software. First step is to design graphics user interface in VB.NET. With the help of GUI (graphics user interface) one can able to draw the flowchart. The GUI software will convert it into text file that describe the flowchart This intermediate text file will be converted into actual C code with the help of text to C converter program that is to be written in VB.NET.Compiling the C code (embedded software) using Keil compiler and simulating the code in the circuit simulator Proteus. The design steps of software as follows:

    • Study of Keil compiler.

    • Write small programs for ARM microcontroller; test these programs in Keil compiler.

    • Write the text file if program will compiled successfully.

    • The text file will be converted into actual C code with the help of converting Code.

    • Compiling the created C code (embedded software) using Keil compiler.

    • Study of VB. NET.

    • Design symbols (of flowchart) using vb.net.

      • Using tools of vb.net prepare menus for flowchart icon, properties windows, and flowchart windows.

      • Draw the flowchart in Graphics user interface.

      • Software automatically converts flowchart into the intermediate text file.

      • Text file will be converted into actual C codes which are compatible for ARM 7 microcontroller (LPC 2138).

      • Created C code will compile in Keil compiler.

      • Simulate in Protues (Circuit simulator).

  3. SOFTWARE IMPLEMENTATION

It describes how to design graphics user interface in VB.NET, Steps for conversion of flowchart to text file, how to convert text file to C code using converting program.

    1. Graphics user interface

      1. Visual studio used tool

        Assuming VB.NET is already installed, the next goal is to add the components from the Flowchart package to the Visual Studio toolbox. Some steps to customize the toolbox .Open or create a project of type 'Windows application'.

      2. Add reference to the required assemblies to the project

        The following procedure adds other the property windows forms of symbol to main window.

        • Open the Solution Explorer.

        • Right-click the References section and choose 'Add Reference'.

        • Locate the subfolder appropriate for version of Visual Studio.

        • Select Windows Forms and click the Open button.

      1. Add diagram view and diagram object to windows form

        Now, see icons for the Flow C components in

        toolbox. As a minimum add a diagram and a diagram view to Windows form. Follow these steps to do that:

        • Open the Visual Studio toolbox.

            • Select and drag the diagram View icon to the form. This

              creates a diagram view component, which represents the view in document/view architecture. If skipped the steps of above section 6.2.2 and if Visual Studio keeps a cached older version of any of the VB.NET assemblies, the diagram view might fail to load. In such a case, carry out the steps from section 3.1.2 and try to add the view component again.

            • When the diagram View is dragged to the form, it automatically adds a diagram component, which represents the document in document/view architecture. If using a development environment different from Visual Studio, then add the diagram component to the form by dragging it from the component toolbox or palette. If the diagram View fails to add a diagram because of some configuration error, then try to add the view component again.

            • To add a diagram component manually, this is associated with the view control by setting the diagram view property: while the view object is selected, open the property browser and set the views diagram property to the diagram object. If that object is not visible in the diagram property drop-down list, close windows form and open it again

      2. Project properties

Now set the properties of the diagram view and diagram in the Properties window.

    • Start with the 'Name' property, which defines the name of the variable it will use to access the objects from code

    • Add diagram view in the mainwindows form. All diagrams have its own properties. Prepare separate windows form for all diagrams properties. Add these forms in main windows according to section 3.1.2

      1. Text file

        Draw the flowchart according to rules of the software. Take first symbol in the flowchart icon. Then at that time software write the icon name in the text file. Take another icon of flowchart that time software repeats the same procedure. Then user opens the property window of selected icon. The property window is edited by user and the edited content automatically written in Text file. The same procedure is repeated for different icons.

        Check the flowchart in proper manner according to rules. Click on Run Convert flowchart into text file.

      2. Converting code (Text to C converter)

        The Text to C conversion is done with the help of Converting code. This program defines codes for particular symbols. Text file begins with START .Then comparison of converting code and available text file takes place. If both the strings are matched then particular C code will be written in OUTPUT file. Consider a simple example. When text file shows the START then Initialization of microcontroller takes place in OUTPUT file.

      3. Converting code (Text to C converter)

        #include<lpc21xx.h>

        void Delay (unsigned int i)

        {

        unsigned int j, k; for (j=0; j<i; j++)

        {

        for(k=0; k<=8200;k++)

        ;

        }

        }

        void main (void)

        {

        IODIR0=0x80000000; IOSET0=0x80000000;

        Delay (500); IOCLR0=0x80000000

        ;

        }

        (Port

        START

        * INPUT 0

        no)

        * OUTPUT 0

        * SET 0

        * DELAY 500

        value)

        *

        The Text to C conversion is done with the help of Converting code. This program defines codes for particular symbols. Text file begins with START .Then comparison of converting code and available text file takes place. If both the strings are matched then particular C code will be written in OUTPUT file. Consider a simple example. When text file shows the START then Initialization of microcontroller takes place in OUTPUT file.

        CLEAR (Port no)

        *

        END

        E Flowchart

        Read next line of text file.

        If match occurs then C code of START will be written in OUTPUT file.

        Compare START of converting code with text file.

        Read a first line of text file

        START

        Apply same procedure until Text file ends.

        If match occurs then C code of string will be written in OUTPUT file.

        Compare next string with text file.

        END

        (Port no) (Port no)

        (Delay

        Fig 2 text to c code converter program

      4. Steps for conversion from Text to C

  • Input file will Text file and OUTPUT file will C code.

  • Converting program will convert Text file to C code.

  • Read a first line of text file and compare START of converting code with text file.

  • If condition is true then C code of START will be automatically written in OUTPUT file.

  • Apply same procedure until Text file ends.

  • n this way C code will be generated.

Fig 3 flowchart of graphics user interface to text file

XPERIMENTAL RESULTS

Flow C allows designing of ARM-based programs, simply by drawing a flow chart of the desired program. The system is converting it into a C program which is compatible to ARM 7 microcontroller (LPC 2138).

  • Draw the flowchart in Flow c.

  • Check the flowchart in a proper manner and click on RUN.

  • Creating actual C code is compatible of ARM 7 microcontroller (LPC 2138).

  • Transfer the generated C code to KEIL compiler, build it and generate a HEX file.

  • Simulating code in Proteus (circuit simulator).

FLOW C (Graphics user interface)

Fig 4 Graphics user interface

Output Embedded C code

Compilation view of KEIL

Fig 6 compilation in keil

5 CONCLUSIONS

FLOW C is the best way for the beginners to create a program for general purpose. It is superior to the conventional programming software in Error free results, fast, flexible and user-friendliness. There is no necessity to remember the syntax of programming language. It takes the benefits of easy-to-understand and easy-to-perform of the flowchart.

The proposed system is practical and useful to be used as a powerful tool for program development. Execute program by this system is also easier than the old fashion. Even a programmer may use the proposed system to solve the problem, and explain the idea to the other. Moreover it can be used as a tool for teaching a computer programming. It can be easy to create Embedded C codes of microcontroller.

Fig 5 Output code

6 REFERANCES

#include<lpc21xx.h>

void main(void)

{

int d; d=IOPIN0;

IODIR1=0x80000000; IOPIN1=d;

}

    1. Geoffrey G. Roy, Joel Kelso, Craig Standing, "Towards a Visual Programming Environment for Software Development," Proceedings on Software Engineering: Education & Practice, 1998, pp. 381-388.

    2. Min Hu, "A Case Study in Teaching Adult Students Computer Programming", Proceedings of the 16th Annual NACCQ, Palmerton, North New Zealand, July 2003, pp. 287-291.

    3. Marian G. Williams, William A. Ladder, "Visual Programming Labs for Introducing Computer Science Concepts", Frontiers in Education Conference, 1993, pp. 797- 802

Leave a Reply