BASCOM51 Statements


The following statements are supported :

Decision and structures:

IF, THEN, ELSE, ELSEIF, END IF, DO, LOOP, WHILE, WEND, UNTIL, EXIT DO, EXIT WHILE, FOR, NEXT, TO, DOWNTO, STEP, EXIT FOR, ON .. GOTO/GOSUB, SELECT, CASE.

Input and output

PRINT, INPUT, INKEY, PRINTHEX, INPUTHEX, LCD, UPPERLINE, LOWERLINE,DISPLAY ON/OFF, CURSOR ON/OFF/BLINK/NOBLINK, HOME, LOCATE, SHIFTLCD LEFT/RIGHT, SHIFTCURSOR LEFT/RIGHT, CLS, DEFLCDCHAR, WAITKEY, INPUTBIN, PRINTBIN, LCDHEX, OPEN, CLOSE, DEBOUNCE, SHIFTIN, SHIFTOUT.

Numeric functions

AND, OR, XOR, INC, DEC, MOD, NOT, ABS, BCD.

I2C

I2CSTART, I2CSTOP, I2CWBYTE, I2CRBYTE, I2CSEND and I2CRECEIVE.

1WIRE

1WWRITE, 1WREAD, 1WRESET.

SPI

SPIINIT, SPIIN, SPIOUT.

Interrupt programming

ON INT0/INT1/TIMER0/TIMER1/SERIAL, RETURN, ENABLE, DISABLE, PRIORITY SET/RESET, COUNTERx, CAPTUREx, INTERRUPTS, CONFIG, START, LOAD.

Bit manipulation

SET, RESET, ROTATE, BITWAIT.

Variables

DIM, BIT , BYTE , INTEGER , WORD, LONG, SINGLE, STRING , DEFBIT, DEFBYTE, DEFINT, DEFWORD.

Miscellaneous

REM, ' , SWAP, END, STOP, CONST, DELAY, WAIT, WAITMS, GOTO, GOSUB, POWERDOWN, IDLE, DECLARE, CALL, SUB, END SUB, MAKEDEC, MAKEBCD, INP,OUT, ALIAS, DIM , ERASE, DATA, READ, RESTORE, INCR, DECR, PEEK, POKE, CPEEK, GETRC5.

Compiler directives

$INCLUDE, $NOINIT, $BAUD and $CRYSTAL, $OBJ, $SERIALINPUT, $SERIALOUTPUT, $ROMSTART, $RAMSIZE, $RAMSTART, $MONSTART, $IRAMSTART, $DEFAULT XRAM, $ASM-$END ASM, $LCD.

Conditional compilation

#IF, #ELSE, #ENDIF

String manipulation

STRING, SPACE, LEFT, RIGHT, MID, VAL, HEXVAL, LEN, STR, HEX, LCASE, UCASE


To make a program takes just a few steps :


  • Write the program in BASIC
  • Compile it to fast machine binary code
  • Download the program to the target board