BASICtools

...


FREE!

On DOWNLOAD an executable installer will be downloaded. You will have to RUN ANYWAY from the Microsoft warning.

BASICtools includes an emulator that runs on a PC without connection to any ARM CPU. We also have versions for Linux and Mac..

The syntax of this BASIC is much like the original Microsoft BASIC, QBASIC or early versions of Visual BASIC.

As part of the compile process a modified version of the C pre-processor is called that allows #include, #define, #ifdef ... #endif, #if ... #endif, #error and #warn

Support for interrupts, floating point accelerators, and multi-tasking.

Declarations
DIM declares a variable or array
AS INTEGER declares an integer variable - default
AS SINGLE declares a floating point variable
AS STRING declares a string
AS BYTE declares an array of bytes
PARAMARRAY declares a variable number of arguments
CONST declares an integer, single, string or array constant
SUB declares a subroutine
FUNCTION declares a function that returns a value
INTERRUPT SUB declares an interrupt subroutine
END end of SUB, FUNCTION or program
' a comment comments
Control Flow
MAIN start of a program
STOP enters a debug monitor
DO.. UNTIL repeats a block of statement
FOR.. NEXT iterates a block of statemets
IF..THEN.. ELSE..ENDIF conditional execution
SELECT..CASE conditional execution
WHILE.. LOOP repeats a block of statements
GOTO transfers control
GOSUB call subroutine or function (not required)
RETURN return from subroutine or function
EXIT terminates a block of statements
Hardware function
AD returns analog value on specific pins (10 bit)
BAUD sets the baud rate on the serial channel
RXD receive a character on the serial channel
TXD send a character to the serial channel
*(expression) access hardware registers (like PEEK or POKE)
DIR controls direction of a pin
HIGH sets a pin to output and high
IN reads digital value of a pin
INPUT sets a pin as an input
IO controls or reads a pin
LOW sets a pin as output and low
OUT sets state of an output pin
OUTPUT sets a pin to be an output
INTERRUPT enable or disable interrupts
TIMER returns free running counter incrementing each microsecond
WAIT waits a number of milliseconds
WAITMICRO waits a number of microseconds
Strings
LEN returns the number of bytes in a string
LEFT returns a number of characters on the left of a string
RIGHT returns a number of characters on the right of a string
STRCHR finds first instance of a character in a string
STRCOMP compares two strings
SPRINTF C style string formating

included with AB-math.bas - compliments of Tod

Trig functions
cos returns the cos of the radians passed
sin returns the sin of the radians passed
tan returns the tangent of the radians passed
Power Functions
sqrt returns the square root
exp returns e to the x power
logn returns natural log
log10 returns 10 based log
pow returns number raised to power
Conversion
fix integer value of single, conversions also implied
floor rounds down
ceil rounds up
round rounds to closest integer
Inverse Trig functions
acos arc cosine
asin arc sine
atan arc tangent
Hyperbolic functions
cosh hyperbolic cosine
sinh hyperbolic sine
tanh hyperbolic tangent
Register definitions
LPC11U37.bas defines registers of the LPC11U37 accessed thru pointers
String Functions
midstr extracts characters from a string forming a new string
strchr finds a character in a string
strstr finds a string in a string
tolower converts a string to lower case
toupper converts a string to upper case
I2C operations
I2CIN read an I2C device
I2COUT write to an I2C device
SPI functions
SPIIN read an SPI device
SPIOUT write to an SPI device
SHIFT functions
SHIFTIN read to a non-byte oriented serial device
SHIFTOUT write to a non-byte oriented serial device
Onewire functions
OWIN read a one wire device
OWOUT write to a one wire device
PWM functions
HWPWM library hardware PWM functions, using counter peripheral
Conversions
CHR converts an ASCII character to a number
HEX returns hex value of a string
VAL converts a string to a decimal number
Console functions
DEBUGIN accepts input from console
PRINT prints to the console
PRINTF formatted print (C conventions)
Operators
- subtraction
MOD modulus arithmetic
* multiply
/ divide
- negate
& string concatenation
IF ternary operation
NOT binary negate
AND binary or conditional and
OR binary or conditional or
XOR binary or conditional exclusive or
>> shift right
<< shift left
= equality
<> not equals
< less than
<= less than or equal to
> greater than
>= greater than or equal to

These are added for backward compatibility, but most have been replaced

PBASIC functions
COUNT
PULSIN
PULSOUT
PWM
RCTIME
FREQOUT

Previous