Tel: (519) 746-7178
Email: info@lumousoft.com
A new high-level graphic programming language and its IDE (Integration Development Environment) for microprocessor-based embedded system is presented here. The graphic programming language allows programming in the graphic block diagram environment. In comparison with textual programming languages, it allows direct bit operation, and enables to program or layout complicated network for cognitive algorithm application. With trace analyzer the graphic language can fully recycle memory and reduce code reductancy to lower cost and improve performance. Assembly and machinery codes are generated. This new graphic language provides great convenience for embedded software maintenance, coding, verification, validation, code reusabilty.
With the increasing complexity and sophistication of electronics device, the more efforts are put on embedded software that plays a pivotal role in electronic industry. There are great demands for more efficient, productive and reliable software developing tool to facilitate embedded software design, develop and maintenance.
The blueprint is proven the most efficient way in engineering practice for design, validation, verification, test, maintenance and modification. Embedded software requires more restrict and complex than other software field due to real time and reliability. Embedded software failure might cause serious damage to electronic device. Embedded software engineer or developer usually has electronic background with familiarity of blueprints. But current embedded software design and development have to be on the text-based platform that is hard to read and catch the whole map of software project. Consequently, developing software has to take more efforts and more time than other engineering fields like electricity, mechanics.
C/C++ language is a dominant language in embedded system due to similarity to assembly language and more readability. Comparing with assembly language, C/C++ compiler might generate bigger size of machine codes and use up more memory, sometimes may cause memory leakage and memory conflict or boundary corruption, yielding more cost in hardware and poor quality of performance. Because it has more readability and efficiency than assembly language, it still gains dominant application in the embedded field.
In addition to textual language, visual programming language (VPL) begin to be found application in embedded system like flowcode produced by Matrix Multimedia for programming embedded devices. Most of VPL languages have limit application because programming capability depends on how many graphic components available from VPL provider.
Lumousoft graphic language is a programming language for microprocessor allowing programming in block environment with high usage of hardware resource and high quality of performance. This graphic language not only has the same programming capability as textual language such as C but also enables to program complex network for cognitive algorithm application.
Lumousoft graphic language is a programming language in block environment. In general, the textual language uses textual statement to represent flowing program path in the form of parse tree, and each tree branch is not allowed to be interconnected , an example parse tree is shown in Fig.1 (a). Unlike textual language, Lumousoft graphic language uses block, connection line and direction symbol to form program flowing pattern, the block diagram connection pattern is not limited to the parse tree, allowing branches to be interacted to form complicated networks. An example is illustrated in Fig.1 (b) . In lumousoft graphic language, a path analyzer is employed to analyze the program pattern including loop.
Lumousoft graphic language uses path analyzer to indentify block connection pattern other than parse tree, but in each block are there multiple lines of expression for logic or arithmetic operation, these lines of instruction are arrange in executable sequence without jumping branch. While, each line of expression still follows parse tree for analysis and compilation.
Fig.1 Parse tree and network
Lumousoft graphic language employs path analyzer to determinate network. This mechanism is different from current textual language syntactic structure and allows lumousoft graphic language to handle more complicated network to accomplish the more complex and sophisticated task.
Lumousoft graphic language is basically made of four units: block, line, direction and statements in the block. Blocks contain executable statement which performs logic and arithmetic operation; line is applied for building connection between blocks; direction determines how the process flows. The symbol of direction is shown in Fig.2. There are two class directions, input and output. The output can be further divided into non- conditional output (pass output) and conditional outputs (true and false output).
Fig.2 Block direction symbol
Because lumousoft graphic language is a programming language, the program codes need to be modified form times to times, the symbol or shape of graphic might change accordingly, this will cause great inconvenience for developer and waste a lot of time to adjust symbol. Therefore, Lumousoft graphic language does not adopt the standard flowchart symbols, just employs block for ease of programming.
The block diagram can be layout in the form of series, parallel, selection, loop and bridges. Fig. 3 illustrates the basic layout formats. With these basic layout units, a complicated network can be created.
Fig.3 Basic layout format
Similar to series circuit, the program execute in sequence.
The current Lumousoft graphic language version is applied to single chip microprocessor, not for multi-cores. In our daily life, parallelism exists like electrical circuit. In order for a single core to handle parallelism, the parallel branches need to be rearranged and connected in sequence. Fig.4 demonstrates the conversion of parallel to sequence.
Fig.4 Transformation form parallel to sequence
The parallelism that lumousoft graphic can handle should meet the following condition.
Fig.5 Illegal parallel connection
The parallel connection can be nested in a loop or contain a loop as shown in Fig. 6 (a) and (b). Parallel connection can be as complicated as Fig.6 (c).
Fig.6 parallel connection samples
The selection branches consist of true and false branches coming from decision block as shown in Fig. 3(c). The program will chose which branch to be flowed depending on the last line of statement in the decision block. If the value of last statement in the decision block is non-zero value, the program will flow to true branch; if the value of last statement in the decision block is zero, the program will flow to false branch. By selection block, complicated network including loop can be created.
In C language, it uses statement to represent loop and condition like do...while(condition);, for( ), while(){..} , if().. else if.. . Lumousoft graphic language uses blocks to represent this branch select function including loop. The block output direction can be defined as conditional output true and false output as shown in Fig.2(c). The branch selecting condition expression ( same as c language ) is the last statement in the block. The fig.7 illustrates the do while and if ..elseif.. else graphic expression.
Fig.7 Loop and condition
Fig.3 (1)-(4) show four kinds of basic bridges. With these basic bridges, lumousoft language is able to design complex algorithm with less efforts.
Like other programming languages, Lumousoft graphic language has local ,global, system, constant, array, pointer variable. Except the regular data type, lumousoft graphic language has bit variable that is especially helpful for microprocessor application. As soon as a variable is defined, the variable can be accessed in the whole scope where the variable stays. There is no need to make declaration of variable.
Because lumousoft graphic language adopts block network instead of parse tree, tremendous memories might be required. The memory size is one of factors that impact the price of microprocessor. The bigger size of memory the more expensive microprocessor is.
A variable usually is assigned a memory or register to store a special value. When the content of a memory is written and the previous value of the memory is lost, we can say that the previous value is dead and the variable associated with this dead value die too. While, when the memory is written a new value, the variable associated with this memory is born. A variable has life span from the variable is assigned a new value to the last time usage before the memory was override. A variable might alive and die for many times in a program.
Lumousoft graphic language takes the advantage of trace analyzer to indentify the life span of a variable, When a memory is born or created, a memory will be allocated to the variable, and when the variable is dead the associated memory will be released and ready for a new variable. Because global, static, system variables have permanent life, only the local memory is going to be optimized in lumousoft graphic language.
Bit is the atomic data type of data. Current high level languages like c does not allow directly operating on bit, usually using indirect way like byte bitwise operation. Lumousoft graphic language allows direct operate on bit. Here the variable holds the bit variable is called as bit source variable, and where the bit sits in a bit source is called bit position value.
The bit variable can be defined in variable manager dialog of IDE or use the below statement to define:
bitVar = &(sourceVar # positionVal) (1)
Or uses the below expression to represent a bit variable
sourceVar # positionVal (2)
where
bitVar bit variable
sourceVar bit source variable
positionVal bit position in the bit source variable
The bit value can be 0 or 1 like Boolean, when bit work with non-bit data type variable or in logical operation, the bit variable is treat as a Boolean variable. When the bit is set the Boolean value is 1, and the bit is reset, the Boolean value 0. Therefore, when a bit variable works with other non-bit variable it works as Boolean similar to other language like c.
When a bit variable works with other bit variable it will operate according to bit value. The bit operation can be:
and (&), or(|), xor(^), assign(=), not(~ or !),
and assign(&=), or assign (|=), xor assign(^=).
When a bit source variable consists of more than one byte, lumousoft graphic compiler will use expressions (3) and (4) to find the byte that bit stay and find out the correct bit position.
nByte= floor(bitPos / sysBitLen) (3)
nPos=bitPos % sysBitLen (4)
Where
nByte the byte where the concerned bit stay.
nPos the bit position in the nByte
floor a function to get the round down integer value
bitPos bit position
sysBitLen The bit number of memory that microprocessor can handle
For example a bit variable is fifteenth bit of a bit source, the bit source is short data type and supposed that is allocated by 2 bytes with the address of 0x20 and 0x21. The address of 0x20 is lower byte and 0x21 higher byte. The compiler will use the 7th bit of the byte with the address of 0x21 to replace this bit variable.
Lumousft graphic language is specially designed for microprocessor application, the program consists of 5 parts:
Fig.8 Modules
In Fig.8 for the simplicity, we use single block to represent complex block networks.
A sub module in lumousoft graphic language is a group of blocks to achieve a special task, and at any point of statement in a block it can be called, just the same as function in textual language. Lumousoft graphic language treats the sub module name as a variable, while the function in textual language it is just a return value. In lumousoft graphic language, if a sub module name followed by a parentheses, it indicates that the sub module will be called and assign a return value to this sub module name variable. If there are not parentheses followed, the sub module is simply a variable.
The sub module can be divided into two kinds of modules, inline sub module and regular sub module, just like inline function and function in textual language. Inline sub module means that the calling statement is completely replaced with the copy of the whole group of module blocks. A regular sub module is used to be called. Because sub module name is a variable, there is no need to be declared. But if the sub module is in another file, it needs to be imported. When the file is imported, all the sub modules in the imported file can be implemented.
Since the main module and the interruption module belong to the different thread, their memory should be isolated except the memory of the global variables. If the different thread modules call the same sub module, Lumousoft graphic compiler will makes one copy of the sub module including variables for each thread usage.
Because assembly language is flexible and efficient, the assembly language is still found application in embedded field. Usually assembly language is embedded in other language. Lumousoft graphic language allows assembly language to be embedded in block environment.
Assembly language operand can be a variable defined in the module including array, pointer except bit variable. But these variables used in assembly language must be those variables that have known address through static analysis. Unhandled variable like a[i], *p, where p=&x+i; the variable a is array variable and i is a variable, p is pointer variable; in other words, theses unhandled variables are those that are only handled by indirect address.
Because the assembly instruction only handles single- byte variable, if a variable is composed of more than one byte, only the first byte can be handled by assembly instruction. To solve one-byte problem, we can implement pointer to handle all bytes.
Lumousoft IDE offers the facility to layout lumousoft graphic program, compilation and generation of assembly codes, machine codes for burning to microprocessor as well as other files like block flow file which textually describes how the block flow, assignment file for variable address assignment and label of program memory address. Fig.9 shows the interface of IDE.
Fig.9 Block dialog and variable manager
Lumousoft IDE graphic editor functions include drawing line, block, directions, and terminal block. The editor has functions like undo, redo, copy, delete, cut, paste, move, save, selection, search etc.
The codes in block are edited through block diagram which pops up when double clicks on a block that wants to be edited. Fig.9 shows the block dialog and variable manager. The upper left text block is used to fill in codes. When a statement is put in, the IDE will perform lexical analysis and obtain variable, key words and other tokens. The scanned variables are put into the variable tables on the right hand side. When IDE find a new variable, the variable has default attribute with data type of char and range type of local. The variable can be edited and change its attributes through the variable manger dialog as shown in Fig.9. All the variables within the connected block can be accessed.
The bottom box is used for the user to write comment for this block. Codes and comments can be flipped to display by clicking on the radio button in the middle on the right hand side of the block dialog.
Two situation need to be considered when click on compile menu on the right top of the menu bar:
The example code, shown in Fig.10, is an inline module from the Lumousoft language library, which is used to judge whether the variable is zero for all kinds of data type such as bit variable, constant, pointer variable, one byte or multiple byte variable.
Fig.10 An example of library graphic codes
Fig.11 is a alternative displays of code, showing the block comment to indicate how the program flow.
Fig.11 Graphic Pseudo code
The next example is to design two sets of led display by use of PIC16F677. The port A connects to a set of led and the port B to another set of led. In each set of led, each led lights up one by one. For the first set, each led lights up for 2 seconds; while, for the second set, each led lights up for 4 seconds. Since the two sets of led operate simutaneously, we can apply parallel method to handle. Fig. 13 illustrates the graphic codes. Timer0 of PIC16F677 is used to triger interrupt every 1 ms. Both the variable timeA and timeB have unsighned short data type and are used as timer for port A and port B repectively. The terminal block ENDLOOP is implemented to make a big loop. When the program run to the terminal END, it will come to ENDLOOP and loop. In the interruption module the register W and status will be autmoatically stored in w_back and status_bake and when interruption is done, the register w and status will be restored to the status when the interruption happens. After compilated the IDE will generate flw file to show how the block flows. Fig.13 shows the content of the flw file. Fig.14 shows the assembly file generated after completing compilation. The hex file of machine codes is displayed in Fig.15.
Fig.12 led display codes
Fig.13 Block Flow
Fig.14 Assembly codes
Fig.15 Machine codes
Lumousoft graphic language is a high level graphic programming language, designed for microprocessor based embedded system, allowing the user to design and develop embedded software in the block environment. Lumousoft graphic language uses path analyzer to analyze block network connection pattern instead of parse tree, as a result, lumousoft graphic language can offer more flexible and intuitive method to handle more complicated algorithm than textual languages does. Taking advantage of path analyzer, Lumousoft graphic language is able to determine each variable life span and make full recycle of memory. Lumousoft IDE offers the facility to layout lumousoft graphic program, compilation and generates assembly codes, machine codes. Lumousoft graphic language provides a graphic coding solution to handle embedded software engineering like other blueprints based engineering field. Because of graphic coding, lumousoft graphic language can give the user a bird view of their project with the great convenience of embedded software maintenance, review, design, coding, validation, verification, test and modification.
©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.