This reference manual describes the emBASIC programming language. It
is not intended as a tutorial. 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. MEMORY USAGE (bytes): 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 ########
SHELL commands !CLEAR LIST BYE |