Tel: (519) 746-7178
Email: info@lumousoft.com
Lumousoft graphic programming language allows software program to be presented in the form of schematics with blocks connected in parallel and series, similar to the electrical circuits which represents the electrical current flow in parallel or series circuits. When we look at an electric circuit, a part of electric circuits can be subtracted and replaced with a block named as integrated circuits. The block represents the subtracted part of electric circuits to perform special functions or task. The integrated circuit has multiple connectors or pins with the other part of circuits, and exchange information with the outside world. The integrated circuit not only enable the electronic designer to design more reliable and cost effective products, but also play an important role in our modern life.
In textual programming language a function represents a collection of program to perform special functions, limited by one dimension, the function has only one input and one output or return to make sequence flow from input to exit. As for some visual programming languages like Labview, Simulink, the pre-built modular blocks are employed to be connected together to make a program. Each modular block may have multiple input and output terminals like integrated circuit (IC). A modular block usually is treated as a parallel process in the program, and uses an event-trigger method to handle input signals and output responding signals. These modular blocks are generally provided by software provider, the user is very difficult to build their specific modules.
Graphical language offers more than one dimension than textual language, the graphic element in the graphic language should be able to handle all directions in a 2-dimensional plane, other than one dimension like textual language. It is well known that the more dimension it is, the more freedom. Lumousoft visual language takes the advantage of special compiling technology that allows compiling in network other than parse tree. Lumousoft graphic language allows the user to draw a more complicated layout to meet design requirement with less effort.
Lumousoft graphic programming language enables the executable block to be executed in sequence in the same way as a textual programming language does, but the flowing direction of the program depends on how the blocks are connected. Since Lumousoft VPL is a 2-dimensional layout language, we can subtract one part of the graphic program to construct an integrated graphic program with multiple input and output terminals for special functions just like an electric circuit. The integrated graphic program can be used as a function repeatedly, and it has multiple inputs and outputs with more flexibility and readability. Furthermore, the user can build their special IGP as simple as writing a textual function.
Therefore, in Lumousoft visual language Integrated graphic program (IGP) can be one of programming approaches that allows the user to have more choice to design his or her software program.
Fig.1 Inline call graph and eequivalent graph
Call Graph is similar to the function in a textual language. The function can be broken down into two classes, inline and regular functions. When a program calls an Inline function, the compiler just duplicates the inline function body and insert where it is called. On the other hand, When the program calls a regular function, the program jump to the function routine, after executing the function, it will return back to where it is called. Obviously, a function looks like 2-pin integrated circuit, one pin for input, the other for output. Because the Integrated Circuit (IC) is independent in the circuit, the inline function is more like an integrated circuit.
Lumousoft graphic programming language has an inline call graph which is the same as the textual inline function. When an inline call graph is called in an application program, the compiler will duplicate the call graph body and insert it into where it is called. Furthermore, all the variables or parameters in the duplicated graph, that declared in the call graph are replaced by the variable or arguments that passed by the graphic program who calls this inline graph. Fig.1 illustrate this duplication, the fig.1 (c) is the equivalent graphic program. Therefor we can consider the inline call graph has one entry and one exit, and can be easily inserted into one branch or path of program.
A programming element with one entry and one exit can be easily put into one way flow path, especially for one dimension and parse-tree based programming language. As for 2-d graphic programming language, we can extend the inline call graph to multiple input and output element that is connected in a network.
Fig.2 Graphic program layout
Fig.2 is the Lumousoft graphic code, we can cut out the part which is enclosed by a dot-line block and replace it with the integrated graphic program (IGP). Consequently, there are five connection terminals, two inputs and three outputs for a cutting-off part or integrated graphic program(IGP). Since the connection line contains flowing data, we need to decide which variables need to be passed to the integrated graphic program (IGP) . Therefore, we need to make socket for each terminal. For simplicity, we can use the same format as a function. The format for the socket is:
socket_name (parameter1, parameter2,…)
Where socket_name is the name of the socket.
In Lumousoft language the function name is a variable, so is the name of a socket, usually the data type of socket name is defined as void; parameter1, parameter2 are the parameters that want to be replaced in IGP. In the input socket, the parameters can be passed into IGP through arguments or variable of application program. While in the output socket, the parameter can be passed out to the application program.
Fig.3 illustrates that the IGP has two input and three output terminals. The input terminal is represented by the filled arrow symbol, the filled square bar stands for output terminal. The IGP symbol is represented by a block with a bottom left triangle, the context of the IGP block shows the name of IGP and socket as well as its arguments that are passed to the IGP graphic program. On the left hand side of the Fig.3 is the pane of IGP property and its image as well as component list tree in which the components are available for application
Fig.3 Graphic program with an IGP
To setup socket parameters, just double click the IGP block In Lumousoft Graphic programming language IDE, a block manager diagram will pop up as shown in Fig.4, fill the corresponding variable in the cell of parameter on the left pane. Close the block manager diagram, all the sockets will automatically be displayed in the IGP block as shown in Fig.3. The connection terminal symbol can be relocated in position. Unlike the regular symbol on the normal block, the terminal symbol of IGP cannot be deleted, added or change direction in implementing program.
Integrated Graph Program acts as a black box, how the data flow over IGP depends on the inside program path of IGP. If the output socket has one or more paths connected to one input socket, the living variable, which is alive after the IGP, will go through this input socket and pass out through this connected output socket. The inside local variable in the IGP cannot pass out to the application program, except that the local variable is socket parameter.
Fig.4 Block Manager Diagram
Input socket is responsible for passing application program arguments into IGP. While the output socket gives the door to exit IGP,and pass the result of IGP out to the outside program.
Fig.5 IGP component Setup
It would not take more efforts to build an Integrated Graphical Program (IGP) than to write a textual function code. Lumousoft VPL IDE offers an IGP building tool to accomplish IGP component. As we mentioned before, we need input and output sockets for interference with the outside program. The input socket symbol is a rectangle with a triangle cutting off on the left hand side as the symbol with label In0 shown in Fig.5. The output socket symbol is a rectangle with an extra triangle on the left hand side as the symbol with label Out0 shown in Fig.5. The input or output socket name and parameter can be edited through the block manager diagram in Lumousoft Graphic programming language IDE. When setup a new IGP component, an IGP block will be automatically displayed on the upper right corner of the screen. Whenever place a new input or output port socket, a new corresponding connection terminal symbol or pin (filled arrow or square bar) will automatically be attached to the IGP Block; If one socket port is deleted the corresponding pin in IGP block will be deleted too. Therefore, the outlook of IGP component can be seen simultaneously during building. The body of graphic program can be regularly layout for the special task or function.
Fig.6 Nested IGP Component
An IGP component may nest other components to make a multiple hierarchy level component. Fig.6 illustrates the nested component. Because Lumousft VSL is designed for microprocessor, and the microprocessor has limited memory resource, therefore, it cannot employ recurse technology. In the other words, the deeper nested components cannot contain the high level nested component.The Lumousoft VSL compiler can find this kind of recurring errors.
In Lumousoft graphic language, the IGP must be built before its implementation. The inside IGP will be replaced by the corresponding IGP body after building.
When an IGP component is accomplished, the inside paths need to be verified whether it violates the path rules that allow the compiler successfully compile and make graphic program correctly and logically. As we know a component which has multiple input and output sockets, it cannot run itself. In order to verify it, the compiler automatically puts the new component into a simple graphic routine with a start and end blocks as shown in Fig 7 (a), the Fig 7 (b) is an equivalent graphic program. Each input terminal is connected to switch block, therefore the inputs are in the select branches; while all the outputs are connected to the end block. With this verification main graphic program, the new component can be checked whether the inside paths in the new component have syntax errors and warnings.
The component is like a black box, and the compiler does not know whether the inputs are designed for parallel, select or sequence input. Since select branch has not special rule, it cannot cause violation against the rules. On the other hand, if we use a parallel branch to plug into each input socket, it may cause errors, for example, if these parallel branches cannot join somewhere or these parallel branch jump out of a loop without joining together with other parallel branches. With this test program, the new component can be compiled as a regular Lumousoft graphic program. If no error is found, the IDE will automatically add the new IGP component to the component tree as shown in the upper left pane in Fig.3. The new built component is ready for user implementation.
Fig.7 Test program and equivalent
When we want to use these components in the component tree for our program, the component can be drag and drop into the application program. Lumousoft Graphic programming language allows the user to modify an IGP component after it is used in applications. When the IGO component is modified and updated, any component that used in user graphic program will be automatically updated to the latest one including that one in component tree .
The above example IGP component we just built is used for comparison of two input terminal x, y. When x is lesser than y the program will go through the output terminal Out0; if x is equal to y, the output terminal Out1 will be the path for output; when x is greater than y, Out2 will be selected for output. Currently our example graphic program is designed for microprocessor PIC16F74, three port A pins are used to show the comparison result of two variables (xx, yy). These pins which are configured as the PIC portA, RA0, RA1 and RA2 respectively correspond to the result of lesser, equal and greater. The Fig.3 demonstrates the graphic program layout for this task.
Before Compiling, the compiler first duplicate the graphic program of IGP component and insert this duplicated graphic program into where it is implemented, plugging into the corresponding socket. Secondly, all the variables in the IGP graphic program that declared in the socket will be replaced by the arguments or variables that outside graphic program wants to pass through. Finally, delete the connection terminal and make direct connections, the equivalent graphic program is shown in Fig.2. After handling all the IGP graphic circuit, the compiler will perform the compiling job, including path analysis, syntax analysis and generation of assembling language and machine code.
Inline call graph has only one entry and exit, it is always in one graphic branch or path, and it is relatively easy for parse-tree based language to handle. While, the integrated graphic program (IGP) has multiple terminal and in different network that make more complicated. When a component is put into the application program, it should be beware of its connection and understand how the GIP work, just like electric IC, otherwise it can cause program crash.
Fig.8 Illegal Parallel Connection
Usually the selected branch like a switch or true/false branch will not cause a syntax path error, select branch just like “ goto ” instruction technology that will not cause programming running failure. On the other hand, the parallel branch might cause syntax failure, there are restrict rules on that, Fig.8 shows the illegal parallel layout. Therefore, when we insert a component into the application program, we need to combine the application program and component program to make sure the flow path is not in illegal paths.
Fig.9 Buffer Variable Input
Because Lumousoft uses variable replacement technology, the value of a variable that is passed into the IGP may change in this black box. To avoid this change, we can assign the value of a variable to a buffer variable, and then use the buffer variable to be passed to the IGP. Fig.9 is the example of how to use buffer variable t to keep the original variable unchanged.
In Lumousoft VPL, the data type of parameter that IGP defines in a socket is meaningless, since these variables are totally replaced by the outside variable, including data type. However, some variable inside the component need to cooperate with the socket parameter, the data type of this cooperated variable must meet the data accuracy. We can apply the data type that requires maximum byte to fulfill our data accuracy, but this lead to the requirement of more hardware resource and more size of the codes that might increase hardware cost and slow down program executing.
In order to fulfill the requirement of data accuracy and optimize the program performance, Lumousoft VPL language provides some special functions to dynamically setup data type of a variable. For example, the series function _static_set(26,x,y) is used to make the data type of x to be the same as that of y. The first parameter of digital number 26 is the index number of this series function of _static_set. Therefore, the data type of some inside variable of IGP can be dynamically changed based on the user requirements.
These kind of series function will not take action until the main graphic program is compiled. In this way we can keep data type consistency. For example, the data type of a variable depends on the a parameter that its parent component will pass to. If the data type of this parent argument or variable is uncertain, in other words, the data type of this parent argument is still decided by these series functions or this parent argument will be replaced by grandparent variable. Therefore, the data type of a variable cannot be decided until final compilation
When building component or inline function, if the compiler come across the _static_set series function, the compiler will skip. However, when final compiling, the compiler will give each variable a definited data type and interpret these _static_set series functions.
Usually, it needs to avoid defining the same variable in different sockets for an IGP component, the compiler will not consider it is an error, but it may cause failure. Because the different outside variables want to replace the same parameter of IGP, after compiling it will be found that only one outside variable replaces this parameter, the others not. To avoid this, we can use a buffer variable for outside variables to assign their value to it, and then use this buffer variable to pass to IGP. Fig.9 demonstrate the buffer variable application for component C0. The two input socket has one same parameter x, if we directly pass xx to the parameter x in the socket In0 and yy to the parameter x in the socket In1. When x is replaced by xx first, because all the x is replaced by xx, there is no x to be replaced by yy. That might cause bugs. The solution is to use buffer variable to avoid this situation.
Lumousoft graphic programming language makes a great effort to make Integrated Graphical Program (IGP) module available to the user in the similar way of the Integrated Circuit (IC) in the electronic industry field which revolutionize our modern life. The programmers are able to build their Integrated Circuit Program(IGP) modules in the same way of regular graphic programming method and make input or output port socket, in the similar way to construct a function. The programmers can use their familiar way to build an IGP component with less effort and easily implement them in their application.
Integrated Graphical Program (IGP) is like a textual inline function. When it is implemented, it just duplicated the IGP program body and insert where it is employed. By means of socket, the data flow can be kept consistent and smooth.
Lumousoft Graphic programming language allows the programmers have more programming strategies and make their graphic program more readable and easier maintenance.
©Lumousoft Inc. 2013 - 2018.
Links
Elektronik Forum EEWeb : EEWEb Germany is an online community for electronics and electrical engineers and hobbyist. It offers electrical engineering and electronics forum. It also has electrical and electronic design articles, and resources in the area of RF design, analog design, embedded design, PCB design, test and measure.
Power Electronics News: Power Electronics News offers electrical engineering news focused on Power and Power solutions. Up to date solutions and products featuring the latest innovations in power solutions.
PCBWeb : A free CAD application for designing and manufacturing electronics hardware.