
- •Table of Contents
- •Index
- •Keyword Reference
- •Installation
- •Installation of BASCOM
- •BASCOM IDE
- •Running BASCOM-AVR
- •File New
- •File Close
- •File Save
- •File Save As
- •File Print Preview
- •File Print
- •File Exit
- •View PinOut
- •View PDF viewer
- •View Error Panel
- •Edit Undo
- •Edit Redo
- •Edit Cut
- •Edit Copy
- •Edit Paste
- •Edit Find
- •Edit Find Next
- •Edit Replace
- •Edit Goto
- •Edit Toggle Bookmark
- •Edit Goto Bookmark
- •Edit Indent Block
- •Edit Unindent Block
- •Edit Remark Block
- •Program Compile
- •Program Syntax Check
- •Program Show Result
- •Program Simulate
- •Program Send to Chip
- •Tools Terminal Emulator
- •Tools LCD Designer
- •Tools LIB Manager
- •Tools Graphic Converter
- •Tools Stack Analyzer
- •Tools Plugin Manager
- •Tools Batch Compile
- •Options Compiler
- •Options Compiler Chip
- •Options Compiler Output
- •Options Compiler Communication
- •Options Compiler I2C, SPI, 1WIRE
- •Options Compiler LCD
- •Options Communication
- •Options Environment
- •Options Simulator
- •Options Programmer
- •Supported Programmers
- •ISP programmer
- •PG302 programmer
- •Sample Electronics cable programmer
- •KITSRUS Programmer
- •MCS Universal Interface Programmer
- •STK500 Programmer
- •Lawicel BootLoader
- •AVR ISP Programmer
- •USB-ISP Programmer
- •MCS Bootloader
- •Options Monitor
- •Options Printer
- •Window Cascade
- •Window Tile
- •Window Arrange Icons
- •Window Minimize All
- •Help About
- •Help Index
- •Help MCS Forum
- •Help MCS Shop
- •Help Support
- •Help Knowledge Base
- •Help Credits
- •BASCOM Editor Keys
- •Program Development Order
- •PlugIns
- •Font Editor
- •PinOut
- •BASCOM HARDWARE
- •Additional Hardware
- •AVR Internal Hardware
- •AVR Internal Registers
- •AVR Internal Hardware TIMER0
- •AVR Internal Hardware TIMER1
- •AVR Internal Hardware Watchdog timer
- •AVR Internal Hardware Port B
- •AVR Internal Hardware Port D
- •Adding XRAM
- •Attaching an LCD Display
- •Memory usage
- •Using the 1 WIRE protocol
- •Using the SPI protocol
- •Power Up
- •Chips
- •ATtiny22
- •ATtiny13
- •ATtiny15
- •ATtiny25
- •ATtiny45
- •ATtiny85
- •ATtiny26
- •ATtiny2313
- •ATMEGA8
- •ATMEGA16
- •ATMEGA32
- •ATMEGA48
- •ATMEGA88
- •ATMEGA168
- •ATMEGA64
- •ATMEGA103
- •ATMEGA128
- •ATMEGA161
- •ATMEGA162
- •ATMEGA163
- •ATMEGA165
- •ATMEGA169
- •ATMEGA323
- •ATMEGA603
- •ATMEGA8515
- •ATMEGA8535
- •BASCOM Language Fundamentals
- •Changes compared to BASCOM-8051
- •Language Fundamentals
- •Mixing ASM and BASIC
- •Assembler mnemonics
- •Reserved Words
- •Error Codes
- •Newbie problems
- •Tips and tricks
- •ASCII chart
- •BASCOM Language Reference
- •$BAUD
- •$BAUD1
- •$BOOT
- •$CRYSTAL
- •$DATA
- •$DEFAULT
- •$EEPLEAVE
- •$EEPROM
- •$EEPROMHEX
- •$EXTERNAL
- •$FRAMESIZE
- •$HWSTACK
- •$INCLUDE
- •$INITMICRO
- •$LCDPUTCTRL
- •$LCDPUTDATA
- •$LCDRS
- •$LCDVFO
- •$LOADER
- •$LOADERSIZE
- •$NOCOMP
- •$NOINIT
- •$NORAMCLEAR
- •$PROG
- •$PROGRAMMER
- •$REGFILE
- •$ROMSTART
- •$SERIALINPUT
- •$SERIALINPUT1
- •$SERIALINPUT2LCD
- •$SERIALOUTPUT
- •$SERIALOUTPUT1
- •$SWSTACK
- •$TIMEOUT
- •$TINY
- •$WAITSTATE
- •$XRAMSIZE
- •$XRAMSTART
- •1WIRECOUNT
- •1WRESET
- •1WREAD
- •1WSEARCHFIRST
- •1WSEARCHNEXT
- •1WVERIFY
- •1WWRITE
- •ACOS
- •ALIAS
- •ASIN
- •BASE64DEC
- •BASE64ENC
- •BAUD
- •BAUD1
- •BINVAL
- •BIN2GRAY
- •BITWAIT
- •BITS
- •BLOAD
- •BSAVE
- •BUFSPACE
- •BYVAL
- •CALL
- •CHECKSUM
- •CIRCLE
- •CLEAR
- •CLOCKDIVISION
- •CLOSE
- •CLOSESOCKET
- •CONFIG
- •CONFIG 1WIRE
- •CONFIG ACI
- •CONFIG ADC
- •CONFIG ATEMU
- •CONFIG BCCARD
- •CONFIG CLOCK
- •CONFIG CLOCKDIV
- •CONFIG COM1
- •CONFIG COM2
- •CONFIG COMx
- •CONFIG DATE
- •CONFIG DCF77
- •CONFIG DEBOUNCE
- •CONFIG I2CDELAY
- •CONFIG I2CSLAVE
- •CONFIG INPUT
- •CONFIG INTx
- •CONFIG GRAPHLCD
- •CONFIG KBD
- •CONFIG KEYBOARD
- •CONFIG LCD
- •CONFIG LCDBUS
- •CONFIG LCDMODE
- •CONFIG LCDPIN
- •CONFIG PORT
- •CONFIG PRINT
- •CONFIG PRINTBIN
- •CONFIG PS2EMU
- •CONFIG RC5
- •CONFIG SDA
- •CONFIG SCL
- •CONFIG SERIALIN
- •CONFIG SERIALIN1
- •CONFIG SERIALOUT
- •CONFIG SERIALOUT1
- •CONFIG SINGLE
- •CONFIG SPI
- •CONFIG SERVOS
- •CONFIG TCPIP
- •CONFIG TIMER0
- •CONFIG TIMER1
- •CONFIG TIMER2
- •CONFIG TWI
- •CONFIG TWISLAVE
- •CONFIG WAITSUART
- •CONFIG WATCHDOG
- •CONFIG X10
- •CONFIG XRAM
- •CONST
- •COSH
- •COUNTER0 and COUNTER1
- •CPEEK
- •CPEEKH
- •CRYSTAL
- •CURSOR
- •DATA
- •DAYOFWEEK
- •DAYOFYEAR
- •DATE$
- •DATE
- •DEBUG
- •DEBOUNCE
- •DECR
- •DECLARE FUNCTION
- •DECLARE SUB
- •DEFxxx
- •DEFLCDCHAR
- •DELAY
- •DISABLE
- •DISKFREE
- •DISKSIZE
- •DISPLAY
- •DO-LOOP
- •DriveCheck
- •DriveGetIdentity
- •DriveInit
- •DriveReset
- •DriveReadSector
- •DriveWriteSector
- •DTMFOUT
- •ECHO
- •ELSE
- •ENABLE
- •ENCODER
- •EXIT
- •FILEATTR
- •FILEDATE
- •FILEDATETIME
- •FILELEN
- •FILETIME
- •FLUSH
- •FORMAT
- •FOR-NEXT
- •FOURTHLINE
- •FRAC
- •FREEFILE
- •FUSING
- •GETADC
- •GETATKBD
- •GETATKBDRAW
- •GETDSTIP
- •GETDSTPORT
- •GETKBD
- •GETRC
- •GETRC5
- •GETTCPREGS
- •GETSOCKET
- •GLCDCMD
- •GLCDDATA
- •GOSUB
- •GOTO
- •GRAY2BIN
- •HEXVAL
- •HIGH
- •HIGHW
- •HOME
- •I2CINIT
- •I2CRECEIVE
- •I2CSEND
- •I2START,I2CSTOP, I2CRBYTE, I2CWBYTE
- •IDLE
- •IF-THEN-ELSE-END IF
- •INCR
- •INITFILESYSTEM
- •INITLCD
- •INKEY
- •INPUTBIN
- •INPUTHEX
- •INPUT
- •INSTR
- •ISCHARWAITING
- •KILL
- •LCASE
- •LCDAT
- •LCDCONTRAST
- •LEFT
- •LINE
- •LINE INPUT
- •LTRIM
- •LOAD
- •LOADADR
- •LOADLABEL
- •LOADWORDADR
- •LOCAL
- •LOCATE
- •LOOKDOWN
- •LOOKUP
- •LOOKUPSTR
- •LOWERLINE
- •MAKEBCD
- •MAKEINT
- •MAKEDEC
- •MAKETCP
- •MEMCOPY
- •NBITS
- •ON INTERRUPT
- •ON VALUE
- •OPEN
- •PEEK
- •POKE
- •POPALL
- •POWER
- •POWERDOWN
- •POWERSAVE
- •PRINTBIN
- •PSET
- •PS2MOUSEXY
- •PULSEIN
- •PULSEOUT
- •PUSHALL
- •RC5SEND
- •RC5SENDEXT
- •RC6SEND
- •READ
- •READEEPROM
- •READMAGCARD
- •RESET
- •RESTORE
- •RETURN
- •RIGHT
- •ROTATE
- •ROUND
- •RTRIM
- •SECELAPSED
- •SECOFDAY
- •SEEK
- •SELECT-CASE-END SELECT
- •SETFONT
- •SETTCP
- •SETTCPREGS
- •SENDSCAN
- •SENDSCANKBD
- •SERIN
- •SEROUT
- •SETIPPROTOCOL
- •SHIFT
- •SHIFTCURSOR
- •SHIFTIN
- •SHIFTOUT
- •SHIFTLCD
- •SHOWPIC
- •SHOWPICE
- •SINH
- •SOCKETCONNECT
- •SOCKETLISTEN
- •SOCKETSTAT
- •SONYSEND
- •SOUND
- •SPACE
- •SPIIN
- •SPIINIT
- •SPIMOVE
- •SPIOUT
- •SPLIT
- •START
- •STCHECK
- •STOP
- •STRING
- •SYSSEC
- •SYSSECELAPSED
- •SYSDAY
- •SWAP
- •TCPCHECKSUM
- •TCPREAD
- •TCPWRITE
- •TCPWRITESTR
- •TANH
- •THIRDLINE
- •TIME$
- •TIME
- •TOGGLE
- •TRIM
- •UCASE
- •UDPREAD
- •UDPWRITE
- •UDPWRITESTR
- •UPPERLINE
- •VARPTR
- •VERSION
- •WAIT
- •WAITKEY
- •WAITMS
- •WAITUS
- •WHILE-WEND
- •WRITE
- •WRITEEEPROM
- •X10DETECT
- •X10SEND
- •#IF ELSE ENDIF
- •International Resellers
- •International Resellers
- •ASM Libraries
- •EXTENDED I2C
- •MCSBYTE
- •MCSBYTEINT
- •TCPIP
- •LCD4BUSY
- •GLCD
- •GLCDSED
- •LCD-EPSON
- •AVR-DOS File System
- •CF Card
- •Compact FlashCard Driver
- •Elektor CF-Interface
- •XRAM CF-Interface for simulation
- •New CF-Card Drivers
- •Floating Point
- •FP_TRIG
- •DOUBLE
- •I2C SLAVE
- •I2CSLAVE
- •I2C TWI Slave
- •SPISLAVE
- •DATE TIME
- •EUROTIMEDATE
- •DATETIME
- •PS2-AT Mouse and Keyboard Emulation
- •AT_EMULATOR
- •PS2MOUSE_EMULATOR
- •BCCARD
- •BCCARD
- •BCDEF
- •BCCALL
- •BCRESET
- •Tools
- •LCD RGB-8 Converter

© MCS Electronics, 1995-2007
WDR |
|
Watchdog Reset |
|
None |
1 |
* ) Not available in base-line microcontrollers |
|
|
|
The Assembler is not case sensitive.
The operands have the following forms:
Rd: R0-R31 or R16-R31 (depending on instruction) Rr: R0-R31
b: Constant (0-7) s: Constant (0-7)
P: Constant (0-31/63)
K: Constant (0-255)
k: Constant, value range depending on instruction. q: Constant (0-63)
Rdl: R24, R26, R28, R30. For ADIW and SBIW instructions
Reserved Words
The following table shows the reserved BASCOM statements or characters.
^
!
;
$BAUD , $BAUD1 , $BOOT , $CRYSTAL ,$DATA ,$DBG ,$DEFAULT , $END , $EEPROM , $EXTERNAL , $INCLUDE , $LCD , $LCDRS , $LCDPUTCTRL , $LCDPUTDATA , $LCDVFO , $LIB ,$MAP ,$REGFILE ,$SERIALINPUT ,$SERIALINPUT1, $SERIALINPUT2LCD , $SERIALOUTPUT , $SERIALOUTPUT1 ,
$TINY ,$WAITSTATE ,$XRAMSIZE , $XRAMSTART
1WRESET ,1WREAD ,1WWRITE
ACK ,ABS ,ALIAS ,AND ,ACOS ,AS , ASC , ASIN, AT , ATN, ATN2
BAUD, BCD , BIN , BIN2GRAY , BINVAL , BIT , BITWAIT , BLINK , BOOLEAN , BYTE , BYVAL
CALL , CAPTURE1 , CASE , CHECKSUM , CHR , CIRCLE , CLS , CLOSE , COMPARE1x , CONFIG
, CONST , COS , COSH , COUNTER , COUNTERx ,
CPEEK , CPEEKH , CRC8 , CRC16 , CRC32 , CRYSTAL , CURSOR
DATA, DATE$, DBG , DEBOUNCE , DECR , DECLARE , DEFBIT , DEFBYTE , DEFLNG , DEFWORD , DEG2RAD , DEGSNG , DEFLCDCHAR, DEFINT ,
DEFWORD , DELAY , DIM , DISABLE , DISKSIZE , DISKFREESIZE , DISPLAY , DO , DOUBLE, DOWNTO , DTMFOUT
ELSE, ELSEIF, ENABLE, END, EOF, ERAM, ERASE, ERR, EXIT, EXP, EXTERNAL, FIX, FLUSH, FOR, FOURTH, FOURTHLINE, FREEFILE, FUNCTION
GATE, GET, GETADC, GETKBD, GETATKBD , GETRC5, GLCDDATA , GLCDCMD, GOSUB, GOTO, GRAY2BIN
HEXVAL,HIGH, HOME
page -192-

© MCS Electronics, 1995-2007
I2CINIT, I2CRECEIVE, I2CSEND, I2CSTART, I2CSTOP, I2CRBYTE, I2CWBYTE, IDLE, IF , INCR , INKEY , INP , INPUT , INPUTBIN , INPUTHEX ,
INT, INT0, INT1, INTEGER, INTERNAL, INSTR, IS, ISCHARWAITING
LCASE, LCD, LCDAT, LEFT, LEFT, LEN, LINE, LOAD, LOADLABEL, LOC , LOF , LOCAL, LOCATE, LOG , LOG10 , LONG, LOOKUP, LOOKUPSTR,
LOOP, LTRIM, LOOKDOWN, LOW, LOWER, LOWERLINE
MAKEBCD, MAKEDEC, MAKEINT, MID, MIN, MAX, MOD, MODE
NACK, NEXT, NOBLINK, NOSAVE, NOT
OFF, ON, OR, OUT, OUTPUT
PEEK, POKE, PORTx, POWER, POWERDOWN, PRINT, PRINTBIN, PULSEOUT, PUT, PWM1x, RAD2DEG, RC5SEND, RC6SEND, READ, READEEPROM
REM, RESET, RESTORE, RETURN, RIGHT, RIGHT, ROTATE, ROUND, RTRIM
SEEK, SELECT, SERIAL, SET, SERIN , SEROUT, SETFONT, SGN, SHIFT, SHIFTLCD, SHIFTCURSOR,SHIFTIN , SHIFTOUT , SHOWPIC, SHOWPICE,
SIN, SINH , SONYSEND , SOUND , SPACE, SPC , SPIINIT , SPIIN, SPIMOVE , SPIOUT , START , STEP , STR , STRING , STOP , SUB , SWAP , SQR
TAN , TANH , THEN , TIME$ , THIRD , THIRDLINE , TIMERx , TO , TRIM
UCASE, UNTIL , UPPER , UPPERLINE
VAL, VARPTR
WAIT, WAITKEY, WAITMS , WAITUS , WATCHDOG , WRITEEEPROM , WEND , WHILE ,WORD
XOR, XRAM
Error Codes
The following table lists errors that can occur.
Error Description
1Unknown statement
2Unknown structure EXIT statement
3WHILE expected
4No more space for IRAM BIT
5No more space for BIT
6. expected in filename
7IF THEN expected
8BASIC source file not found
9Maximum 128 aliases allowed
10Unknown LCD type
11INPUT, OUTPUT, 0 or 1 expected
12Unknown CONFIG parameter
13CONST already specified
14Only IRAM bytes supported
15Wrong data type
page -193-

© MCS Electronics, 1995-2007
16Unknown Definition
179 parameters expected
18BIT only allowed with IRAM or SRAM
19STRING length expected (DIM S AS STRING * 12 ,for example)
20Unknown DATA TYPE
21Out of IRAM space
22Out of SRAM space
23Out of XRAM space
24Out of EPROM space
25Variable already dimensioned
26AS expected
27parameter expected
28IF THEN expected
29SELECT CASE expected
30BIT's are GLOBAL and can not be erased
31Invalid data type
32Variable not dimensioned
33GLOBAL variable can not be ERASED
34Invalid number of parameters
353 parameters expected
36THEN expected
37Invalid comparison operator
38Operation not possible on BITS
39FOR expected
40Variable can not be used with RESET
41Variable can not be used with SET
42Numeric parameter expected
43File not found
442 variables expected
45DO expected
46Assignment error
47UNTIL expected
50Value doesn't fit into INTEGER
51Value doesn't fit into WORD
52Value doesn't fit into LONG
60Duplicate label
61Label not found
62SUB or FUNCTION expected first
63Integer or Long expected for ABS()
64, expected
65device was not OPEN
66device already OPENED
68 channel expected
70BAUD rate not possible
71Different parameter type passed then declared
72Getclass error. This is an internal error.
73Printing this FUNCTION not yet supported
743 parameters expected
80 Code does not fit into target chip
page -194-

© MCS Electronics, 1995-2007
81Use HEX(var) instead of PRINTHEX
82Use HEX(var) instead of LCDHEX
85Unknown interrupt source
86Invalid parameter for TIMER configuration
87ALIAS already used
880 or 1 expected
89Out of range : must be 1-4
90Address out of bounds
91INPUT, OUTPUT, BINARY, or RANDOM expected
92LEFT or RIGHT expected
93Variable not dimensioned
94Too many bits specified
95Falling or rising expected for edge
96Prescale value must be 1,8,64,256 or 1024
97SUB or FUNCTION must be DECLARED first
98SET or RESET expected
99TYPE expected
100No array support for IRAM variables
101Can't find HW-register
102Error in internal routine
103= expected
104LoadReg error
105StoreBit error
106Unknown register
107LoadnumValue error
108Unknown directive in device file
109= expected in include file for .EQU
110Include file not found
111SUB or FUNCTION not DECLARED
112SUB/FUNCTION name expected
113SUB/FUNCTION already DECLARED
114LOCAL only allowed in SUB or FUNCTION
115#channel expected
116Invalid register file
117Unknown interrupt
200.DEF not found
201Low Pointer register expected
202.EQU not found, probably using functions that are not supported by the selected chip
203Error in LD or LDD statement
204Error in ST or STD statement
205} expected
206Library file not found
207Library file already registered
210Bit definition not found
211External routine not found
212LOW LEVEL, RISING or FALLING expected
213String expected for assignment
214Size of XRAM string 0
page -195-
|
© MCS Electronics, 1995-2007 |
|
|
|
|
215 |
Unknown ASM mnemonic |
|
216 |
CONST not defined |
|
217 |
No arrays allowed with BIT/BOOLEAN data type |
|
218 |
Register must be in range from R16-R31 |
|
219 |
INT0-INT3 are always low level triggered in the MEGA |
|
220 |
Forward jump out of range |
|
221 |
Backward jump out of range |
|
222 |
Illegal character |
|
223 |
* expected |
|
224 |
Index out of range |
|
225 |
() may not be used with constants |
|
226 |
Numeric of string constant expected |
|
227 |
SRAM start greater than SRAM end |
|
228 |
DATA line must be placed after the END statement |
|
229 |
End Sub or End Function expected |
|
230 |
You can not write to a PIN register |
|
231 |
TO expected |
|
232 |
Not supported for the selected micro |
|
233 |
READ only works for normal DATA lines, not for EPROM data |
|
234 |
') block comment expected first |
|
235 |
'( block comment expected first |
|
236 |
Value does not fit into byte |
|
238 |
Variable is not dimensioned as an array |
|
239 |
Invalid code sequence because of AVR hardware bug |
|
240 |
END FUNCTION expected |
|
241 |
END SUB expected |
|
242 |
Source variable does not match the target variable |
|
243 |
Bit index out of range for supplied data type |
|
244 |
Do not use the Y pointer |
|
245 |
No arrays supported with IRAM variable |
|
246 |
No more room for .DEF definitions |
|
247 |
. expected |
|
248 |
BYVAL should be used in declaration |
|
249 |
ISR already defined |
|
250 |
GOSUB expected |
|
251 |
Label must be named SECTIC |
|
252 |
Integer or Word expected |
|
253 |
ERAM variable can not be used |
|
254 |
Variable expected |
|
255 |
Z or Z+ expected |
|
256 |
Single expected |
|
257 |
"" expected |
|
258 |
SRAM string expected |
|
259 |
- not allowed for a byte |
|
260 |
Value larger than string length |
|
261 |
Array expected |
|
262 |
ON or OFF expected |
|
263 |
Array index out of range |
|
264 |
Use ECHO OFF and ECHO ON instead |
|
|
|
|
page -196-