Introduction

The language is based on standard BASIC but without line numbers. It is fully interactive in that you can enter variables and calculations and get results back immediately (interpreted). Programs can also be loaded into RAM or Flash and run from there.

The basic unit of a program is a function and programs can be built from the ground up using ‘function’, each one having a different function.

As an example hello world may look like:

function hello
    print “Hello World”
endf

To run the program simply type ‘hello’ at the console.

A function may or may not return a value and programs are made up of functions that can be loaded from a PC or from an SD Card into either RAM or Flash.

Language

Syntax

In general the language follows conventional BASIC as found in other variants. There are some minor and some notable exceptions. One notable exception is the comments statement which is ‘//’ rather than the more conventional REM or single quote. The single quote has been reserved for defining characters, i.e. ‘a’.

The second notable exception is that ALL statements (keywords or commands like ‘print’) are in lower case and the language is case sensitive, so ‘print’ is a valid keyword and ‘Print’ is not and will produce an error. The same goes for variables, as$, As$, AS$ are three different variables.

The language is extendable in that writing a function is tantamount to creating a new keyword. These can be stored in flash and the built in searching algorithms will find them and so the user defined function can be used exactly like a keyword. This actually is quite important when dealing with microcontrollers as it is not always possible to provide a keyword for every register configuration.

All functions return a value but this can be ignored, as a general rule keywords and functions with a bracket will return a value those without will not.
print “hello”, a$
Print does not have a bracket but:
j=len(a$)
The keyword ‘len’ does return a value and so it has brackets. In this case a value is inside the brackets, even where there is no parameter brackets are used to indicate that there is a returned value, e.g. ferror().

Reloading the PIC32-Basic Application

PIC32-BOS is an application that sits on top of Micro-BOS and as such is dealt with in that section however it is repeated here as it is quite likely that it will be needed on more than one occasion. It is quite easy to corrupt or spoil the application (PIC32-BAasic), it is a development platform after all.

A typical scenario would be to save a continuous loop to flash and then run it with auto, the only way pout of this is to re-install the application, this is how to do it.

Setp 1
Press the reset icon reset icon and within half a second press any key on the keyboard. This will take you into the Micro-Bos menu

micro-bos menu screenshot

Step 2
Select option 2 by pressing 2, this will erase the flash that the application (PIC32-Basic) sits in. It will then wait for an xmodem transfer by continually sending 'C'

Step 3
Open the xmodem transfer xmodem transfer icon dialog and select the PIC32-Basic binary file on the CD rom

xmodem transfer dialog screensshot

Step 4
When the transfer has completed, the dialog will close automatically if the 'Close on transfer complete' box has been ticked, if not close manually and you will be taken back to the Micro-BOS menus screen but this time the application will be in Flash, so press 5 and enter to go into the application.