K51-AVR

6 of 7

EXPERIMENTAL CARD FOR 8051 AND AVR MICROPROCESSORS FAMILY

Salvatore Damino


In last number, we had learned to knew the electric charatteristics and selection modality of LCD Alfanumeric Display, this time we make an hardware / software structure, able to manage all the aspects of operator interface.

 

OPERATOR INTERFACE

One of the first step that an inexperienced user ( that desire to learn the control and acquisition techniques) has to do is, for example, interact with the external field. Now one of most simple operations is to switch on and switch off a LED and acquire a contact status. When you are able to performed these two simple dutys you can virtually do any operations.

The operator interfaces are one of most diffused devices, that are used for interfacing with electronic equipments. Is based on Dispaly that shows messages; a varible number of keys and a serial comunication line that allow data exchange between the operator interface and the electronic wquipment. In more sophisticated models there is also a BUZZER, to make sound advices and a certain number of LEDs for to signalizations.

 

SERIAL INTERFACE

On the board it is available, on a comfortable 90° D connector with 9 pins , a standard interface for RS232 serial connection realized with a MAX 202 of integrated circuit on IC6. Most important features of this component, on contrary to classic MAX 232, is that it can generate the ±10 Vdc by using economic 100nf ceramic capacitors in place of usual and more expensive 10µf or 20µf Tantalium capacitors.

Of this integrated circuit has been used only one of its two availables sections. So the not used one, remains for user future expansions.

 

BUZZER

For sound advices, BEL for example, we use a comfortable active BUZZER powered with 5Vdc. This component has cylindric shape, 2 pins for powered supply and it's easy driven.
Every time that it's powered it generates a continuos sound. To stop it is sufficent to switch off the power supply. Thank to its very low current consumption one of the microprocessor I/O line can be used directly. In detail pin 9 of IC8, if we use the 20 pins microprocessor, or pin 15 of IC9 if we use the 40 pins one.

 

FUNCTIONALITY OF OPERATOR INTERFACE

From several possibilities of operator interface we have chose a little part that satisfy a minimum operativity request .
If you want to have more complete idea about the functions realized in a commercial product, please read the commands list of QTP 24; or download one of the QTP XXX English manuals. The available program uses a 20 characters on 2 rows Display driven by K51 - AVR card and connected through CN5 screw driver connector.
The management program is full of explanation remarks that even help inexperienced programmers.
We wants to underlein that is very simple the addition, or the modification of implemented commands. In this way you can resolve also the most difficult demands.

 

OPERATIVITY OF LCD2 PROGRAM

The Demolcd Bas program is a complete emulator of terminal realized in BASCOM 8051 or in BASCOM-AVR for the K51-AVR board connected to a LCD 20x2 display and to a I/O dispositive on serial line.
As very terminal, the program shows on the screen (LED in this case) anything that it receives from serial line, and it send on serial line everything that it receives from board (K51-AVR touchs).
Different from the usual terminal, the program can do some emulation terminal commands, and it has the vantage of beeing totaly programmable.

The MAIN stick shows the principal circle of program that, as we sad, choose firs the serial line as input and LCD display as output, it find if there is a character, and after that it send the character to display throw filter, did that it change situation, it choose the touchs of K51-AVR as input and serial line as output and reply the same process, but now the character throw serial line they doesn't filtered.

The SCAN stick begins the reply's processing by periodical interrupt with 0 Timer, with a period of 20msec. The first thing to do is always to recarge the timer and restart it immedialtly, in this way you don't lose the cadency.
The program scandip one by one the input spring (serial and K51-AVR touchs), save into the buffer in memory the edventual received character. In this way the possibility to lose arrival character when the program does for example, output operations or other operations is very low.
To have a detailled description you can refer to comment into the source.

For selecting input and output dispositivs and using the functions describes in this articles, is necessary to write in the INDEV and OUTDEV the right valor, that can find in the costant section into the source.

The processing doing the different work.

The INIT initialized any of variable used by a program and it starts the 0 Timer.

The Constatus determs if the selected dispositiv as input has received a character and it memorized into the buffer. No way a character can be lost because the interrupt save it into the buffer ; anyway if is impossible to read the buffer before to overfull it, so we can have some problems.

The Conin take a character from a buffer of dispositive choose as input and regive it as in variable, if there wasn't any caratteristic available it regive 0 variable. Anyway it regives 0 also if the character received was 0, for know the two events first we must use the Constatus.

The Conout send to selected dispositive as output the character passed as parameter. In the case of sending to LCD display he character was filtered as describe next throw the Elaboraled.

Next are service routing and there aren't thinking for beeing directly called but only by other processing.

The Bip make an acute sound during 1/10 of second using a buzzer of K51-AVR. During its exegution the interrupt continue to receive input in this way the character doesn't lose.

The Bell make an acute sound during 1/2 second using K51-AVR's buzzer. During its exegution the interrupt continue to receive input, so we can't lose the character.

The Aggiustaxy garantee that the variable Coloumn and Line rests between the limit of 20x2 display. This is necessary because the high level instruction of bascom BASCOM didn't manage the retourn of cursor of display when it come to the end of the line, so is a duty for the program that intercetting all the situation that move the cursor.

The Elaboraled filtered the characters sended to LCD display deciding if there are printable or if they must interpreted as a kind of command. For changing the set of printable characters is sufficent to affect on Select Case on beginning of Elaboraled code (shows from "IMMEDIATLY COMMAND" in the same way for associate the exegution of istruction for determined character we have to affect on the same Select Case.

Particulary a character is consider as a prefix that announce the arrival of a command, this character doesn't make a code and it can be reconfigurated changing the value of Prefix costant.

A command is composed by a code (another character) and a number of parameter (next sending character) variable from zero till the rest of memory consent it.

Te command with 0 parameter are recognited and do immediatly theyr own code. An exemple of this command is under the narration "ZERO PARAMETER COMMAND".

The command with one or more parameter activs the meccanism of parameter collection (memoring any character received till the finished of fixed number, in the narration "PARAMETER COLLECTION", some of this command can seeing under the narration "COMMAND WITH PARAMETER". The exegution of code begin when was callected the last parameter, this make under the narration "EXEGUTION COMMAND WITH PARAMETER".

 

FINDING SOURCE AND DATA SHEETS

I remember that the sources os progrems till now availables, in Italian version and English,directly on address:

www.grifo.it/OFFER/HOBBY/uk_Examples.htm

The component Data Sheet are availlable on:

www.grifo.it/press/uk_not.htm


| Articles | | 1 | | 2 | | 3 | | 4 | | 5 | | 6 | | 7 |


Page up-dated at August 29, 2004


GRIFO®
Via dell'Artigiano, 8/6
40016 San Giorgio di Piano
Bologna ITALY

Tel: +39 051 892.052 (4 lines)
FAX: +39 051 893.661


homeHome Index Categorical Index CPU TablesThe Demo Programs Es. BAS. K51 Mini Modules