Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
BASCOM AVR, help reference (2007).PDF
Скачиваний:
286
Добавлен:
12.08.2013
Размер:
17.02 Mб
Скачать

Version 1.11.8.6

© MCS Electronics, 1995-2007

© MCS Electronics, 1995-2007

page -2-

© MCS Electronics, 1995-2007

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 othertool 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 yourwork with microprocessors Easy and enjoyable.

While there is not enough space to mention all contributors, ther is one that must be mentioned : Josef Franz Vögel. He wrote the Trig libraries, the AVR-DOS file system and the DOUBLE library.

The MCS Electronics Team

page -3-

© MCS Electronics, 1995-2007

Table of Contents

Index

15

Keyword Reference

16

Installation

20

Installation of BASCOM

20

BASCOM IDE

26

Running BASCOM-AVR

26

File New

28

File Open

29

File Close

29

File Save

29

File Save As

29

File Print Preview

30

File Print

30

File Exit

30

View PinOut

30

View PDF viewer

35

View Error Panel

36

Edit Undo

37

Edit Redo

37

Edit Cut

37

Edit Copy

37

Edit Paste

37

Edit Find

38

Edit Find Next

38

Edit Replace

38

Edit Goto

38

Edit Toggle Bookmark

38

Edit Goto Bookmark

38

Edit Indent Block

39

Edit Unindent Block

39

Edit Remark Block

39

Program Compile

39

Program Syntax Check

40

Program Show Result

41

Program Simulate

42

Program Send to Chip

52

Tools Terminal Emulator

55

Tools LCD Designer

56

Tools LIB Manager

57

Tools Graphic Converter

59

Tools Stack Analyzer

60

Tools Plugin Manager

60

Tools Batch Compile

61

Options Compiler

63

Options Compiler Chip

64

Options Compiler Output

65

Options Compiler Communication

66

page -4-

© MCS Electronics, 1995-2007

Options Compiler I2C, SPI, 1WIRE

67

Options CompilerLCD

68

Options Communication

69

Options Environment

70

Options Simulator

73

Options Programmer

74

Supported Programmers

76

ISP programmer

76

PG302 programmer

77

Sample Electronics cable programmer

78

KITSRUS Programmer

79

MCS Universal Interface Programmer

80

STK500 Programmer

82

Lawicel BootLoader

84

AVR ISP Programmer

84

USB-ISP Programmer

85

MCS Bootloader

89

Options Monitor

91

Options Printer

91

Window Cascade

92

Window Tile

92

Window Arrange Icons

92

Window Minimize All

92

Help About

92

Help Index

94

Help MCS Forum

94

Help MCS Shop

95

Help Support

96

Help Knowledge Base

96

Help Credits

97

BASCOM Editor Keys

98

Program Development Order

99

PlugIns

100

Font Editor

100

PinOut

101

BASCOM HARDWARE

102

Additional Hardware

102

AVR Internal Hardware

102

AVR Internal Registers

103

AVR Internal Hardware TIMER0

105

AVR Internal Hardware TIMER1

106

AVR Internal Hardware Watchdog timer

108

AVR Internal Hardware Port B

109

AVR Internal Hardware Port D

110

Adding XRAM

111

Attaching an LCD Display

112

Memory usage

113

Using the UART

115

Using the I2C protocol

121

Using the 1 WIRE protocol

127

page -5-

© MCS Electronics, 1995-2007

 

Using the SPI protocol

130

Power Up

137

Chips

139

AT86RF401

139

AT90S1200

139

AT90S2313

139

AT90S2323

140

AT90S2333

140

AT90S2343

141

AT90S4414

142

AT90S4433

143

AT90S4434

144

AT90S8515

145

AT90S8535

146

AT90CAN128

147

ATtiny22

148

ATtiny12

149

ATtiny13

149

ATtiny15

149

ATtiny25

149

ATtiny45

150

ATtiny85

150

ATtiny26

150

ATtiny2313

151

ATMEGA8

152

ATMEGA16

152

ATMEGA32

153

ATMEGA48

154

ATMEGA88

155

ATMEGA168

155

ATMEGA64

156

ATMEGA103

157

ATMEGA128

158

ATMEGA161

159

ATMEGA162

160

ATMEGA163

161

ATMEGA165

162

ATMEGA169

162

ATMEGA323

163

ATMEGA603

164

ATMEGA2560

166

ATMEGA2561

167

ATMEGA8515

167

ATMEGA8535

168

BASCOM Language Fundamentals

169

Changes compared to BASCOM-8051

169

Language Fundamentals

170

Mixing ASM and BASIC

182

Assembler mnemonics

187

Reserved Words

192

page -6-

© MCS Electronics, 1995-2007

Error Codes

193

Newbie problems

197

Tips and tricks

198

ASCII chart

199

BASCOM Language Reference

202

$ASM

202

$BAUD

202

$BAUD1

203

$BGF

204

$BOOT

206

$CRYSTAL

207

$DATA

207

$DBG

209

$DEFAULT

211

$EEPLEAVE

212

$EEPROM

212

$EEPROMHEX

213

$EXTERNAL

214

$FRAMESIZE

215

$HWSTACK

216

$INC

217

$INCLUDE

218

$INITMICRO

219

$LCD

220

$LCDPUTCTRL

222

$LCDPUTDATA

223

$LCDRS

224

$LCDVFO

227

$LIB

227

$LOADER

230

$LOADERSIZE

235

$MAP

236

$NOCOMP

237

$NOINIT

237

$NORAMCLEAR

238

$PROG

238

$PROGRAMMER

240

$REGFILE

241

$ROMSTART

242

$SERIALINPUT

242

$SERIALINPUT1

244

$SERIALINPUT2LCD

245

$SERIALOUTPUT

245

$SERIALOUTPUT1

246

$SIM

247

$SWSTACK

247

$TIMEOUT

248

$TINY

250

$WAITSTATE

251

$XA

252

page -7-

 

© MCS Electronics, 1995-2007

$XRAMSIZE

252

$XRAMSTART

253

1WIRECOUNT

254

1WRESET

256

1WREAD

259

1WSEARCHFIRST

261

1WSEARCHNEXT

263

1WVERIFY

265

1WWRITE

267

ABS

270

ACOS

270

ALIAS

271

ASC

272

ASIN

275

ATN

276

ATN2

277

BASE64DEC

278

BASE64ENC

279

BAUD

280

BAUD1

281

BCD

282

BIN

284

BINVAL

285

BIN2GRAY

286

BITWAIT

287

BITS

288

BLOAD

289

BOX

290

BSAVE

292

BUFSPACE

293

BYVAL

294

CALL

294

CHECKSUM

296

CHR

297

CIRCLE

298

CLEAR

301

CLS

302

CLOCKDIVISION

304

CLOSE

305

CLOSESOCKET

308

CONFIG

311

CONFIG 1WIRE

312

CONFIG ACI

314

CONFIG ADC

315

CONFIG ATEMU

316

CONFIG BCCARD

319

CONFIG CLOCK

321

CONFIG CLOCKDIV

324

CONFIG COM1

325

CONFIG COM2

327

page -8-

© MCS Electronics, 1995-2007

 

CONFIG COMx

328

CONFIG DATE

330

CONFIG DCF77

332

CONFIG DEBOUNCE

338

CONFIG I2CDELAY

339

CONFIG I2CSLAVE

341

CONFIG INPUT

344

CONFIG INTx

345

CONFIG GRAPHLCD

346

CONFIG KBD

351

CONFIG KEYBOARD

352

CONFIG LCD

355

CONFIG LCDBUS

359

CONFIG LCDMODE

361

CONFIG LCDPIN

362

CONFIG PORT

365

CONFIG PRINT

366

CONFIG PRINTBIN

368

CONFIG PS2EMU

368

CONFIG RC5

371

CONFIG SDA

371

CONFIG SCL

372

CONFIG SERIALIN

372

CONFIG SERIALIN1

375

CONFIG SERIALOUT

377

CONFIG SERIALOUT1

379

CONFIG SINGLE

381

CONFIG SPI

382

CONFIG SERVOS

384

CONFIG TCPIP

385

CONFIG TIMER0

388

CONFIG TIMER1

390

CONFIG TIMER2

393

CONFIG TWI

394

CONFIG TWISLAVE

396

CONFIG WAITSUART

399

CONFIG WATCHDOG

399

CONFIG X10

401

CONFIG XRAM

402

CONST

403

COS

405

COSH

406

COUNTER0 and COUNTER1

407

CPEEK

408

CPEEKH

409

CRC8

410

CRC16

412

CRC32

415

CRYSTAL

416

CURSOR

417

page -9-

 

© MCS Electronics, 1995-2007

DATA

419

DAYOFWEEK

422

DAYOFYEAR

431

DATE$

432

DATE

434

DBG

443

DEBUG

444

DEBOUNCE

445

DECR

447

DECLARE FUNCTION

448

DECLARE SUB

449

DEFxxx

452

DEFLCDCHAR

453

DEG2RAD

453

DELAY

454

DIM

455

DIR

458

DISABLE

459

DISKFREE

462

DISKSIZE

462

DISPLAY

463

DO-LOOP

466

DriveCheck

467

DriveGetIdentity

468

DriveInit

469

DriveReset

469

DriveReadSector

470

DriveWriteSector

471

DTMFOUT

472

ECHO

474

ELSE

476

ENABLE

478

ENCODER

479

END

481

EOF

481

EXIT

482

EXP

484

FILEATTR

485

FILEDATE

486

FILEDATETIME

486

FILELEN

487

FILETIME

488

FIX

489

FLUSH

489

FORMAT

490

FOR-NEXT

492

FOURTHLINE

494

FRAC

494

FREEFILE

495

FUSING

496

page -10-

© MCS Electronics, 1995-2007

 

GET

497

GETADC

500

GETATKBD

502

GETATKBDRAW

506

GETDSTIP

506

GETDSTPORT

507

GETKBD

508

GETRC

510

GETRC5

511

GETTCPREGS

514

GETSOCKET

514

GLCDCMD

515

GLCDDATA

516

GOSUB

517

GOTO

518

GRAY2BIN

518

HEX

519

HEXVAL

520

HIGH

521

HIGHW

522

HOME

522

I2CINIT

523

I2CRECEIVE

524

I2CSEND

525

I2START,I2CSTOP, I2CRBYTE, I2CWBYTE

525

IDLE

528

IF-THEN-ELSE-END IF

528

INCR

529

INITFILESYSTEM

530

INITLCD

531

INKEY

532

INP

533

INPUTBIN

534

INPUTHEX

535

INPUT

537

INSTR

538

INT

540

IP2STR

541

ISCHARWAITING

541

KILL

542

LCASE

543

LCD

544

LCDAT

546

LCDCONTRAST

548

LEFT

549

LEN

549

LINE

550

LINE INPUT

553

LTRIM

554

LOAD

554

page -11-

 

© MCS Electronics, 1995-2007

LOADADR

555

LOADLABEL

555

LOADWORDADR

556

LOC

556

LOF

557

LOCAL

558

LOCATE

561

LOG

562

LOG10

562

LOOKDOWN

563

LOOKUP

564

LOOKUPSTR

565

LOW

566

LOWERLINE

567

MAKEBCD

567

MAKEINT

568

MAKEDEC

568

MAKETCP

569

MAX

570

MEMCOPY

571

MIN

573

MID

574

NBITS

574

ON INTERRUPT

576

ON VALUE

578

OPEN

581

OUT

584

PEEK

585

POKE

586

POPALL

587

POWER

587

POWERDOWN

588

POWERSAVE

588

PRINT

589

PRINTBIN

590

PSET

591

PS2MOUSEXY

594

PULSEIN

595

PULSEOUT

596

PUSHALL

596

PUT

597

RAD2DEG

599

RC5SEND

600

RC5SENDEXT

602

RC6SEND

604

READ

606

READEEPROM

608

READMAGCARD

610

REM

612

RESET

613

page -12-

© MCS Electronics, 1995-2007

 

RESTORE

614

RETURN

616

RIGHT

617

RND

618

ROTATE

619

ROUND

620

RTRIM

621

SECELAPSED

622

SECOFDAY

623

SEEK

624

SELECT-CASE-END SELECT

625

SET

627

SETFONT

629

SETTCP

631

SETTCPREGS

632

SENDSCAN

634

SENDSCANKBD

636

SERIN

640

SEROUT

642

SETIPPROTOCOL

644

SGN

646

SHIFT

647

SHIFTCURSOR

649

SHIFTIN

649

SHIFTOUT

651

SHIFTLCD

652

SHOWPIC

653

SHOWPICE

654

SIN

655

SINH

656

SOCKETCONNECT

657

SOCKETLISTEN

659

SOCKETSTAT

660

SONYSEND

661

SOUND

664

SPACE

666

SPC

667

SPIIN

668

SPIINIT

669

SPIMOVE

669

SPIOUT

670

SPLIT

670

SQR

672

START

673

STCHECK

674

STOP

679

STR

679

STRING

680

SUB

681

SYSSEC

682

page -13-

 

© MCS Electronics, 1995-2007

SYSSECELAPSED

683

SYSDAY

684

SWAP

685

TAN

686

TCPCHECKSUM

687

TCPREAD

690

TCPWRITE

691

TCPWRITESTR

691

TANH

695

THIRDLINE

696

TIME$

696

TIME

697

TOGGLE

699

TRIM

700

UCASE

700

UDPREAD

701

UDPWRITE

704

UDPWRITESTR

706

UPPERLINE

709

VAL

709

VARPTR

710

VER

711

VERSION

712

WAIT

712

WAITKEY

713

WAITMS

714

WAITUS

715

WHILE-WEND

716

WRITE

717

WRITEEEPROM

718

X10DETECT

720

X10SEND

722

#IF ELSE ENDIF

723

International Resellers

726

International Resellers

726

ASM Libraries

727

I2C_TWI

727

EXTENDED I2C

727

MCSBYTE

729

MCSBYTEINT

729

TCPIP

730

LCD

731

LCD4BUSY

731

LCD4.LIB

732

LCD4E2

732

GLCD

733

GLCDSED

733

PCF8533

734

LCD-EPSON

736

AVR-DOS

737

page -14-