FORTH mini system
If the keyboard of the
emulator is an addressable register in
the extension registers area of the FORTH core described as follows:
278 (0x116) read only:
bits[15..4] = 0xFFF if key down
bits[3,2] = line number (0 in top side)
bits[1,0] = row number (0 in left side)
bits[3..0] are memorized when key is released
The driver will allow to facilitate the use of this registes while
use of the real-time kernel. The principle consists in giving to the
developer the code of the activated key with automatic managment of the
For the FORTH mini system emulator, a component PCF8574A of I2C port numero 7 is used with the following configuration:
bit = 1 if key down
The electrical schematic is the following:
bits[6..4] drive 3 white LEDs lit at 1
bits[3..0] have the same function
Numero of the
keyboard extension register.
This instruction does not exist in the FORTH mini system,
the access to keyboard register is made with the instructions I2C_PCF8574_C@ and I2C_PCF8574_C! numero 7.
adr_prg SYNC_CLAVIER -
Installation of the
adr_prg is the address of the program called with the ASCII code of the
If adr_prg or msq is null, the driver is removed.
n SORT_CLAVIER -
This instruction does not exist in the FORTH Core.
Control of the white DELs, n is in the range 0 to 7.
driver not being integrated into the kernel, it is initially necessary
to compile the source file petit_clavier.txt
before being able to use it.
For the FORTH mini system emulator, it is necessary to compile firts the I2C driver described in the source file pcf8574.txt then compile petit_clavier.txt.
It is necessary to create the program called automatically by the
driver by using following syntax:
INSTRUCTION1 INSTRUCTION2 ... INSTRUCTIONn
WARNING: the program will have the ASCII code of the activated key on
the data stack, one should not forget to remove this value.
It is then necessary to install the driver with the value of the
FIND PROGRAM SYNC_CLAVIER
manages automaticaly the installation of a task which scans the
keyboard every 20 ms. As soon as a key is activated, the program is
executed with its ASCII code. If a key is activated more than 500 ms,
the program is automaticaly launched again every 100 ms during the key
activation. This is
realized with priority 49152.
The following sequence allows to display the
keyboard ASCII codes in the FORTH terminal:
To remove this
program, it is enough to make:
Here is a video: