994
© MCS Electronics , 1995-2010

BASCAVR

  • Upload
    dbzoo

  • View
    625

  • Download
    3

Embed Size (px)

Citation preview

MCS Electronics , 1995-2010

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 2010 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: 24-12-2010

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 and Adrian, 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 BASOM users.

Cover Designer B.F.de Graaff

4

BASCOM-AVR

Table of ContentsForeword 0

Part I Index

21

1 Keyword................................................................................................................................... 22 Reference 2 About MCS Electronics ................................................................................................................................... 25Custom Designs ......................................................................................................................................................... Application Notes ......................................................................................................................................................... 27 27

Part II Installation

29

1 Installation of BASCOM ................................................................................................................................... 29 2 Updates ................................................................................................................................... 35 3 Move to new PC ................................................................................................................................... 44

Part III BASCOM IDE

46

1 Running ................................................................................................................................... 46 BASCOM-AVR 2 File New ................................................................................................................................... 48 3 File Open ................................................................................................................................... 49 4 File Close ................................................................................................................................... 49 5 File Save................................................................................................................................... 49 6 File Save................................................................................................................................... 49 As 7 File Print................................................................................................................................... 50 Preview 8 File Print................................................................................................................................... 50 9 File Exit ................................................................................................................................... 50 10 Edit Undo ................................................................................................................................... 50 11 Edit Redo ................................................................................................................................... 50 12 Edit Cut ................................................................................................................................... 50 13 Edit Copy ................................................................................................................................... 50 14 Edit Paste ................................................................................................................................... 51 15 Edit Find................................................................................................................................... 51 16 Edit Find................................................................................................................................... 51 Next 17 Edit Replace ................................................................................................................................... 51 18 Edit Goto ................................................................................................................................... 51 19 Edit Toggle Bookmark ................................................................................................................................... 51 20 Edit Goto Bookmark ................................................................................................................................... 51 21 Edit Indent Block ................................................................................................................................... 51 22 Edit Unindent Block ................................................................................................................................... 52 23 Edit Remark Block ................................................................................................................................... 52 24 View PinOut ................................................................................................................................... 52 25 View PDF viewer ................................................................................................................................... 56 26 View Error Panel ................................................................................................................................... 58 27 View Tip ................................................................................................................................... 58

2010 MCS Electronics

Contents

5

28 Program ................................................................................................................................... 59 Compile 29 Program ................................................................................................................................... 59 Syntax Check 30 Program ................................................................................................................................... 61 Show Result 31 Program ................................................................................................................................... 62 Simulate 32 Program ................................................................................................................................... 73 Send to Chip 33 Tools Terminal Emulator ................................................................................................................................... 76 34 Tools LCD Designer ................................................................................................................................... 77 35 Tools LIB Manager ................................................................................................................................... 79 36 Tools Graphic Converter ................................................................................................................................... 80 37 Tools Stack Analyzer ................................................................................................................................... 81 38 Tools Plugin Manager ................................................................................................................................... 81 39 Tools Batch Compile ................................................................................................................................... 82 40 Tools PDF Update ................................................................................................................................... 85 41 Tools Resource Editor ................................................................................................................................... 86 42 Options Compiler ................................................................................................................................... 87Options Compiler Chip ......................................................................................................................................................... Options Compiler Output ......................................................................................................................................................... Options Compiler Communication ......................................................................................................................................................... Options Compiler I2C, SPI, 1WIRE ......................................................................................................................................................... Options Compiler LCD ......................................................................................................................................................... 88 89 90 91 92

43 Options Communication ................................................................................................................................... 93 44 Options Environment ................................................................................................................................... 94 45 Options Simulator ................................................................................................................................... 98 46 Options Programmer ................................................................................................................................... 99Supported 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.................................................................................................................................................. LIBUSB ......................................................................................................................................................... 100 101 102 102 103 104 106 109 110 110 119 121 122 123 124 125 125 128

47 Options................................................................................................................................... 138 Monitor 48 Options................................................................................................................................... 139 Printer 49 Window................................................................................................................................... 140 Cascade 50 Window................................................................................................................................... 140 Tile 51 Window................................................................................................................................... 140 Arrange Icons 52 Windows Maximize All ................................................................................................................................... 140

2010 MCS Electronics

6

BASCOM-AVR 53 Window................................................................................................................................... 140 Minimize All 54 Help About ................................................................................................................................... 140 55 Help Index ................................................................................................................................... 141 56 Help MCS Forum ................................................................................................................................... 142 57 Help MCS Shop ................................................................................................................................... 143 58 Help Support ................................................................................................................................... 143 59 Help Knowledge Base ................................................................................................................................... 144 60 Help Credits ................................................................................................................................... 144 61 BASCOM Editor Keys ................................................................................................................................... 145 62 Program Development Order ................................................................................................................................... 146 63 PlugIns ................................................................................................................................... 146Font Editor ......................................................................................................................................................... 146

Part IV BASCOM HARDWARE

150

1 Additional Hardware ................................................................................................................................... 150 2 AVR Internal Hardware ................................................................................................................................... 150 3 AVR Internal Registers ................................................................................................................................... 151 4 AVR Internal Hardware TIMER0 ................................................................................................................................... 153 5 AVR Internal Hardware TIMER1 ................................................................................................................................... 154 6 AVR Internal Hardware Watchdog timer ................................................................................................................................... 156 7 AVR Internal Hardware Port B ................................................................................................................................... 156 8 AVR Internal Hardware Port D ................................................................................................................................... 158 9 Adding ................................................................................................................................... 159 XRAM 10 Attaching an LCD Display ................................................................................................................................... 160 11 Memory................................................................................................................................... 161 usage 12 Using the UART ................................................................................................................................... 163 13 USING RS485 ................................................................................................................................... 169 14 Using the I2C protocol ................................................................................................................................... 171 15 Using the 1 WIRE protocol ................................................................................................................................... 178 16 Using the SPI protocol ................................................................................................................................... 181 17 Power Up ................................................................................................................................... 189 18 Chips ................................................................................................................................... 190AT86RF401 ......................................................................................................................................................... AT90S1200 ......................................................................................................................................................... AT90S2313 ......................................................................................................................................................... AT90S2323 ......................................................................................................................................................... AT90S2333 ......................................................................................................................................................... AT90S2343 ......................................................................................................................................................... AT90S4414 ......................................................................................................................................................... AT90S4433 ......................................................................................................................................................... AT90S4434 ......................................................................................................................................................... AT90S8515 ......................................................................................................................................................... AT90S8535 ......................................................................................................................................................... AT90PWM2-3 ......................................................................................................................................................... AT90CAN128 ......................................................................................................................................................... AT90USB162 ......................................................................................................................................................... ATtiny12......................................................................................................................................................... 190 190 190 191 192 192 194 194 196 197 197 198 199 201 201

2010 MCS Electronics

Contents

7202 202 202 203 203 203 204 204 205 206 206 206 207 208 208 208 209 210 210 211 212 213 214 215 215 216 216 217 217 219 219 221 221 222 223 224 225 225 226 226 227 228 229 230 231 231 232 234 235 236 237 238 239 240 240 241 241 242

ATtiny13......................................................................................................................................................... ATtiny15......................................................................................................................................................... ATtiny22......................................................................................................................................................... ATtiny24......................................................................................................................................................... ATtiny25......................................................................................................................................................... ATtiny26......................................................................................................................................................... ATtiny44......................................................................................................................................................... ATtiny45......................................................................................................................................................... ATtiny48......................................................................................................................................................... ATtiny84......................................................................................................................................................... ATtiny85......................................................................................................................................................... ATtiny88......................................................................................................................................................... ATtiny261 ......................................................................................................................................................... ATtiny461 ......................................................................................................................................................... ATtiny861 ......................................................................................................................................................... ATtiny2313 ......................................................................................................................................................... ATtiny4313 ......................................................................................................................................................... ATMEGA8 ......................................................................................................................................................... ATMEGA16 ......................................................................................................................................................... ATMEGA16U4 ......................................................................................................................................................... ATMEGA32 ......................................................................................................................................................... ATMEGA16M1_32M1_64M1 ......................................................................................................................................................... ATMEGA32U ......................................................................................................................................................... ATMEGA48 ......................................................................................................................................................... ATMEGA48P ......................................................................................................................................................... ATMEGA88 ......................................................................................................................................................... ATMEGA88P ......................................................................................................................................................... ATMEGA64 ......................................................................................................................................................... ATMEGA103 ......................................................................................................................................................... ATMEGA128 ......................................................................................................................................................... ATMEGA1284P ......................................................................................................................................................... ATMEGA161 ......................................................................................................................................................... ATMEGA162 ......................................................................................................................................................... ATMEGA163 ......................................................................................................................................................... ATMEGA164P ......................................................................................................................................................... ATMEGA165 ......................................................................................................................................................... ATMEGA168 ......................................................................................................................................................... ATMEGA168P ......................................................................................................................................................... ATMEGA169 ......................................................................................................................................................... ATMEGA323 ......................................................................................................................................................... ATMEGA324P ......................................................................................................................................................... ATMEGA325 ......................................................................................................................................................... ATMEGA3250P ......................................................................................................................................................... ATMEGA328P ......................................................................................................................................................... ATMEGA329 ......................................................................................................................................................... ATMEGA406 ......................................................................................................................................................... ATMEGA603 ......................................................................................................................................................... ATMEGA640 ......................................................................................................................................................... ATMEGA644P ......................................................................................................................................................... ATMEGA645 ......................................................................................................................................................... ATMEGA649 ......................................................................................................................................................... ATMEGA2560 ......................................................................................................................................................... ATMEGA2561 ......................................................................................................................................................... ATMEGA8515 ......................................................................................................................................................... ATMEGA8535 ......................................................................................................................................................... ATXMEGA ......................................................................................................................................................... ATXMEGA16A4 ......................................................................................................................................................... ATXMEGA16D4 .........................................................................................................................................................

2010 MCS Electronics

8

BASCOM-AVRATXMEGA32A4 ......................................................................................................................................................... ATXMEGA32D4 ......................................................................................................................................................... ATXMEGA64A1 ......................................................................................................................................................... ATXMEGA64A3 ......................................................................................................................................................... ATXMEGA64D3 ......................................................................................................................................................... ATXMEGA64D4 ......................................................................................................................................................... ATXMEGA128A1 ......................................................................................................................................................... ATXMEGA128A3 ......................................................................................................................................................... ATXMEGA128D3 ......................................................................................................................................................... ATXMEGA128D4 ......................................................................................................................................................... ATXMEGA192A3 ......................................................................................................................................................... ATXMEGA192D3 ......................................................................................................................................................... ATXMEGA256A3 ......................................................................................................................................................... ATXMEGA256A3B ......................................................................................................................................................... ATXMEGA256D3 ......................................................................................................................................................... 243 243 244 246 246 247 248 250 250 251 252 253 254 255 256

19 Reference Designs ................................................................................................................................... 257EM4095 ......................................................................................................................................................... RFID Reader USB162 ......................................................................................................................................................... module 257 266

Part V BASCOM Language Fundamentals

269

1 Changes compared to BASCOM-8051 ................................................................................................................................... 269 2 Language Fundamentals ................................................................................................................................... 270 3 Mixing ASM and BASIC ................................................................................................................................... 282 4 Assembler mnemonics ................................................................................................................................... 287 5 Reserved Words ................................................................................................................................... 292 6 Error Codes ................................................................................................................................... 293 7 Newbie ................................................................................................................................... 297 problems 8 Tips and tricks ................................................................................................................................... 298 9 ASCII chart ................................................................................................................................... 299

Part VI BASCOM Language Reference

303

1 #AUTOCODE ................................................................................................................................... 303 2 #IF ELSE ENDIF ................................................................................................................................... 303 3 $ASM ................................................................................................................................... 305 4 $BAUD ................................................................................................................................... 305 5 $BAUD1 ................................................................................................................................... 306 6 $BGF ................................................................................................................................... 307 7 $BIGSTRINGS ................................................................................................................................... 309 8 $BOOT ................................................................................................................................... 310 9 $CRYSTAL ................................................................................................................................... 310 10 $DATA ................................................................................................................................... 311 11 $DBG ................................................................................................................................... 312 12 $DEFAULT ................................................................................................................................... 315 13 $EEPLEAVE ................................................................................................................................... 315 14 $EEPROM ................................................................................................................................... 316 15 $EEPROMHEX ................................................................................................................................... 317 16 $EEPROMSIZE ................................................................................................................................... 318

2010 MCS Electronics

Contents

9

17 $EXTERNAL ................................................................................................................................... 319 18 $FRAMESIZE ................................................................................................................................... 320 19 $HWSTACK ................................................................................................................................... 321 20 $HWCHECK, $SWCHECK, $SOFTCHECK ................................................................................................................................... 322 21 $INC ................................................................................................................................... 324 22 $INCLUDE ................................................................................................................................... 325 23 $INITMICRO ................................................................................................................................... 325 24 $LCD ................................................................................................................................... 326 25 $LCDPUTCTRL ................................................................................................................................... 329 26 $LCDPUTDATA ................................................................................................................................... 330 27 $LCDRS ................................................................................................................................... 331 28 $LCDVFO ................................................................................................................................... 334 29 $LIB ................................................................................................................................... 335 30 $LOADER ................................................................................................................................... 337 31 $LOADERSIZE ................................................................................................................................... 343 32 $MAP ................................................................................................................................... 343 33 $NOCOMPILE ................................................................................................................................... 344 34 $NOINIT ................................................................................................................................... 345 35 $NORAMCLEAR ................................................................................................................................... 345 36 $NORAMPZ ................................................................................................................................... 346 37 $PROJECTTIME ................................................................................................................................... 346 38 $PROG ................................................................................................................................... 347 39 $PROGRAMMER ................................................................................................................................... 348 40 $REGFILE ................................................................................................................................... 349 41 $RESOURCE ................................................................................................................................... 350 42 $ROMSTART ................................................................................................................................... 353 43 $SERIALINPUT ................................................................................................................................... 354 44 $SERIALINPUT1 ................................................................................................................................... 355 45 $SERIALINPUT2LCD ................................................................................................................................... 356 46 $SERIALOUTPUT ................................................................................................................................... 357 47 $SERIALOUTPUT1 ................................................................................................................................... 358 48 $SIM ................................................................................................................................... 358 49 $SWSTACK ................................................................................................................................... 359 50 $TIMEOUT ................................................................................................................................... 360 51 $TINY ................................................................................................................................... 361 52 $WAITSTATE ................................................................................................................................... 362 53 $XA ................................................................................................................................... 363 54 $XRAMSIZE ................................................................................................................................... 363 55 $XRAMSTART ................................................................................................................................... 364 56 1WIRECOUNT ................................................................................................................................... 365 57 1WRESET ................................................................................................................................... 368 58 1WREAD ................................................................................................................................... 370

2010 MCS Electronics

10

BASCOM-AVR 59 1WSEARCHFIRST ................................................................................................................................... 372 60 1WSEARCHNEXT ................................................................................................................................... 375 61 1WVERIFY ................................................................................................................................... 377 62 1WWRITE ................................................................................................................................... 379 63 ABS ................................................................................................................................... 381 64 ACOS ................................................................................................................................... 382 65 ADR , ADR2 ................................................................................................................................... 383 66 AESDECRYPT ................................................................................................................................... 387 67 AESENCRYPT ................................................................................................................................... 389 68 ALIAS ................................................................................................................................... 391 69 ASC 70 ASIN 71 ATN 72 ATN2 ................................................................................................................................... 392 ................................................................................................................................... 395 ................................................................................................................................... 396 ................................................................................................................................... 397

73 BASE64DEC ................................................................................................................................... 398 74 BASE64ENC ................................................................................................................................... 399 75 BAUD ................................................................................................................................... 400 76 BAUD1 ................................................................................................................................... 401 77 BCD 78 BIN ................................................................................................................................... 402 ................................................................................................................................... 404

79 BINVAL................................................................................................................................... 405 80 BIN2GRAY ................................................................................................................................... 406 81 BITWAIT ................................................................................................................................... 407 82 BITS 84 BOX ................................................................................................................................... 408 ................................................................................................................................... 410 83 BLOAD ................................................................................................................................... 409 85 BOXFILL ................................................................................................................................... 412 86 BSAVE ................................................................................................................................... 413 87 BUFSPACE ................................................................................................................................... 414 88 BYVAL ................................................................................................................................... 414 89 CALL ................................................................................................................................... 415 90 CHARPOS ................................................................................................................................... 417 91 CHECKFLOAT ................................................................................................................................... 418 92 CHECKSUM ................................................................................................................................... 420 93 CHR ................................................................................................................................... 421 94 CIRCLE................................................................................................................................... 422 95 CLEAR ................................................................................................................................... 425 96 CLS ................................................................................................................................... 425 97 CLOCKDIVISION ................................................................................................................................... 428 98 CLOSE ................................................................................................................................... 429 99 CLOSESOCKET ................................................................................................................................... 432 100 CONFIG ................................................................................................................................... 435

2010 MCS Electronics

Contents

11

101 CONFIG 1WIRE ................................................................................................................................... 437 102 CONFIG ACI ................................................................................................................................... 441 103 CONFIG ACXX ................................................................................................................................... 441 104 CONFIG ADC ................................................................................................................................... 443 105 CONFIG ADCx ................................................................................................................................... 446 106 CONFIG ATEMU ................................................................................................................................... 448 107 CONFIG BASE ................................................................................................................................... 450 108 CONFIG BCCARD ................................................................................................................................... 451 109 CONFIG CLOCK ................................................................................................................................... 454 110 CONFIG CLOCKDIV ................................................................................................................................... 458 111 CONFIG COM1 ................................................................................................................................... 458 112 CONFIG COM2 ................................................................................................................................... 460 113 CONFIG COMx ................................................................................................................................... 462 114 CONFIG DACx ................................................................................................................................... 464 115 CONFIG DATE ................................................................................................................................... 465 116 CONFIG DCF77 ................................................................................................................................... 468 117 CONFIG DEBOUNCE ................................................................................................................................... 473 118 CONFIG DMXSLAVE ................................................................................................................................... 475 119 CONFIG DP ................................................................................................................................... 477 120 CONFIG EEPROM ................................................................................................................................... 477 121 CONFIG EXTENDED_PORT ................................................................................................................................... 478 122 CONFIG HITAG ................................................................................................................................... 479 123 CONFIG I2CDELAY ................................................................................................................................... 482 124 CONFIG I2CSLAVE ................................................................................................................................... 485 125 CONFIG INPUT ................................................................................................................................... 488 126 CONFIG INTx ................................................................................................................................... 489 127 CONFIG GRAPHLCD ................................................................................................................................... 490 128 CONFIG KBD ................................................................................................................................... 496 129 CONFIG KEYBOARD ................................................................................................................................... 497 130 CONFIG LCD ................................................................................................................................... 500 131 CONFIG LCDBUS ................................................................................................................................... 504 132 CONFIG LCDMODE ................................................................................................................................... 507 133 CONFIG LCDPIN ................................................................................................................................... 507 134 CONFIG OSC ................................................................................................................................... 511 135 CONFIG SYSCLOCK ................................................................................................................................... 512 136 CONFIG PORT ................................................................................................................................... 512 137 CONFIG PORTx ................................................................................................................................... 514 138 CONFIG PRIORITY ................................................................................................................................... 516 139 CONFIG PRINT ................................................................................................................................... 517 140 CONFIG PRINTBIN ................................................................................................................................... 518 141 CONFIG PS2EMU ................................................................................................................................... 519 142 CONFIG RC5 ................................................................................................................................... 521

2010 MCS Electronics

12

BASCOM-AVR 143 CONFIG SDA ................................................................................................................................... 522 144 CONFIG SCL ................................................................................................................................... 523 145 CONFIG SERIALIN ................................................................................................................................... 523 146 CONFIG SERIALOUT ................................................................................................................................... 528 147 CONFIG SINGLE ................................................................................................................................... 530 148 CONFIG SHIFTIN ................................................................................................................................... 531 149 CONFIG SPI ................................................................................................................................... 532 150 CONFIG SPIx ................................................................................................................................... 534 151 CONFIG SERVOS ................................................................................................................................... 535 152 CONFIG TCXX ................................................................................................................................... 538 153 CONFIG TCPIP ................................................................................................................................... 540 154 CONFIG TIMER0 ................................................................................................................................... 543 155 CONFIG TIMER1 ................................................................................................................................... 545 156 CONFIG TIMER2 ................................................................................................................................... 548 157 CONFIG TWI ................................................................................................................................... 550 158 CONFIG TWISLAVE ................................................................................................................................... 551 159 CONFIG USB ................................................................................................................................... 556 160 CONFIG WAITSUART ................................................................................................................................... 562 161 CONFIG WATCHDOG ................................................................................................................................... 563 162 CONFIG X10 ................................................................................................................................... 566 163 CONFIG XRAM ................................................................................................................................... 567 164 CONST ................................................................................................................................... 573 165 COS ................................................................................................................................... 574 166 COSH ................................................................................................................................... 575 167 COUNTER0 and COUNTER1 ................................................................................................................................... 576 168 CPEEK ................................................................................................................................... 577 169 CPEEKH ................................................................................................................................... 578 170 CRC8 ................................................................................................................................... 579 171 CRC16 ................................................................................................................................... 581 172 CRC16UNI ................................................................................................................................... 584 173 CRC32 ................................................................................................................................... 585 174 CRYSTAL ................................................................................................................................... 586 175 CURSOR ................................................................................................................................... 588 176 DATA ................................................................................................................................... 590 177 DAYOFWEEK ................................................................................................................................... 593 178 DAYOFYEAR ................................................................................................................................... 603 179 DATE$ ................................................................................................................................... 604 180 DATE ................................................................................................................................... 606 181 DBG ................................................................................................................................... 615 182 DCF77TIMEZONE ................................................................................................................................... 615 183 DEBUG ................................................................................................................................... 616 184 DEBOUNCE ................................................................................................................................... 617

2010 MCS Electronics

Contents

13

185 DECR ................................................................................................................................... 619 186 DECLARE FUNCTION ................................................................................................................................... 620 187 DECLARE SUB ................................................................................................................................... 622 188 DEFxxx................................................................................................................................... 625 189 DEFLCDCHAR ................................................................................................................................... 626 190 DEG2RAD ................................................................................................................................... 627 191 DELAY ................................................................................................................................... 628 192 DIM 193 DIR ................................................................................................................................... 629 ................................................................................................................................... 632

194 DISABLE ................................................................................................................................... 633 195 DISKFREE ................................................................................................................................... 636 196 DISKSIZE ................................................................................................................................... 636 197 DISPLAY ................................................................................................................................... 637 198 DO-LOOP ................................................................................................................................... 640 199 DriveCheck ................................................................................................................................... 641 200 DriveGetIdentity ................................................................................................................................... 642 201 DriveInit ................................................................................................................................... 643 202 DriveReset ................................................................................................................................... 644 203 DriveReadSector ................................................................................................................................... 644 204 DriveWriteSector ................................................................................................................................... 645 205 DTMFOUT ................................................................................................................................... 647 206 ECHO ................................................................................................................................... 649 207 ELSE ................................................................................................................................... 651 208 ENABLE ................................................................................................................................... 652 209 ENCODER ................................................................................................................................... 653 210 END 211 EOF 212 EXIT 213 EXP ................................................................................................................................... 655 ................................................................................................................................... 656 ................................................................................................................................... 657 ................................................................................................................................... 658

214 FILEATTR ................................................................................................................................... 659 215 FILEDATE ................................................................................................................................... 660 216 FILEDATETIME ................................................................................................................................... 661 217 FILELEN ................................................................................................................................... 662 218 FILETIME ................................................................................................................................... 662 219 FIX ................................................................................................................................... 663 220 FLUSH ................................................................................................................................... 664 221 FORMAT ................................................................................................................................... 665 222 FOR-NEXT ................................................................................................................................... 667 223 FOURTHLINE ................................................................................................................................... 668 224 FRAC ................................................................................................................................... 669 225 FREEFILE ................................................................................................................................... 670 226 FUSING................................................................................................................................... 671

2010 MCS Electronics

14

BASCOM-AVR 227 GET ................................................................................................................................... 672

228 GETADC ................................................................................................................................... 675 229 GETATKBD ................................................................................................................................... 678 230 GETATKBDRAW ................................................................................................................................... 682 231 GETDSTIP ................................................................................................................................... 683 232 GETDSTPORT ................................................................................................................................... 683 233 GETKBD ................................................................................................................................... 684 234 GETRC ................................................................................................................................... 686 235 GETRC5 ................................................................................................................................... 688 236 GETTCPREGS ................................................................................................................................... 690 237 GETSOCKET ................................................................................................................................... 691 238 GLCDCMD ................................................................................................................................... 692 239 GLCDDATA ................................................................................................................................... 693 240 GOSUB................................................................................................................................... 693 241 GOTO ................................................................................................................................... 694 242 GRAY2BIN ................................................................................................................................... 695 243 HEX 245 HIGH ................................................................................................................................... 696 ................................................................................................................................... 698 244 HEXVAL ................................................................................................................................... 697 246 HIGHW ................................................................................................................................... 698 247 HOME ................................................................................................................................... 699 248 I2CINIT ................................................................................................................................... 699 249 I2CRECEIVE ................................................................................................................................... 700 250 I2CSEND ................................................................................................................................... 701 251 I2START,I2CSTOP, I2CRBYTE, I2CWBYTE ................................................................................................................................... 703 252 IDLE 254 INCR ................................................................................................................................... 708 ................................................................................................................................... 710 253 IF-THEN-ELSE-END IF ................................................................................................................................... 709 255 INITFILESYSTEM ................................................................................................................................... 711 256 INITLCD ................................................................................................................................... 712 257 INKEY ................................................................................................................................... 713 258 INP ................................................................................................................................... 714 259 INPUTBIN ................................................................................................................................... 715 260 INPUTHEX ................................................................................................................................... 716 261 INPUT ................................................................................................................................... 718 262 INSTR ................................................................................................................................... 720 263 INT ................................................................................................................................... 721 264 IP2STR ................................................................................................................................... 722 265 ISCHARWAITING ................................................................................................................................... 722 266 KILL 268 LCD ................................................................................................................................... 723 ................................................................................................................................... 725 267 LCASE ................................................................................................................................... 724

2010 MCS Electronics

Contents

15

269 LCDAT ................................................................................................................................... 728 270 LCDAUTODIM ................................................................................................................................... 730 271 LCDCONTRAST ................................................................................................................................... 730 272 LEFT 273 LEN 274 LINE ................................................................................................................................... 731 ................................................................................................................................... 731 ................................................................................................................................... 732

275 LINEINPUT ................................................................................................................................... 735 276 LTRIM ................................................................................................................................... 736 277 LOAD ................................................................................................................................... 736 278 LOADADR ................................................................................................................................... 737 279 LOADLABEL ................................................................................................................................... 737 280 LOADWORDADR ................................................................................................................................... 738 281 LOC 282 LOF ................................................................................................................................... 738 ................................................................................................................................... 739

283 LOCAL ................................................................................................................................... 740 284 LOCATE ................................................................................................................................... 743 285 LOG ................................................................................................................................... 744 286 LOG10 ................................................................................................................................... 744 287 LOOKDOWN ................................................................................................................................... 745 288 LOOKUP ................................................................................................................................... 746 289 LOOKUPSTR ................................................................................................................................... 747 290 LOW ................................................................................................................................... 748 291 LOWERLINE ................................................................................................................................... 749 292 MACRO................................................................................................................................... 749 293 MAKEBCD ................................................................................................................................... 750 294 MAKEINT ................................................................................................................................... 751 295 MAKEDEC ................................................................................................................................... 751 296 MAKEMODBUS ................................................................................................................................... 752 297 MAKETCP ................................................................................................................................... 754 298 MAX 300 MIN 301 MID ................................................................................................................................... 755 ................................................................................................................................... 758 ................................................................................................................................... 759 299 MEMCOPY ................................................................................................................................... 756

302 NBITS ................................................................................................................................... 760 303 ON INTERRUPT ................................................................................................................................... 761 304 ON VALUE ................................................................................................................................... 764 305 OPEN ................................................................................................................................... 766 306 OUT ................................................................................................................................... 773 307 PEEK ................................................................................................................................... 774 308 POKE ................................................................................................................................... 775 309 POPALL ................................................................................................................................... 775 310 POWER................................................................................................................................... 776

2010 MCS Electronics

16

BASCOM-AVR 311 POWER................................................................................................................................... 779 MODE 312 POWERDOWN ................................................................................................................................... 779 313 POWERSAVE ................................................................................................................................... 780 314 PRINT ................................................................................................................................... 780 315 PRINTBIN ................................................................................................................................... 782 316 PSET ................................................................................................................................... 783 317 PS2MOUSEXY ................................................................................................................................... 786 318 PULSEIN ................................................................................................................................... 787 319 PULSEOUT ................................................................................................................................... 788 320 PUSHALL ................................................................................................................................... 788 321 PUT ................................................................................................................................... 789 322 QUOTE ................................................................................................................................... 791 323 RAD2DEG ................................................................................................................................... 792 324 RC5SEND ................................................................................................................................... 792 325 RC5SENDEXT ................................................................................................................................... 794 326 RC6SEND ................................................................................................................................... 796 327 READ ................................................................................................................................... 798 328 READEEPROM ................................................................................................................................... 800 329 READHITAG ................................................................................................................................... 803 330 READMAGCARD ................................................................................................................................... 805 331 READSIG ................................................................................................................................... 807 332 REM ................................................................................................................................... 809 333 REPLACECHARS ................................................................................................................................... 810 334 RESET ................................................................................................................................... 811 335 RESTORE ................................................................................................................................... 811 336 RETURN ................................................................................................................................... 813 337 RIGHT ................................................................................................................................... 814 338 RND ................................................................................................................................... 814 339 ROTATE ................................................................................................................................... 816 340 ROUND................................................................................................................................... 817 341 RTRIM ................................................................................................................................... 818 342 SECELAPSED ................................................................................................................................... 819 343 SECOFDAY ................................................................................................................................... 819 344 SEEK ................................................................................................................................... 820 345 SELECT-CASE-END SELECT ................................................................................................................................... 822 346 SET ................................................................................................................................... 823 347 SETFONT ................................................................................................................................... 826 348 SETTCP ................................................................................................................................... 828 349 SETTCPREGS ...............................................................................................