CONTR-&-BASIC
     

Matrix keypad and symbol LCD for BASINT

BASINT version 2.3A for ATMEGA32 can operate with the matrix keypad and the symbol LCD.

The I/O process for keypad and LCD uses the same command as the console I/O (PRINT, INPUT, INKEY,WAITKEY). The commands INITKEY, INITLCD were added to hardware initialize. The function CHN() was added to switch channels of I/O.

LCD and KEYPAD connections

CHN

Action:
Sets needed channel of I/O and returns zero
Synrax:
var=CHN(channel)
It is allowed to write:
CHN(channel)
PRINT [list;] CHN(channel); [list]

The parameter channel can accept values:

0 - console I/O
1 - reserved
2 - output on LCD / input from matrix keypad



 

KEYINIT

Action:
Initializes the system to work with the matrix keypad.
Syntax:
KEYINIT

 

LCDINIT

Action:
Initializes the system to work with LCD.
Syntax:
LCDINIT mode
The parameter mode can accept values:

0 - single line display with consecutive addressing
1 - single line display but after the 7-th symbol the address in LCD RAM is 0x40
2 - two and more lines display

 

The display shows the symbols typed by the command PRINT. If the input stream has control ANSI sequence opened by symbol 27 (0x1b) the input parser recognizes valid commands and performs them. The valid commands are shown below.

Control ANSI sequences

ESC - symbol with code 27 (1B - in hex)

Control sequence

Action

ESC[2J

Clears display and sets cursor at row=1, column=1

ESC[<row>;<column>f or
ESC[<row>;<column>H

Sets the cursor position at row, column

ESC[f èëè ESC[H

Sets the cursor position at 1,1

ESC[<n_shifts>C

Shifts cursor the n_shifts times to the right

ESC[C

Shifts cursor to the right

ESC[<n_shifts>D

Shifts cursor the n_shifts times to the left

ESC[D

Shifts cursor to one position to the right

Non-standard control sequences

Control sequence

Action

ESC0D

Hides the cursor

ESC0Ñ

Shows the cursor

Some actions upon some single symbols

Symbol

Action

0x08

Shifts cursor to the left

0x0A

Ignored

0x0Ñ

Clears display and sets cursor at row=1, column=1

0x0D

Ignored

The sample below shows how use ANSII sequences. Note that clear screen operation is not too fast. Insert delay after clear screen operation.


    cls
    delay 100
    print at(1,1);"ADC #1 ";
    print at(1,2);"ADC #2 ";
10  x = adc
    setadmux 0
    print at(9,1);x;"     "
    y = adc
    setadmux 1
    print at(9,2);y;"     "
    goto 10

_________________________________
By
Alexander Kostyuk ua6ann@mail.ru
Evgeny Fadeev rv3bj@hotbox.ru

05/14/2007