1189
© MCS Electronics , 1995-2012

BASCAVR

Embed Size (px)

Citation preview

MCS Electronics , 1995-2012

BASCOM-AVR user manualIntroductionby MCS Electronics

Dear reader. Thank you for your interest in BASCOM. BASCOM was "invented" in 1995. It was intended for personal usage only. I decided to make it public as I found no other tool that was so simple to use. Since that time, a lot of options and extensions were added. Without the help and patience of the many users, BASCOM would not be what it is today : "the best and most affordable tool for fast proto typing". We hope that BASCOM will contribute in making your work with microprocessors Easy and enjoyable. Please notice that the samples in the manual are intended as simple samples. You should have a look at the sample code provided in the SAMPLES directory. The MCS Electronics Team

BASCOM-AVR 2012 MCS ElectronicsAll rights reserved. No parts of this work may be reproduced in any form or by any means - graphic, electronic, or mechanical, including photocopying, recording, taping, or information storage and retrieval systems - without the written permission of the publisher. Products that are referred to in this document may be either trademarks and/or registered trademarks of the respective owners. The publisher and the author make no claim to these trademarks. While every precaution has been taken in the preparation of this document, the publisher and the author assume no responsibility for errors or omissions, or for damages resulting from the use of information contained in this document or from the use of programs and source code that may accompany it. In no event shall the publisher and the author be liable for any loss of profit or any other commercial damage caused or alleged to have been caused directly or indirectly by this document. Printed: 12-11-2012

Publisher MCS Electronics Managing Editor M.C.Alberts Technical Editors M.C.Alberts

Special thanks to: All the people who contributed to this document, all the forum members that contributed in a positive way, all beta testers , and all customers. While there is not enough space to mention all contributors, there are a few that I feel must be mentioned : Josef Franz Vgel. He wrote the Trig libraries, the AVR-DOS file system and the DOUBLE library. Luciano, Ian, Adrian and Kimmi, they are very active on the user forum. They take the time to give other forum members free help and advise. They do this for free just to help other BASCOM users. MWS for his help and (ASM) debugging. MAK for pushing XMEGA, his samples and testing, and of course for his work on the Help.

Cover Designer B.F.de Graaff

4

BASCOM-AVR

Table of ContentsForeword 0

Part I Index

23

1 Keyword................................................................................................................................... 24 Reference 2 About MCS Electronics ................................................................................................................................... 27Custom Designs ......................................................................................................................................................... Application Notes ......................................................................................................................................................... 29 30

Part II Installation

32

1 Installation of BASCOM ................................................................................................................................... 32 2 Updates ................................................................................................................................... 37 3 Move to new PC ................................................................................................................................... 46 4 Installation on multiple computers ................................................................................................................................... 46

Part III BASCOM IDE

49

1 Running ................................................................................................................................... 49 BASCOM-AVR 2 File New ................................................................................................................................... 52 3 File Open ................................................................................................................................... 52 4 File Close ................................................................................................................................... 52 5 File Save................................................................................................................................... 52 6 File Save................................................................................................................................... 53 As 7 File Print................................................................................................................................... 53 Preview 8 File Print................................................................................................................................... 53 9 File Project ................................................................................................................................... 53 10 File Exit ................................................................................................................................... 56 11 Edit Undo ................................................................................................................................... 56 12 Edit Redo ................................................................................................................................... 56 13 Edit Cut ................................................................................................................................... 56 14 Edit Copy ................................................................................................................................... 56 15 Edit Paste ................................................................................................................................... 56 16 Edit Find................................................................................................................................... 56 17 Edit Find................................................................................................................................... 59 Next 18 Edit Replace ................................................................................................................................... 60 19 Edit Goto ................................................................................................................................... 60 20 Edit Toggle Bookmark ................................................................................................................................... 60 21 Edit Goto Bookmark ................................................................................................................................... 60 22 Edit Indent Block ................................................................................................................................... 60 23 Edit Unindent Block ................................................................................................................................... 60 24 Edit Remark Block ................................................................................................................................... 60 25 Edit Encrypt Selected Code ................................................................................................................................... 60 26 View PinOut ................................................................................................................................... 62

2012 MCS Electronics

Contents

5

27 View PDF viewer ................................................................................................................................... 66 28 View Error Panel ................................................................................................................................... 68 29 View Tip ................................................................................................................................... 68 30 View Project Files ................................................................................................................................... 69 31 View Code Explorer ................................................................................................................................... 69 32 Program ................................................................................................................................... 71 Compile 33 Program ................................................................................................................................... 72 Syntax Check 34 Program ................................................................................................................................... 73 Show Result 35 Program ................................................................................................................................... 74 Simulate 36 Program ................................................................................................................................... 85 Send to Chip 37 Tools Terminal Emulator ................................................................................................................................... 88 38 Tools LCD Designer ................................................................................................................................... 89 39 Tools LIB Manager ................................................................................................................................... 91 40 Tools Graphic Converter ................................................................................................................................... 92 41 Tools Stack Analyzer ................................................................................................................................... 93 42 Tools Plugin Manager ................................................................................................................................... 93 43 Tools Batch Compile ................................................................................................................................... 94 44 Tools PDF Update ................................................................................................................................... 97 45 Tools Resource Editor ................................................................................................................................... 98 46 Options Compiler ................................................................................................................................... 99Options ......................................................................................................................................................... Compiler Chip Options ......................................................................................................................................................... Compiler Output Options ......................................................................................................................................................... Compiler Communication Options ......................................................................................................................................................... Compiler I2C, SPI, 1WIRE Options ......................................................................................................................................................... Compiler LCD 100 101 102 103 104

47 Options................................................................................................................................... 105 Communication 48 Options................................................................................................................................... 106 Environment 49 Options................................................................................................................................... 111 Simulator 50 Options................................................................................................................................... 112 ProgrammerSupported 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 .................................................................................................................................................. PROGGY .................................................................................................................................................. FLIP .................................................................................................................................................. USBprog Programmer / AVR ISP mkII .................................................................................................................................................. KamProg for AVR .................................................................................................................................................. USBASP .................................................................................................................................................. STK600.................................................................................................................................................. ARDUINO .................................................................................................................................................. BIPOM MINI-MAX/C .................................................................................................................................................. LIBUSB ......................................................................................................................................................... 113 114 115 116 117 118 120 124 124 125 134 136 137 140 140 141 142 145 147 148

2012 MCS Electronics

6

BASCOM-AVR 51 Options................................................................................................................................... 156 Monitor 52 Options................................................................................................................................... 156 Printer 53 Window................................................................................................................................... 157 Cascade 54 Window................................................................................................................................... 157 Tile 55 Window................................................................................................................................... 157 Arrange Icons 56 Windows Maximize All ................................................................................................................................... 157 57 Window................................................................................................................................... 157 Minimize All 58 Help About ................................................................................................................................... 158 59 Help Index ................................................................................................................................... 159 60 Help MCS Forum ................................................................................................................................... 159 61 Help MCS Shop ................................................................................................................................... 160 62 Help Support ................................................................................................................................... 161 63 Help Knowledge Base ................................................................................................................................... 161 64 Help Credits ................................................................................................................................... 162 65 Help Update ................................................................................................................................... 163 66 BASCOM Editor Keys ................................................................................................................................... 163 67 Program Development Order ................................................................................................................................... 164 68 PlugIns ................................................................................................................................... 165Font Editor ......................................................................................................................................................... 165

Part IV BASCOM HARDWARE

168

1 Additional Hardware ................................................................................................................................... 168 2 AVR Internal Hardware ................................................................................................................................... 168 3 AVR Internal Registers ................................................................................................................................... 169 4 AVR Internal Hardware TIMER0 ................................................................................................................................... 171 5 AVR Internal Hardware TIMER1 ................................................................................................................................... 172 6 AVR Internal Hardware Watchdog timer ................................................................................................................................... 174 7 AVR Internal Hardware Port B ................................................................................................................................... 174 8 AVR Internal Hardware Port D ................................................................................................................................... 176 9 Adding ................................................................................................................................... 177 XRAM with External Memory Interface 10 Adding ................................................................................................................................... 181 XRAM to XMEGA using EBI 11 Attaching an LCD Display ................................................................................................................................... 182 12 Memory................................................................................................................................... 183 usage 13 Using the UART ................................................................................................................................... 195 14 USING RS485 ................................................................................................................................... 201 15 Using the I2C protocol ................................................................................................................................... 203 16 Using the 1 WIRE protocol ................................................................................................................................... 209 17 Using the SPI protocol ................................................................................................................................... 212 18 Using USI (Universal Serial Interface) ................................................................................................................................... 220 19 Power Up ................................................................................................................................... 224 20 Chips ................................................................................................................................... 224AT86RF401 ......................................................................................................................................................... AT90CAN32 ......................................................................................................................................................... 224 225

2012 MCS Electronics

Contents

7225 226 227 227 228 228 230 230 232 233 233 234 235 236 237 238 239 239 240 240 240 240 241 241 242 242 243 243 243 244 245 245 245 246 246 247 247 247 248 249 249 250 250 250 252 253 253 255 256 257 258 258 260 261 261 262 263 263

AT90CAN128 ......................................................................................................................................................... AT90S1200 ......................................................................................................................................................... AT90S2313 ......................................................................................................................................................... AT90S2323 ......................................................................................................................................................... AT90S2333 ......................................................................................................................................................... AT90S2343 ......................................................................................................................................................... AT90S4414 ......................................................................................................................................................... AT90S4433 ......................................................................................................................................................... AT90S4434 ......................................................................................................................................................... AT90S8515 ......................................................................................................................................................... AT90S8535 ......................................................................................................................................................... AT90PWM2-3 ......................................................................................................................................................... AT90PWM216 ......................................................................................................................................................... AT90US82 ......................................................................................................................................................... AT90USB162 ......................................................................................................................................................... AT90USB646 ......................................................................................................................................................... AT90USB1287 ......................................................................................................................................................... ATTINY12 ......................................................................................................................................................... ATTINY13 ......................................................................................................................................................... ATTINY13A ......................................................................................................................................................... ATTINY15 ......................................................................................................................................................... ATTINY20 ......................................................................................................................................................... ATTINY22 ......................................................................................................................................................... ATTINY24 ......................................................................................................................................................... ATTINY25 ......................................................................................................................................................... ATTINY26 ......................................................................................................................................................... ATTINY44 ......................................................................................................................................................... ATTINY45 ......................................................................................................................................................... ATTINY48 ......................................................................................................................................................... ATTINY84 ......................................................................................................................................................... ATTINY85 ......................................................................................................................................................... ATTINY88 ......................................................................................................................................................... ATTINY167 ......................................................................................................................................................... ATTINY261 ......................................................................................................................................................... ATTINY461 ......................................................................................................................................................... ATTINY861 ......................................................................................................................................................... ATTINY1634 ......................................................................................................................................................... ATTINY2313 ......................................................................................................................................................... ATTINY2313A ......................................................................................................................................................... ATTINY4313 ......................................................................................................................................................... ATTINY4313A ......................................................................................................................................................... ATMEGA8, ......................................................................................................................................................... ATMEGA8A ......................................................................................................................................................... ATMEGA8U2 ......................................................................................................................................................... ATMEGA16 ......................................................................................................................................................... ATMEGA16A ......................................................................................................................................................... ATMEGA16U2 ......................................................................................................................................................... ATMEGA16U4 ......................................................................................................................................................... ATMEGA16M1 ......................................................................................................................................................... ATMEGA32 ......................................................................................................................................................... ATMEGA32M1 ......................................................................................................................................................... ATMEGA32U2 ......................................................................................................................................................... ATMEGA32U4 ......................................................................................................................................................... ATMEGA48 ......................................................................................................................................................... ATMEGA48P ......................................................................................................................................................... ATMEGA64 ......................................................................................................................................................... ATMEGA64M1 ......................................................................................................................................................... ATMEGA88 .........................................................................................................................................................

2012 MCS Electronics

8

BASCOM-AVRATMEGA88A ......................................................................................................................................................... ATMEGA88P ......................................................................................................................................................... ATMEGA103 ......................................................................................................................................................... ATMEGA128 ......................................................................................................................................................... ATMEGA128RFA1 ......................................................................................................................................................... ATMEGA161 ......................................................................................................................................................... ATMEGA162 ......................................................................................................................................................... ATMEGA163 ......................................................................................................................................................... ATMEGA164P ......................................................................................................................................................... ATMEGA165 ......................................................................................................................................................... ATMEGA168 ......................................................................................................................................................... ATMEGA168P ......................................................................................................................................................... ATMEGA169 ......................................................................................................................................................... ATMEGA323 ......................................................................................................................................................... ATMEGA324P ......................................................................................................................................................... ATMEGA324PA ......................................................................................................................................................... ATMEGA325 ......................................................................................................................................................... ATMEGA328 ......................................................................................................................................................... ATMEGA328P ......................................................................................................................................................... ATMEGA329 ......................................................................................................................................................... ATMEGA406 ......................................................................................................................................................... ATMEGA603 ......................................................................................................................................................... ATMEGA640 ......................................................................................................................................................... ATMEGA644 ......................................................................................................................................................... ATMEGA644P ......................................................................................................................................................... ATMEGA644PA ......................................................................................................................................................... ATMEGA645 ......................................................................................................................................................... ATMEGA649 ......................................................................................................................................................... ATMEGA1280 ......................................................................................................................................................... ATMEGA1281 ......................................................................................................................................................... ATMEGA1284 ......................................................................................................................................................... ATMEGA1284P ......................................................................................................................................................... ATMEGA2560 ......................................................................................................................................................... ATMEGA2561 ......................................................................................................................................................... ATMEGA3250P ......................................................................................................................................................... ATMEGA8515 ......................................................................................................................................................... ATMEGA8535 ......................................................................................................................................................... ATXMEGA ......................................................................................................................................................... ATXMEGA16A4 ......................................................................................................................................................... ATXMEGA16D4 ......................................................................................................................................................... ATXMEGA32A4 ......................................................................................................................................................... ATXMEGA32A4U ......................................................................................................................................................... ATXMEGA32D4 ......................................................................................................................................................... ATXMEGA64A1 ......................................................................................................................................................... ATXMEGA64A3 ......................................................................................................................................................... ATXMEGA64D3 ......................................................................................................................................................... ATXMEGA64D4 ......................................................................................................................................................... ATXMEGA128A1 ......................................................................................................................................................... ATXMEGA128A3 ......................................................................................................................................................... ATXMEGA128A4U ......................................................................................................................................................... ATXMEGA128B1 ......................................................................................................................................................... ATXMEGA128D3 ......................................................................................................................................................... ATXMEGA128D4 ......................................................................................................................................................... ATXMEGA192A3 ......................................................................................................................................................... ATXMEGA192D3 ......................................................................................................................................................... ATXMEGA256A3 ......................................................................................................................................................... ATXMEGA256A3B ......................................................................................................................................................... ATXMEGA256A3BU ......................................................................................................................................................... 264 265 265 267 268 269 269 270 271 272 273 273 274 274 275 276 277 278 278 279 279 280 282 283 283 284 285 286 287 288 289 289 291 292 293 294 294 295 300 300 301 301 301 302 304 304 305 306 308 309 309 309 310 311 312 313 314 316

2012 MCS Electronics

Contents

9316

ATXMEGA256D3 .........................................................................................................................................................

21 Reference Designs ................................................................................................................................... 317EM4095 ......................................................................................................................................................... RFID Reader 317

Part V BASCOM Language Fundamentals

328

1 Changes compared to BASCOM-8051 ................................................................................................................................... 328 2 Language Fundamentals ................................................................................................................................... 329 3 Mixing ASM and BASIC ................................................................................................................................... 341 4 Assembler mnemonics ................................................................................................................................... 346 5 Reserved Words ................................................................................................................................... 351 6 Error Codes ................................................................................................................................... 351 7 Newbie ................................................................................................................................... 356 problems 8 Tips and tricks ................................................................................................................................... 357 9 ASCII chart ................................................................................................................................... 358

Part VI BASCOM Language Reference

362

1 #AUTOCODE ................................................................................................................................... 362 2 #IF ELSE ELSEIF ENDIF ................................................................................................................................... 362 3 $AESKEY ................................................................................................................................... 364 4 $ASM ................................................................................................................................... 364 5 $BAUD ................................................................................................................................... 365 6 $BAUD1 ................................................................................................................................... 366 7 $BGF ................................................................................................................................... 367 8 $BIGSTRINGS ................................................................................................................................... 369 9 $BOOT ................................................................................................................................... 369 10 $CRYPT ................................................................................................................................... 370 11 $CRYSTAL ................................................................................................................................... 371 12 $DATA ................................................................................................................................... 371 13 $DBG ................................................................................................................................... 373 14 $DEFAULT ................................................................................................................................... 375 15 $EEPLEAVE ................................................................................................................................... 376 16 $EEPROM ................................................................................................................................... 376 17 $EEPROMHEX ................................................................................................................................... 377 18 $EEPROMSIZE ................................................................................................................................... 378 19 $EXTERNAL ................................................................................................................................... 379 20 $FILE ................................................................................................................................... 380 21 $FRAMEPROTECT ................................................................................................................................... 380 22 $FRAMESIZE ................................................................................................................................... 383 23 $HWSTACK ................................................................................................................................... 391 24 $HWCHECK, $SWCHECK, $SOFTCHECK ................................................................................................................................... 394 25 $INC ................................................................................................................................... 396 26 $INCLUDE ................................................................................................................................... 397 27 $INITMICRO ................................................................................................................................... 398

2012 MCS Electronics

10

BASCOM-AVR 28 $LCD ................................................................................................................................... 399

29 $LCDPUTCTRL ................................................................................................................................... 402 30 $LCDPUTDATA ................................................................................................................................... 403 31 $LCDRS ................................................................................................................................... 404 32 $LCDVFO ................................................................................................................................... 407 33 $LIB ................................................................................................................................... 407 34 $LOADER ................................................................................................................................... 410 35 $LOADERSIZE ................................................................................................................................... 421 36 $MAP ................................................................................................................................... 422 37 $NOCOMPILE ................................................................................................................................... 423 38 $NOFRAMEPROTECT ................................................................................................................................... 423 39 $NOINIT ................................................................................................................................... 424 40 $NORAMCLEAR ................................................................................................................................... 424 41 $NORAMPZ ................................................................................................................................... 425 42 $NOTRANSFORM ................................................................................................................................... 425 43 $PROJECTTIME ................................................................................................................................... 426 44 $PROG ................................................................................................................................... 427 45 $PROGRAMMER ................................................................................................................................... 428 46 $REGFILE ................................................................................................................................... 429 47 $RESOURCE ................................................................................................................................... 430 48 $ROMSTART ................................................................................................................................... 433 49 $SERIALINPUT ................................................................................................................................... 433 50 $SERIALINPUT1 ................................................................................................................................... 435 51 $SERIALINPUT2LCD ................................................................................................................................... 436 52 $SERIALOUTPUT ................................................................................................................................... 436 53 $SERIALOUTPUT1 ................................................................................................................................... 437 54 $SIM ................................................................................................................................... 438 55 $STACKDUMP ................................................................................................................................... 439 56 $SWSTACK ................................................................................................................................... 440 57 $TIMEOUT ................................................................................................................................... 443 58 $TINY ................................................................................................................................... 445 59 $VERSION ................................................................................................................................... 446 60 $WAITSTATE ................................................................................................................................... 446 61 $XA ................................................................................................................................... 447 62 $XRAMSIZE ................................................................................................................................... 447 63 $XRAMSTART ................................................................................................................................... 448 64 $XTEAKEY ................................................................................................................................... 449 65 1WIRECOUNT ................................................................................................................................... 450 66 1WRESET ................................................................................................................................... 452 67 1WREAD ................................................................................................................................... 455 68 1WSEARCHFIRST ................................................................................................................................... 457 69 1WSEARCHNEXT ................................................................................................................................... 459

2012 MCS Electronics

Contents

11

70 1WVERIFY ................................................................................................................................... 462 71 1WWRITE ................................................................................................................................... 464 72 ABS ................................................................................................................................... 466 73 ACOS ................................................................................................................................... 467 74 ADR , ADR2 ................................................................................................................................... 468 75 AESDECRYPT ................................................................................................................................... 472 76 AESENCRYPT ................................................................................................................................... 474 77 ALIAS ................................................................................................................................... 476 78 ASC 79 ASIN 80 ATN 81 ATN2 ................................................................................................................................... 477 ................................................................................................................................... 480 ................................................................................................................................... 481 ................................................................................................................................... 482

82 BASE64DEC ................................................................................................................................... 483 83 BASE64ENC ................................................................................................................................... 484 84 BAUD ................................................................................................................................... 485 85 BAUD1 ................................................................................................................................... 486 86 BCD 87 BIN ................................................................................................................................... 487 ................................................................................................................................... 489

88 BINVAL................................................................................................................................... 490 89 BIN2GRAY ................................................................................................................................... 491 90 BITWAIT ................................................................................................................................... 492 91 BITS 93 BOX ................................................................................................................................... 493 ................................................................................................................................... 495 92 BLOAD ................................................................................................................................... 494 94 BOXFILL ................................................................................................................................... 497 95 BSAVE ................................................................................................................................... 498 96 BUFSPACE ................................................................................................................................... 499 97 BYVAL ................................................................................................................................... 499 98 CALL ................................................................................................................................... 500 99 CANBAUD ................................................................................................................................... 502 100 CANGETINTS ................................................................................................................................... 502 101 CANID ................................................................................................................................... 503 102 CANCLEARALLMOBS ................................................................................................................................... 504 103 CANCLEARMOB ................................................................................................................................... 504 104 CANRECEIVE ................................................................................................................................... 505 105 CANRESET ................................................................................................................................... 505 106 CANSELPAGE ................................................................................................................................... 506 107 CANSEND ................................................................................................................................... 506 108 CHARPOS ................................................................................................................................... 507 109 CHDIR ................................................................................................................................... 508 110 CHECKFLOAT ................................................................................................................................... 509 111 CHECKSUM CHECKSUMXOR ................................................................................................................................... 511

2012 MCS Electronics

12

BASCOM-AVR 112 CHR ................................................................................................................................... 512

113 CIRCLE................................................................................................................................... 513 114 CLEAR ................................................................................................................................... 516 115 CLS ................................................................................................................................... 517 116 CLOCKDIVISION ................................................................................................................................... 520 117 CLOSE ................................................................................................................................... 521 118 CONFIG ................................................................................................................................... 524 119 CONFIG 1WIRE ................................................................................................................................... 526 120 CONFIG ACI ................................................................................................................................... 530 121 CONFIG ACXX ................................................................................................................................... 530 122 CONFIG ADC ................................................................................................................................... 532 123 CONFIG ADCx ................................................................................................................................... 534 124 CONFIG ATEMU ................................................................................................................................... 547 125 CONFIG BASE ................................................................................................................................... 549 126 CONFIG BCCARD ................................................................................................................................... 550 127 CONFIG CANBUS ................................................................................................................................... 553 128 CONFIG CANMOB ................................................................................................................................... 556 129 CONFIG CLOCK ................................................................................................................................... 558 130 CONFIG CLOCKDIV ................................................................................................................................... 563 131 CONFIG COM1 ................................................................................................................................... 563 132 CONFIG COM2 ................................................................................................................................... 565 133 CONFIG COMx ................................................................................................................................... 567 134 CONFIG DACx ................................................................................................................................... 569 135 CONFIG DATE ................................................................................................................................... 574 136 CONFIG DCF77 ................................................................................................................................... 576 137 CONFIG DEBOUNCE ................................................................................................................................... 583 138 CONFIG DMA ................................................................................................................................... 584 139 CONFIG DMACHx ................................................................................................................................... 585 140 CONFIG DMXSLAVE ................................................................................................................................... 591 141 CONFIG DP ................................................................................................................................... 593 142 CONFIG EEPROM ................................................................................................................................... 594 143 CONFIG ERROR ................................................................................................................................... 595 144 CONFIG EVENT_SYSTEM ................................................................................................................................... 595 145 CONFIG EXTENDED_PORT ................................................................................................................................... 598 146 CONFIG GRAPHLCD ................................................................................................................................... 599 147 CONFIG HITAG ................................................................................................................................... 604 148 CONFIG I2CDELAY ................................................................................................................................... 607 149 CONFIG I2CSLAVE ................................................................................................................................... 610 150 CONFIG INPUT ................................................................................................................................... 615 151 CONFIG INTx ................................................................................................................................... 616 152 CONFIG KBD ................................................................................................................................... 618 153 CONFIG KEYBOARD ................................................................................................................................... 619

2012 MCS Electronics

Contents

13

154 CONFIG LCD ................................................................................................................................... 623 155 CONFIG LCDBUS ................................................................................................................................... 626 156 CONFIG LCDMODE ................................................................................................................................... 629 157 CONFIG LCDPIN ................................................................................................................................... 630 158 CONFIG OSC ................................................................................................................................... 633 159 CONFIG PORT ................................................................................................................................... 634 160 CONFIG POWERMODE ................................................................................................................................... 636 161 CONFIG POWER_REDUCTION ................................................................................................................................... 638 162 CONFIG PRIORITY ................................................................................................................................... 641 163 CONFIG PRINT ................................................................................................................................... 642 164 CONFIG PRINTBIN ................................................................................................................................... 643 165 CONFIG PS2EMU ................................................................................................................................... 644 166 CONFIG RC5 ................................................................................................................................... 646 167 CONFIG SDA ................................................................................................................................... 648 168 CONFIG SCL ................................................................................................................................... 649 169 CONFIG SERIALIN ................................................................................................................................... 649 170 CONFIG SERIALOUT ................................................................................................................................... 655 171 CONFIG SINGLE ................................................................................................................................... 657 172 CONFIG SHIFTIN ................................................................................................................................... 658 173 CONFIG SPI ................................................................................................................................... 659 174 CONFIG SPIx ................................................................................................................................... 661 175 CONFIG SERVOS ................................................................................................................................... 663 176 CONFIG SUBMODE ................................................................................................................................... 668 177 CONFIG SYSCLOCK ................................................................................................................................... 669 178 CONFIG TCXX ................................................................................................................................... 670 179 CONFIG TCPIP ................................................................................................................................... 673 180 CONFIG TIMER0 ................................................................................................................................... 681 181 CONFIG TIMER1 ................................................................................................................................... 683 182 CONFIG TIMER2 ................................................................................................................................... 686 183 CONFIG TWI ................................................................................................................................... 688 184 CONFIG TWISLAVE ................................................................................................................................... 689 185 CONFIG USB ................................................................................................................................... 695 186 CONFIG VPORT ................................................................................................................................... 701 187 CONFIG WAITSUART ................................................................................................................................... 703 188 CONFIG WATCHDOG ................................................................................................................................... 703 189 CONFIG X10 ................................................................................................................................... 707 190 CONFIG XPIN ................................................................................................................................... 708 191 CONFIG XRAM ................................................................................................................................... 710 192 CONST ................................................................................................................................... 717 193 COS ................................................................................................................................... 718 194 COSH ................................................................................................................................... 719 195 COUNTER0 and COUNTER1 ................................................................................................................................... 720

2012 MCS Electronics

14

BASCOM-AVR 196 CPEEK ................................................................................................................................... 721 197 CPEEKH ................................................................................................................................... 722 198 CRC8 ................................................................................................................................... 723 199 CRC16 ................................................................................................................................... 725 200 CRC16UNI ................................................................................................................................... 728 201 CRC32 ................................................................................................................................... 729 202 CRYSTAL ................................................................................................................................... 730 203 CURSOR ................................................................................................................................... 732 204 DATA ................................................................................................................................... 734 205 DAYOFWEEK ................................................................................................................................... 737 206 DAYOFYEAR ................................................................................................................................... 747 207 DATE$ ................................................................................................................................... 748 208 DATE ................................................................................................................................... 750 209 DBG ................................................................................................................................... 759 210 DCF77TIMEZONE ................................................................................................................................... 759 211 DEBUG ................................................................................................................................... 760 212 DEBOUNCE ................................................................................................................................... 761 213 DECR ................................................................................................................................... 763 214 DECLARE FUNCTION ................................................................................................................................... 764 215 DECLARE SUB ................................................................................................................................... 767 216 DEFxxx................................................................................................................................... 771 217 DEFLCDCHAR ................................................................................................................................... 771 218 DEG2RAD ................................................................................................................................... 772 219 DELAY ................................................................................................................................... 773 220 DELCHAR ................................................................................................................................... 774 221 DELCHARS ................................................................................................................................... 775 222 DIM 223 DIR ................................................................................................................................... 776 ................................................................................................................................... 783

224 DISABLE ................................................................................................................................... 784 225 DISKFREE ................................................................................................................................... 787 226 DISKSIZE ................................................................................................................................... 787 227 DISPLAY ................................................................................................................................... 788 228 DO-LOOP ................................................................................................................................... 791 229 DriveCheck ................................................................................................................................... 792 230 DriveGetIdentity ................................................................................................................................... 793 231 DriveInit ................................................................................................................................... 794 232 DriveReset ................................................................................................................................... 795 233 DriveReadSector ................................................................................................................................... 795 234 DriveWriteSector ................................................................................................................................... 797 235 DTMFOUT ................................................................................................................................... 798 236 ECHO ................................................................................................................................... 800 237 ELSE ................................................................................................................................... 802

2012 MCS Electronics

Contents

15

238 ENABLE ................................................................................................................................... 803 239 ENCODER ................................................................................................................................... 805 240 END 241 EOF 242 EXIT 243 EXP ................................................................................................................................... 808 ................................................................................................................................... 808 ................................................................................................................................... 809 ................................................................................................................................... 811

244 FILEATTR ................................................................................................................................... 812 245 FILEDATE ................................................................................................................................... 813 246 FILEDATETIME ................................................................................................................................... 814 247 FILELEN ................................................................................................................................... 814 248 FILETIME ................................................................................................................................... 815 249 FIX ................................................................................................................................... 816 250 FLUSH ................................................................................................................................... 817 251 FORMAT ................................................................................................................................... 818 252 FOR-NEXT ................................................................................................................................... 819 253 FOURTHLINE ................................................................................................................................... 821 254 FRAC ................................................................................................................................... 822 255 FREEFILE ................................................................................................................................... 823 256 FUSING................................................................................................................................... 824 257 GET ................................................................................................................................... 825 258 GETADC ................................................................................................................................... 828 259 GETATKBD ................................................................................................................................... 831 260 GETATKBDRAW ................................................................................................................................... 835 261 GETDSTIP ................................................................................................................................... 836 262 GETDSTPORT ................................................................................................................................... 836 263 GETKBD ................................................................................................................................... 838 264 GETRC ................................................................................................................................... 840 265 GETRC5 ................................................................................................................................... 842 266 GETREG ................................................................................................................................... 845 267 GETTCPREGS ................................................................................................................................... 846 268 GETSOCKET ................................................................................................................................... 846 269 GLCDCMD ................................................................................................................................... 847 270 GLCDDATA ................................................................................................................................... 848 271 GOSUB................................................................................................................................... 849 272 GOTO ................................................................................................................................... 850 273 GRAY2BIN ................................................................................................................................... 850 274 HEX 276 HIGH ................................................................................................................................... 851 ................................................................................................................................... 853 275 HEXVAL ................................................................................................................................... 852 277 HIGHW ................................................................................................................................... 854 278 HOME ................................................................................................................................... 854 279 I2CINIT ................................................................................................................................... 855

2012 MCS Electronics

16

BASCOM-AVR 280 I2CRECEIVE ................................................................................................................................... 856 281 I2CSEND ................................................................................................................................... 857 282 I2START,I2CSTOP, I2CRBYTE, I2CWBYTE, I2CREPSTART ................................................................................................................................... 858 283 IDLE 285 INCR ................................................................................................................................... 864 ................................................................................................................................... 866 284 IF-THEN-ELSE-END IF ................................................................................................................................... 865 286 INITFILESYSTEM ................................................................................................................................... 867 287 INITLCD ................................................................................................................................... 868 288 INKEY ................................................................................................................................... 869 289 INP ................................................................................................................................... 870 290 INPUTBIN ................................................................................................................................... 871 291 INPUTHEX ................................................................................................................................... 872 292 INPUT ................................................................................................................................... 874 293 INSERTCHAR ................................................................................................................................... 876 294 INSTR ................................................................................................................................... 877 295 INT ................................................................................................................................... 878 296 IP2STR ................................................................................................................................... 879 297 ISCHARWAITING ................................................................................................................................... 880 298 KILL 300 LCD ................................................................................................................................... 881 ................................................................................................................................... 883 299 LCASE ................................................................................................................................... 882 301 LCDCMD ................................................................................................................................... 886 302 LCDDATA .................