BASCOM-AVR Overview

(Difference between revisions)
Jump to: navigation, search
(Created page with "'''BASCOM-AVR© '''is the original '''Windows BASIC COMPILER''' for the '''AVR''' family'''. '''It is designed to run on '''XP'''/VISTA/WIN7...")
 
Line 1: Line 1:
 
'''BASCOM-AVR© '''is the original '''Windows BASIC COMPILER''' for the '''AVR''' family'''. '''It is designed to run on '''XP'''/VISTA/WIN7 and WIN8''''''
 
'''BASCOM-AVR© '''is the original '''Windows BASIC COMPILER''' for the '''AVR''' family'''. '''It is designed to run on '''XP'''/VISTA/WIN7 and WIN8''''''
  
This product description is updated in 2014. But we do not change it each time we update the software. In the [http://avrhelp.mcselec.com/index.html on line ]help you can find a list of all statements and functions.
+
This product description is updated in 2014. But we do not change it each time we update the software. In the [http://wiki.mcselec.com/bavr/ online help] you can find a list of all statements and functions.
  
 
=== Key Benefits ===
 
=== Key Benefits ===
Line 15: Line 15:
 
*Statements are highly compatible with Microsoft’s VB/QB.
 
*Statements are highly compatible with Microsoft’s VB/QB.
 
*Special commands for '''LCD'''-displays , '''I2C''' chips and '''1WIRE''' chips, PC keyboad, matrix keyboad, '''RC5''' reception, software UART, SPI , graphical LCD, send IR RC5,'''RC6''' or Sony code.
 
*Special commands for '''LCD'''-displays , '''I2C''' chips and '''1WIRE''' chips, PC keyboad, matrix keyboad, '''RC5''' reception, software UART, SPI , graphical LCD, send IR RC5,'''RC6''' or Sony code.
* [http://www.mcselec.com/commerce/easy_tcp_ip.htm TCP/IP] with W3100A/W5100/W5200/W5300 chips.
+
*TCP/IP with W3100A/W5100/W5200/W5300 chips.
*Built in AVR-DOS functions like MKDIR, CHDIR, DIR, OPEN, CLOSE, etc. Just as they work in  QB/VB !
+
*Built in AVR-DOS functions like MKDIR, CHDIR, DIR, OPEN, CLOSE, etc. Just as they work in  QB/VB !
 
*Local variables, user functions, library support.
 
*Local variables, user functions, library support.
 
*Integrated&nbsp;<u>terminal emulator with download option.</u>.
 
*Integrated&nbsp;<u>terminal emulator with download option.</u>.
Line 27: Line 27:
 
*DEMO version compiles&nbsp;'''4KB'''&nbsp;of binary code. Well suited for the ATmega48.
 
*DEMO version compiles&nbsp;'''4KB'''&nbsp;of binary code. Well suited for the ATmega48.
 
*[http://www.mcselec.com/commerce/books.htm English an German Books available]
 
*[http://www.mcselec.com/commerce/books.htm English an German Books available]
*&nbsp;AT mouse simulator, AT keyboard simulator, I2C Slave available as add on.
+
*AT mouse simulator, AT keyboard simulator, I2C Slave available as add on.
 
*This product is developed in 1995 and is updated regularly.
 
*This product is developed in 1995 and is updated regularly.
  
Line 35: Line 35:
  
 
'''Decision and structures'''<br/>IF, THEN, ELSE, ELSEIF, END IF, DO, LOOP, WHILE, WEND, UNTIL, EXIT DO, EXIT WHILE, FOR, NEXT, TO, STEP, EXIT FOR, ON .. GOTO/GOSUB, SELECT, CASE.
 
'''Decision and structures'''<br/>IF, THEN, ELSE, ELSEIF, END IF, DO, LOOP, WHILE, WEND, UNTIL, EXIT DO, EXIT WHILE, FOR, NEXT, TO, STEP, EXIT FOR, ON .. GOTO/GOSUB, SELECT, CASE.
 +
 +
  
 
'''Input and output'''<br/>PRINT, INPUT, INKEY, PRINT, 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, OPEN, CLOSE, DEBOUNCE, SHIFTIN, SHIFTOUT, GETATKBD, SPC, SERIN, SEROUT
 
'''Input and output'''<br/>PRINT, INPUT, INKEY, PRINT, 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, OPEN, CLOSE, DEBOUNCE, SHIFTIN, SHIFTOUT, GETATKBD, SPC, SERIN, SEROUT
 +
 +
  
 
'''Numeric functions'''<br/>AND, OR, XOR, INC, DEC, MOD, NOT, ABS, BCD, LOG, EXP, SQR, SIN,COS,TAN,ATN, ATN2, ASIN, ACOS, FIX, ROUND, MOD, SGN, POWER, RAD2DEG, DEG2RAD, LOG10, TANH, SINH, COSH.
 
'''Numeric functions'''<br/>AND, OR, XOR, INC, DEC, MOD, NOT, ABS, BCD, LOG, EXP, SQR, SIN,COS,TAN,ATN, ATN2, ASIN, ACOS, FIX, ROUND, MOD, SGN, POWER, RAD2DEG, DEG2RAD, LOG10, TANH, SINH, COSH.
 +
 +
  
 
'''I2C'''<br/>I2CSTART, I2CSTOP, I2CWBYTE, I2CRBYTE, I2CSEND and I2CRECEIVE.
 
'''I2C'''<br/>I2CSTART, I2CSTOP, I2CWBYTE, I2CRBYTE, I2CSEND and I2CRECEIVE.
 +
 +
  
 
'''1WIRE'''<br/>1WWRITE, 1WREAD, 1WRESET, 1WIRECOUNT, 1WSEARCHFIRST, 1WSEARCHNEXT.
 
'''1WIRE'''<br/>1WWRITE, 1WREAD, 1WRESET, 1WIRECOUNT, 1WSEARCHFIRST, 1WSEARCHNEXT.
 +
 +
  
 
'''SPI'''<br/>SPIINIT, SPIIN, SPIOUT, SPIMOVE.
 
'''SPI'''<br/>SPIINIT, SPIIN, SPIOUT, SPIMOVE.
 +
 +
  
 
'''CAN'''<br/>CONFIG CANBUSMODE,&nbsp;CONFIG CANMOB,&nbsp;CANBAUD,&nbsp;CANRESET,&nbsp;CANCLEARMOB,&nbsp;CANCLEARALLMOBS,&nbsp;CANSEND,&nbsp;CANRECEIVE&nbsp;,&nbsp;CANID,CANSELPAGE,&nbsp;CANGETINTS
 
'''CAN'''<br/>CONFIG CANBUSMODE,&nbsp;CONFIG CANMOB,&nbsp;CANBAUD,&nbsp;CANRESET,&nbsp;CANCLEARMOB,&nbsp;CANCLEARALLMOBS,&nbsp;CANSEND,&nbsp;CANRECEIVE&nbsp;,&nbsp;CANID,CANSELPAGE,&nbsp;CANGETINTS
 +
 +
  
 
'''TCP/IP'''<br/>TCP/IP routines can be used with the W3100/IIM7000/IIM7010/W5100/W5200/W5300 modules.
 
'''TCP/IP'''<br/>TCP/IP routines can be used with the W3100/IIM7000/IIM7010/W5100/W5200/W5300 modules.
Line 52: Line 66:
 
BASE64DEC&nbsp;,&nbsp;BASE64ENC&nbsp;,&nbsp;IP2STR&nbsp;,&nbsp;UDPREAD&nbsp;,&nbsp;UDPWRITE&nbsp;,&nbsp;UDPWRITESTR&nbsp;,&nbsp;TCPWRITE&nbsp;,&nbsp;TCPWRITESTR&nbsp;,&nbsp;TCPREAD&nbsp;,GETDSTIP&nbsp;,&nbsp;GETDSTPORT&nbsp;,&nbsp;SOCKETSTAT&nbsp;,&nbsp;SOCKETCONNECT&nbsp;,SOCKETLISTEN&nbsp;,&nbsp;&nbsp;GETSOCKET&nbsp;,&nbsp;SOCKETCLOSE&nbsp;,&nbsp;SETTCP&nbsp;,&nbsp;GETTCPREGS&nbsp;,&nbsp;SETTCPREGS&nbsp;,&nbsp;SETIPPROTOCOL&nbsp;,&nbsp;TCPCHECKSUM&nbsp;,&nbsp;&nbsp;SOCKETDISCONNECT&nbsp;,&nbsp;SNTP&nbsp;,&nbsp;TCPREADHEADER&nbsp;,UDPREADHEADER
 
BASE64DEC&nbsp;,&nbsp;BASE64ENC&nbsp;,&nbsp;IP2STR&nbsp;,&nbsp;UDPREAD&nbsp;,&nbsp;UDPWRITE&nbsp;,&nbsp;UDPWRITESTR&nbsp;,&nbsp;TCPWRITE&nbsp;,&nbsp;TCPWRITESTR&nbsp;,&nbsp;TCPREAD&nbsp;,GETDSTIP&nbsp;,&nbsp;GETDSTPORT&nbsp;,&nbsp;SOCKETSTAT&nbsp;,&nbsp;SOCKETCONNECT&nbsp;,SOCKETLISTEN&nbsp;,&nbsp;&nbsp;GETSOCKET&nbsp;,&nbsp;SOCKETCLOSE&nbsp;,&nbsp;SETTCP&nbsp;,&nbsp;GETTCPREGS&nbsp;,&nbsp;SETTCPREGS&nbsp;,&nbsp;SETIPPROTOCOL&nbsp;,&nbsp;TCPCHECKSUM&nbsp;,&nbsp;&nbsp;SOCKETDISCONNECT&nbsp;,&nbsp;SNTP&nbsp;,&nbsp;TCPREADHEADER&nbsp;,UDPREADHEADER
  
&nbsp;'''Interrupt programming'''<br/>ON INT0/INT1/TIMER0/TIMER1/SERIAL, RETURN, ENABLE, DISABLE, COUNTERx, CAPTUREx, INTERRUPTS, CONFIG, START, LOAD.
+
 
 +
 
 +
'''Interrupt programming'''<br/>ON INT0/INT1/TIMER0/TIMER1/SERIAL, RETURN, ENABLE, DISABLE, COUNTERx, CAPTUREx, INTERRUPTS, CONFIG, START, LOAD.
 +
 
 +
 
  
 
'''Bit manipulation'''<br/>SET, RESET, ROTATE, SHIFT, BITWAIT, TOGGLE.
 
'''Bit manipulation'''<br/>SET, RESET, ROTATE, SHIFT, BITWAIT, TOGGLE.
 +
 +
  
 
'''Variables'''<br/>DIM, BIT , BYTE , INTEGER , WORD, LONG, SINGLE, DOUBLE, STRING , DEFBIT, DEFBYTE, DEFINT, DEFWORD.
 
'''Variables'''<br/>DIM, BIT , BYTE , INTEGER , WORD, LONG, SINGLE, DOUBLE, STRING , DEFBIT, DEFBYTE, DEFINT, DEFWORD.
 +
 +
  
 
'''Miscellaneous'''<br/>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, FUNCTION, READMAGCARD, BIN2GREY, GREY2BIN, CRC8, CRC16, CRC32, CHECKSUM.
 
'''Miscellaneous'''<br/>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, FUNCTION, READMAGCARD, BIN2GREY, GREY2BIN, CRC8, CRC16, CRC32, CHECKSUM.
 +
 +
  
 
'''Compiler directives'''<br/>$INCLUDE, $BAUD and $CRYSTAL, $SERIALINPUT, $SERIALOUTPUT, $RAMSIZE, $RAMSTART, $DEFAULT XRAM, $ASM-$END ASM, $LCD, $EXTERNAL, $LIB.
 
'''Compiler directives'''<br/>$INCLUDE, $BAUD and $CRYSTAL, $SERIALINPUT, $SERIALOUTPUT, $RAMSIZE, $RAMSTART, $DEFAULT XRAM, $ASM-$END ASM, $LCD, $EXTERNAL, $LIB.
 +
 +
  
 
'''String manipulation'''<br/>STRING, SPACE, LEFT, RIGHT, MID, VAL, HEXVAL, LEN, STR, HEX, LTRIM, RTRIM, TRIM, LCASE, UCASE, FORMAT, FUSING, INSTR, CHARPOS.
 
'''String manipulation'''<br/>STRING, SPACE, LEFT, RIGHT, MID, VAL, HEXVAL, LEN, STR, HEX, LTRIM, RTRIM, TRIM, LCASE, UCASE, FORMAT, FUSING, INSTR, CHARPOS.
 +
 +
  
 
'''And many other functions, statements and directives'''
 
'''And many other functions, statements and directives'''
  
==== To make a program takes just a few steps : ====
+
<br/>'''To make a program takes just a few steps&nbsp;:'''
  
 
*'''Write the program in BASIC'''
 
*'''Write the program in BASIC'''
Line 73: Line 101:
 
*'''Program the chip with one of the integrated programmers.'''<br/>(hardware must be purchased separately)
 
*'''Program the chip with one of the integrated programmers.'''<br/>(hardware must be purchased separately)
  
&nbsp;
+
 
 +
 
 +
[[File:Avr desc 1.jpg]]&nbsp;
  
  
Line 89: Line 119:
 
&nbsp;
 
&nbsp;
  
A tool tip with info can be shown by pressing SHIFT :
+
A tool tip with info can be shown by pressing SHIFT&nbsp;:
 +
 
 +
 
  
<br/><br/>
+
[[File:Avr desc 2.jpg]]
  
 
Here it is clear that BDIL is a byte variable, dimensioned in the module CAN-Elektor.bas
 
Here it is clear that BDIL is a byte variable, dimensioned in the module CAN-Elektor.bas
  
 
It will show info for constants, aliases, variables and functions.
 
It will show info for constants, aliases, variables and functions.

Revision as of 16:27, 4 February 2014

'BASCOM-AVR© is the original Windows BASIC COMPILER for the AVR familyIt is designed to run on XP/VISTA/WIN7 and WIN8'

This product description is updated in 2014. But we do not change it each time we update the software. In the online help you can find a list of all statements and functions.

Key Benefits

  • Structured BASIC with labels.
  • Structured programming with IF-THEN-ELSE-END IF, DO-LOOP, WHILE-WEND, SELECT- CASE.
  • Fast machine code instead of interpreted code.
  • Variables and labels can be as long as 32 characters.
  • Bit, Byte, Integer, Word, Long, Single, Double and String variables.
  • Large set of Trig Floating point functions.
  • Date & Time calculation functions.
  • Compiled programs work with all AVR microprocessors that have internal memory.
  • Statements are highly compatible with Microsoft’s VB/QB.
  • Special commands for LCD-displays , I2C chips and 1WIRE chips, PC keyboad, matrix keyboad, RC5 reception, software UART, SPI , graphical LCD, send IR RC5,RC6 or Sony code.
  • TCP/IP with W3100A/W5100/W5200/W5300 chips.
  • Built in AVR-DOS functions like MKDIR, CHDIR, DIR, OPEN, CLOSE, etc. Just as they work in  QB/VB !
  • Local variables, user functions, library support.
  • Integrated terminal emulator with download option..
  • Integrated simulator for testing.
  • Integrated ISP programmer (application note AVR910.ASM).
  • Integrated STK200 programmer and STK300 programmer. Also supported is the low cost Sample Electronics programmer. Can be built in 10 minutes! Many other programmers supported via the Universal Interface.
  • Many supported programmer like STK500, STK600, MKII, USBASP, JTAG , Arduino
  • Editor with statement highlighting.
  • Context sensitive help.
  • DEMO version compiles 4KB of binary code. Well suited for the ATmega48.
  • English an German Books available
  • AT mouse simulator, AT keyboard simulator, I2C Slave available as add on.
  • This product is developed in 1995 and is updated regularly.

 

The following statements are supported (actually there are many more look in the on line helpfile):

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


Input and output
PRINT, INPUT, INKEY, PRINT, 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, OPEN, CLOSE, DEBOUNCE, SHIFTIN, SHIFTOUT, GETATKBD, SPC, SERIN, SEROUT


Numeric functions
AND, OR, XOR, INC, DEC, MOD, NOT, ABS, BCD, LOG, EXP, SQR, SIN,COS,TAN,ATN, ATN2, ASIN, ACOS, FIX, ROUND, MOD, SGN, POWER, RAD2DEG, DEG2RAD, LOG10, TANH, SINH, COSH.


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


1WIRE
1WWRITE, 1WREAD, 1WRESET, 1WIRECOUNT, 1WSEARCHFIRST, 1WSEARCHNEXT.


SPI
SPIINIT, SPIIN, SPIOUT, SPIMOVE.


CAN
CONFIG CANBUSMODE, CONFIG CANMOB, CANBAUD, CANRESET, CANCLEARMOB, CANCLEARALLMOBS, CANSEND, CANRECEIVE , CANID,CANSELPAGE, CANGETINTS


TCP/IP
TCP/IP routines can be used with the W3100/IIM7000/IIM7010/W5100/W5200/W5300 modules.

BASE64DEC , BASE64ENC , IP2STR , UDPREAD , UDPWRITE , UDPWRITESTR , TCPWRITE , TCPWRITESTR , TCPREAD ,GETDSTIP , GETDSTPORT , SOCKETSTAT , SOCKETCONNECT ,SOCKETLISTEN ,  GETSOCKET , SOCKETCLOSE , SETTCP , GETTCPREGS , SETTCPREGS , SETIPPROTOCOL , TCPCHECKSUM ,  SOCKETDISCONNECT , SNTP , TCPREADHEADER ,UDPREADHEADER


Interrupt programming
ON INT0/INT1/TIMER0/TIMER1/SERIAL, RETURN, ENABLE, DISABLE, COUNTERx, CAPTUREx, INTERRUPTS, CONFIG, START, LOAD.


Bit manipulation
SET, RESET, ROTATE, SHIFT, BITWAIT, TOGGLE.


Variables
DIM, BIT , BYTE , INTEGER , WORD, LONG, SINGLE, DOUBLE, 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, FUNCTION, READMAGCARD, BIN2GREY, GREY2BIN, CRC8, CRC16, CRC32, CHECKSUM.


Compiler directives
$INCLUDE, $BAUD and $CRYSTAL, $SERIALINPUT, $SERIALOUTPUT, $RAMSIZE, $RAMSTART, $DEFAULT XRAM, $ASM-$END ASM, $LCD, $EXTERNAL, $LIB.


String manipulation
STRING, SPACE, LEFT, RIGHT, MID, VAL, HEXVAL, LEN, STR, HEX, LTRIM, RTRIM, TRIM, LCASE, UCASE, FORMAT, FUSING, INSTR, CHARPOS.


And many other functions, statements and directives


To make a program takes just a few steps :

  • Write the program in BASIC
  • Compile it to fast machine binary code
  • Test the result with the integrated simulator(with additional hardware you can simulate the hardware too).
  • Program the chip with one of the integrated programmers.
    (hardware must be purchased separately)


Avr desc 1.jpg 


This is a screen shot of the editor. You can work in normal mode or project mode.

At the left you find the Code Explorer. The Code explorer can show unused data in a different colour.

 

When the Code Explorer is visible, the editor supports Proper Indent and Indent drawing.

Indent lines can be a great visual help.

 

A tool tip with info can be shown by pressing SHIFT :


Avr desc 2.jpg

Here it is clear that BDIL is a byte variable, dimensioned in the module CAN-Elektor.bas

It will show info for constants, aliases, variables and functions.

Personal tools
Namespaces
Variants
Actions
Navigation
Language