BTRON MicroScript Reference Manual

An Outline of MicroScript


Pages iv-vii:

An Outline of MicroScript

MicroScript has been prepared with functions of the type that, on top of BTRON, display windows on the screen, change the contents of those windows one after the other in the manner of slides, move around figures inside those, and create buttons that perform some operation when the user clicks them with a pointing device.

In MicroScript, we use the Basic Figure Editor for the purpose of preparing the pictures and figures we will display. Also, we use the Basic Text Editor for scripts in order to describe actions. Script has the meaning of screenplay, and the pictures and figures are "actors," so if you think in terms that the screenplay of that play is a script, it will probably be easy to understand.

The first thing we do is create the characters that will appear and the background, and then attach names to them. For example, in a case where we create a certain figure and wish to attach the name "button" to this, we create the figure using the Basic Figure Editor, add the text frame "@Button" to this, and then we group together all the elements.

By doing things in this manner, we create the necessary characters that will appear, and then move on respectively attaching names to them. Moreover, by entering virtual objects, we can also execute those from inside scripts.

Normally, the display on a screen is carried out in units called "scenes." One scene is something in which we have defined the actors (figures with names attached to them) that will appear there. Normally, we create a frame (rectangle) we want to display in that scene, and then we create a figure that will serve as the background inside that. And then, we group together figure and frame, adding a name, and we use this as a scene.

On the screenplay side, we create with the Basic Text Editor a text with a special name that begins with "SCRIPT" in the manner of "SCRIPTxxx." Inside this, we describe the unfolding of the scene and the actions of the actors. And then, we enter inside the figure real object inside which we have created the actors and background this screenplay "SCRIPTxxx" virtual object.

By means of this, a one act play comes into existence. Furthermore, it is also possible to create a play made up of several acts. To open the stage curtains, we select [MicroScript] from the [Execute] menu.

In this manner, MicroScript can carry out visual programming.

As for the main functions of MicroScript, we can give such things as:

Because multitask, event driven description is possible for whichever one, we can, for example, easily carry out such things as the monitoring of multiple switches.

1. Functions as a Programming Language

As for names (variable names, segment names, procedure names) in MicroScript, character strings that include Chinese characters can be utilized, and regarding the representations of expressions and the meanings of operators, they are similar to C language. For the purpose of device control, it is also possible to write hexadecimal numbers. Among variables, there are four types: local variables, global variables, shared variables, and saved variables, which can be utilized in accordance with one's objectives. In particular, if one uses shared variables, then information exchange with other applications inside the same machine is possible.

Moreover, a portion of the global variables are reserved as system variables, and thus it is possible to reference information concerning the system, such as error states, the coordinate values of the PD, key input states, and the present date and time. Among the variables, it is possible to utilize such types as byte type, character type, integer type, floating point type, symbol type, and general-purpose type (for storing an arbitrary value). Furthermore, added to a general array, a function called an array section has also been provided. In addition to general numerical built-in functions, such as sin, cos, tan, and log, abundant built-in functions such as element search inside arrays, comparison of arrays, and character string operations have been prepared.

As for language flow control functions, there are such things as a conditional decision function based on IF`ELSE`ENDIF; a conditional decision/branching function based on SWITCH`CASE`ENDCASE; a recursion function based on REPEAT`ENDREPEAT, WHILE`ENDWHILE; a recursion and wait state breaking function based on BREAK; procedure call up functions based on CALL and EXECUTE; and a procedure forced termination function based on TERMINATE.

MicroScript procedures are defined using ACTION, MACTION, FUNC, and when a procedure is called in the manner of a subroutine by means of CALL, there are cases in which it will be called as a separate task by means of EXECUTE. When we use EXECUTE, it comes about that the side that called the procedure and the side that was called as the procedure begin parallel execution, and thus we can describe a multitask program.

Moreover, there is a function that directly starts up a procedure in following with a PD or menu operation, and a function that automatically executes a predefined procedure at the time of the beginning and termination of the execution of the entire program.

Finally, there is a macro definition function based on the DEFINE statement as a preprocessor function.

Moreover, because there is a function that divides a program into several real objects, it is possible to carry out management of the overall program with good visibility by combining this function together with the real object/virtual object model of BTRON.

For example, it is possible to have a method of use in which we place into a separate real object the parts of the program with lots of modifications and then place in an easy-to-access place a virtual object that points to that.

2. Functions to Input from the PD and the Keyboard

By means of giving event parameters in an ACTION statement that defines a procedure, we can execute procedures that respond to PD and keyboard operations. These procedures are executed independent of the normal procedure flow that is executed sequentially, and thus realize an event driven programming style.

3. Functions to Control the Display of Figures

With MicroScript, it is possible to carry out various types of operations, such as displaying and moving, in regard to figures that one has created with the Basic Figure Editor of BTRON. If we utilize these functions, we can create something like simple animation. Moreover, by combining this together with procedure definition functions based on PD operations, it is also possible to create electronic documents and presentation tools in which you move to the next screen when you click on a certain location. Various types of special effects functions on top of the screen for the purpose of making expressive power abundant have been prepared.

4. Functions to Control Applications

By means of VOPEN, the default application for a specified real object (an application that can be started up with a double click of the PD) can be executed. It doesn't matter even if the application that is started up is a MicroScript application. In that case, it will come about that we will execute from inside a MicroScript program another MicroScript program. Applications that have started up can be terminated (their window will shut) in the midst of processing by means of VCLOSE. Moreover, we can wait for the termination of an application by means of VWAIT.

5. Functions to Control Input and Output

In MicroScript, we can carry out input and output with external devices using the RS-232C and the printer port. Moreover, we can also send data to VISCA equipment and remote controls for home appliances, and thus control audio visual equipment and home appliances. Furthermore, VISCA (Video System Control Architecture) is a standard protocol for the purpose of controlling video equipment from a computer. Even outside of the RS-232C, it is possible to carry out finely detailed device control by means of DOPEN, DCLOSE, DREAD, and DWRITE for other devices. Also, there are the FOPEN, FCLOSE, FREAD, and FWRITE statements for input/output use with real objects (files), and thus we can access BTRON record format files.

MicroScript, in the manner above, is provided with all these: functions as an ordinary programming language, visual functions, and functions compatible with real-time multitasking; it is thus made up so that one can create on top of BTRON a very wide range of applications.

At present, MicroScript can be utilized with:

Sales agency: Personal Media Corporation

Sales agency: Seiko Instruments Inc.


The above contents of BTRON MicroScript Reference Manual were translated and loaded onto this Web page with the permission of Personal Media Corporation.

Copyright (c) 1997 Personal Media Corporation

Copyright (c) 2009 Sakamura Laboratory, University Museum, University of Tokyo