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

© MCS Electronics, 1995-2007

LOWERLINE

Action

Reset the LCD cursor to the lower line.

Syntax

LOWERLINE

Remarks

NONE

See also

UPPERLINE , THIRDLINE , FOURTHLINE , HOME

Partial Example

Lcd "Test"

Lowerline

Lcd "Hello"

End

MAKEBCD

Action

Convert a variable into its BCD value.

Syntax

var1 = MAKEBCD(var2)

Remarks

var1

Variable that will be assigned with the converted value.

Var2

Variable that holds the decimal value.

 

 

When you want to use an I2C clock device, which stores its values as BCD values you can use this function to convert variables from decimal to BCD.

For printing the bcd value of a variable, you can use the BCD() function which converts a BCD number into a BCD string.

See also

MAKEDEC , BCD , MAKEINT

page -567-

© MCS Electronics, 1995-2007

Example

Dim A As Byte

A = 65

Lcd A

Lowerline

Lcd Bcd(a)

A = Makebcd(a)

Lcd " " ; A

End

MAKEINT

Action

Compact two bytes into a word or integer.

Syntax

varn = MAKEINT(LSB , MSB)

Remarks

Varn

Variable that will be assigned with the converted value.

LSB

Variable or constant with the LS Byte.

MSB

Variable or constant with the MS Byte.

 

 

The equivalent code is: varn = (256 * MSB) + LSB

See also

LOW , HIGH , MAKEBCD , MAKEDEC

Example

Dim A As Integer , I As Integer

A = 2

I = Makeint(a , 1) 'I = (1 * 256) + 2 = 258

End

MAKEDEC

Action

Convert a BCD byte or Integer/Word variable to its DECIMAL value.

Syntax

var1 = MAKEDEC(var2)

page -568-

© MCS Electronics, 1995-2007

Remarks

var1

Variable that will be assigned with the converted value.

var2

Variable that holds the BCD value.

 

 

When you want to use an I2C clock device, which stores its values as BCD values you can use this function to convert variables from BCD to decimal.

See also

MAKEBCD , MAKEBCD, MAKEINT

Example

Dim A As Byte

A = 65

Print A

Print Bcd(a)

A = Makedec(a)

Print Spc(3) ; A

End

MAKETCP

Action

Creates a TCP/IP formatted long variable.

Syntax

var = MAKETCP(b1,b2,b3,b4 [opt]) var = MAKETCP(num)

Remarks

var

The target variable of the type LONG that is assigned with the IP number

b1-b4

Four variables of numeric constants that form the IP number.

 

b1 is the MSB of the IP/long

 

b4 is the LSB of the IP/long

 

example var = MakeTCP(192,168,0, varx).

 

We can also use reverse order with the optional param:

 

example var = MakeTCP(var3,0,168, 192, 1 ).

 

A value of 1 will use reverse order while a value of 0 will result in normal

 

order.

 

When you use a constant, provide only one param:

 

example var = MakeTCP(192.168.0.2). Notice the dots !

 

 

 

 

MakeTCP is a helper routine for the TCP/IP library.

See also

page -569-

© MCS Electronics, 1995-2007

CONFIG TCPIP , IP2STR

Example

NONE

MAX

Action

Returns the maximum value of a byte or word array.

Syntax

var1 = MAX(var2) MAX(ar(1), m ,idx)

Remarks

var1

Variable that will be assigned with the maximum value.

var2

The first address of the array.

 

 

 

The MAX statement can return the indextoo

Ar(1)

Starting element to get the maximum value and index of.

M

Returns the maximum value of the array.

Idx

Return the index of the array that contains the maximum value. Returns 0 if

 

there is no maximum value.

 

 

The MIN() and MAX() functions work on BYTE and WORD arrays only.

See also

MIN

Example

'-----------------------------------------------------------------------------

 

------------

: minmax.bas

'name

'copyright

: (c) 1995-2005, MCS Electronics

'purpose

: show the MIN and MAX functions

'micro

: Mega48

'suited for demo

: yes

'commercial addon needed

: no

'-----------------------------------------------------------------------------

------------

$regfile = "m48def.dat"

' specify the used

micro

' used crystal

$crystal = 4000000

frequency

' use baud rate

$baud = 19200

$hwstack = 32

' default use 32

for the hardware stack

' default use 10

$swstack = 10

for the SW stack

 

 

page -570-