emBASIC home page emBASIC home page

REFERENCE

This reference manual describes the emBASIC programming language. It is not intended as a tutorial.
While it will be as precise as possible, it uses English rather than formal specifications where appropriate. This should make the document more understandable to the average reader, however will leave room for ambiguities.

Terminal or IDE?

There are two ways to program in emBASIC, either with a terminal or terminal program on the SER0 line of the controller or by using the emBASIC WorkBench development environment through either BITBUS (for networked controllers) or RS232. This dual access has been a requirement of our customers with global presence: It should be possible to send a service technician to a customers site with nothing but a terminal program, download the program from the controller (no compiler will provide this convenience!), modify it as needed and upload it again to be executed. It will even be possible to insert or delete some lines immediately using the built-in (primitive) line editor. However, during creation of the program, you will prefer the ease of use of a multi-window editor with upload and debug features.

Please refer to the WorkBench section for a description on how to use this comfortable program editor and debugging help. Here, we start discussing the basics and use a simple terminal.

Set a terminal like Hyperterm, ZOC etc. to 19200Bd 8N1, no handshake and connect the selected COM port on your computer and SER0 of the controller with a null modem cable.

After switching on the controller, the following messages are displayed:

System started.
emBASIC Multitasking Compiling Interpreter
Version
<variable version information>
Copyright (c) 2002-2004 ELZET80 Mikrocomputer GmbH&Co., KG
Developed by Techno-St.Petersburg for ELZET80 Mikrocomputer GmbH&Co., KG
Language: en. Country: GB. Charset: ISO-8859-15.

MEMORY USAGE (bytes):
Source Size Used Avail Use%
mCAT 1981332 990720 990612 50
Memory block: 41366c - 505400, 1981332
You are administrator
main#

The main# prompt signifies you are in the startup Sequence "main" and the program awaits your input.

To go to immediate mode, type

!EXIT

You will then see the "#" prompt, announcing immediate mode from which you can execute emBASIC statements that don't reference any variables, for example: # PRINT 3*5

To execute immediate mode commands while entering program lines, please prefix the command with a "!", like:

main# !PRINT "Hello everybody!"

To create a new SEQUENCE or TASK, use the following commands:

# SEQUENCE mySeq1 PRIO -2    or
# TASK myTask7 PRIO 2 ALL 200

########

 

 

SHELL commands

!CLEAR

LIST

BYE