Файл: Fast AVR. Basic compiller for AVR. User manual (2004).pdf

ВУЗ: Не указан

Категория: Не указан

Дисциплина: Не указана

Добавлен: 13.06.2025

Просмотров: 1444

Скачиваний: 1

ВНИМАНИЕ! Если данный файл нарушает Ваши авторские права, то обязательно сообщите нам.

FastAVR Basic compiler Manual

X and Y coordinates are in Columns and Lines, not in Pixels!

If $LeadChar is defined then result will be right justified with Leading Chars as defined. Also, if Format() is defined then optional decimal point will be inserted!

Example:

TLcd(0, 0), "This is T6963C" ' Writes string on upper Line

Related Topics:

FS pin configuration

GCursor

GCommand

6.4.25.TxtAreaSet

Description:

Sets the Text Page width in Columns.

Syntax:

TxtAreaSet col

Remarks:

col width of Text page

Text page can be wider then LCD visible area!

Example:

TxtAreaSet 20 ' Text page is 20 colums wide

Related Topics:

TxtHomeSet

GrpHomeSet

GrpAreaSet

6.4.26.TxtHomeSet

Description:

Sets the Text Page origin. Can be anywhere in the T6963C RAM.

Syntax:

TxtHomeSet adr

Remarks:

adr address of Text page

Example:

TxtHomeSet &h0000 ' Txt page is at the begining of T6963C RAM

84

FastAVR Basic compiler Manual

Related Topics:

TxtAreaSet

GrpHomeSet

GrpAreaSet

6.5.1WWrite

Description:

1WReset, 1WRead and 1WWrite are the commands used to communicate with Dallas 1 Wire devices.

Syntax:

1WWrite [n,] var|exp|func

or block version

1WWrite [n,] var1, m

Remarks:

1WWrite writes a variable to the bus (var), the result of an entire expression (exp) or a function result (func) n is index if more than one 1Wire bus are used, 0 is default for single 1Wire bus or first 1Wire bus!

Example:

1wwrite &hcc; &h44 ' writing on first 1Wire bus 1wwrite 2, &hcc; &h44 ' writing on 1Wire bus with index 2

Related topics: $1Wire 1WReset 1WRead

6.6.1WReset

Description:

1WReset, 1WRead and 1WWrite are the commands used to communicate with Dallas 1 Wire devices.

Syntax: var=1WReset [n]

or

1WReset [n]

Remarks:

85


FastAVR Basic compiler Manual

1WReset resets the bus and returns the status in var (byte), 0 = there is no 1Wire devices on bus! n is index if more than one 1Wire bus are used, 0 is default for single 1Wire bus or first 1Wire bus!

Example:

a=1wreset, 1 ' reseting secont (index 1) 1Wire bus

Related topics: $1Wire 1WRead 1WWrite

6.7.1WRead

Description:

1WReset, 1WRead and 1WWrite are the commands used to communicate with Dallas 1 Wire devices.

Syntax: var=1WRead [n]

or block version

1WRead [n,] var1, m

Remarks:

1WRead reads from the 1WIRE device and stores the result in var

Second syntax is special block read, m bytes will be read and stored from var1 up in SRAM. var1 MUST be global! n is index if more than one 1Wire bus are used, 0 is default for single 1Wire bus or first 1Wire bus!

Example: $1wire=PORTD.3

1wread n, 8

'

block 1Wread, n must

be global

x=1wread

'

1Wread in variable x

Related topics: $1Wire 1WReset 1WWrite

86

FastAVR Basic compiler Manual

6.8.Abs

Description:

Returns the absolute value of its argument.

Syntax:

var=Abs(numeric expression)

Remarks:

Var will contain the positive value of the signed numeric expression. (integer or Long)

Example:

n=-15

'n

contains -15

n=Asc(n)

'n

will contain

15

6.9.Ac

Description:

Defines the type of Analog Comparator Interrupt.

Syntax:

Ac type

Remarks: type can be:

Rising

Falling

Toggle

Attention! Default setings is Toggle!

Example:

Ac Rising ' Aci will be triggered on the rising edge.

Related topics:

Start

Stop

Enable

Disable

6.10.Acos

Description:

Calculates Inverse Cosine.

Syntax:

var=Acos(numeric expression)

Remarks:

var receives a Acos of numeric expression numeric expression must be positive

87


FastAVR Basic compiler Manual

Acos can return value in Degrees or Radians depends on $Angles Metastatement!

Example:

Dim n As Float

n=Acos(0.5)

'n=60, (if $Angles=Deegrees)

Related topics:

Sin

Cos

Tan

Asin

Atan

6.11.Adc

Description:

Reads the converted analog value from the ADC (valid only for AVR devices with built in ADC).

Syntax:

var=ADC(channel) ' 10 bits conversion var=ADC8(channel) ' 8 bits conversion

Remarks:

channel is the number of the ADC channel (mux). var is a variable that stores the ADC value read. Adc8(ch) returns 8 bit value.

Note that ADC must be started first!

Example:

Start Adc

n=Adc8(i)

'

n

=

8 bit ADC value

w=Adc(i)

'

W

=

10 bit ADC value

Related topics:

Start

Stop

6.12.Asc

Description:

Returns the ASCII code of a character in a string argument.

Syntax:

var=Asc(string or string constant [, numeric expression])

Remarks:

88

FastAVR Basic compiler Manual

Returns the ASCII code of the first character or any character that the second optional numeric expression is pointing to.

Example: s="A"

n=Asc(s) 'n will contain 65 s="12345"

n=Asc(s, 3) 'n will contain 51 (ASCII code for "4")

Related topics:

Chr

6.13.Asin

Description:

Calculates Inverse Sine.

Syntax:

var=Acos(numeric expression)

Remarks:

var receives a Asin of numeric expression numeric expression

Asin can return value in Degrees or Radians depends on $Angles Metastatement!

Example:

Dim n As Float

n=Asin(0.5)

'n=30, (if $Angles=Deegrees)

Related topics:

Sin

Cos

Tan

Asin

Acos

Atan

89


FastAVR Basic compiler Manual

6.14.Atan

Description:

Calculates Inverse Tangens.

Syntax:

var=Atan(numeric expression)

Remarks:

var receives a Atan of numeric expression numeric expression

Atan can return value in Degrees or Radians depends on $Angles Metastatement!

Example:

Dim f1 As Float

f1=ATan(1)

'f1=45, (if $Angles=Deegrees)

Related topics:

Sin

Cos

Tan

Asin

Acos

6.15.Atan2

Description:

Returns the angle from the X axis to a Point (x,y) in units defined in $Angles (default: Radians)

Syntax: var=Atan2(x,y)

Atan2 can return value in Degrees or Radians depends on $Angles Metastatement!

Remarks:

var receives an angle Atan2

y is a number argument cooresponding to Y of point (y,x) x is a number argument cooresponding to X of point (y,x)

90

FastAVR Basic compiler Manual

Example:

Dim f1 As Float

f1=ATan2(6,6)

'f1=45, (if $Angles=Deegrees)

Related topics:

Sin

Cos

Tan

Asin

Acos

Atan

6.16.Baud

Description:

Overrides the $Baud command.

Syntax:

Baud = const [, Parity, DataBits, StopBits]

Baud2 = const ' for second UART

Remarks:

const is the baud rate number - standard values:

1200, 2400, 4800, 9600, 19200, 38400, 56600,76800,115200 but can be any value

Parity N, O, E, M or S (if Parity is set then DataBits must be 9!)

DataBits 8 or 9

StopBits 1 or 2 (in case of 9 DataBits, must be only 1 StopBit)

Example:

Baud=1200 'default = N, 8, 1

Baud2=9600 'default = N, 8, 1

Related topics:

Print

PrintBin

Start

Stop

Input

InputBin

91