Home | AVR | FPGA | M680x | Zilog Z8 | Zilog Z80 | Hitachi SH | Transputer | Linux | DOS

 

Go back to main page

Downloads of Z8 apps

Jump to Zilog web site

 

Z8 Remote Keypad

The Z86E04, or Z86E08 micro-controller  is used in this application to scan a 3*4 matrix keypad and communicate the pressed keys to a host. Communications is achieved through a software driven UART where the host can also communicate back to the keypad and instruct a number of operations to be carried.

The keypad logic is powered from a single 12VDC supply which can be run along side the data carrying wires in the same cable. Since the unit uses very little power and the Z8's power rail is a regulated 5VDC then the small drop that occurs on the wire can be ignored.

All firmware supplied here will scan the 3*4 matrix keypad, decode it, convert it to ASCII, buffer it then send the code out the software controlled UART. Transmission format is 1200bps using 8 bits, no parity, and 1 stop bit format.

Going the other way, the host computer can talk to the keypad to force it to beep, or change the colour of the bi-coloured LED for status indication. The host can also send a special "polling" command to the keypad to determine if it is still operating. The keypad will return a similar code to indicate it is still responsive


Contents


Design specifications

Input voltage 7 to 16 volts DC
Input current 94mA (Typical)
UART bit rate 1200bps

The firmware has been written in assembler code to extract the most from the microprocessor. A fair amount of functionality has been coded into the program with the main feature of a keypad matrix scanner.

The keypad can be used as remote input devices for alarms systems or other sensitive equipment that can be, or needs to be, hidden away in a cupboard somewhere. It has very little intelligence and relies heavily on the host computer to tell it what to do. This makes it great for extending the arm of the host without problems related to damage or even loss of the device afflicting the host.


 

Z8 (86E04/8) pin allocations are

P0.0 Green LED output
P0.1 Red LED output
P0.2 Buzzer control output
P2.0 Keypad column 0 control output
P2.1 Keypad column 1 control output
P2.2 Keypad column 2 control output
P2.3 Keypad row 0 feedback input
P2.4 Keypad row 1 feedback input
P2.5 Keypad row 2 feedback input
P2.6 Keypad row 3 feedback input
P2.7 UART Transmit output
P3.1 Not used (Spare) input
P3.2 Not used (Spare) input
P3.3 UART receive input input

CPU FUNCTIONAL BLOCK RESOURCE ALLOCATION

Timer-0 Used for time base generation and set to generate an interrupt once every 1 milliseconds.
Timer-1 Used to time UART data bit transmission and reception.
P3.1 input Used as standard input. No interrupts generate on edge transition.
P3.2 input Used as standard input. No interrupts generate on edge transition.
P3.3 input Used to generate interrupt on falling edge of Receive data (Start bit).

UART COMMUNICATION and CONTROL CODES

Mnemonic Hex ASCII Description
WAK 0x77 'w' Keypad has powered up and is signaling it is awake.
DGn 0x30-0x39 '0'-'9' Digit data to be display. These include the numerals '0', '1', '2', '3', '4', '5', '6', '7', '8' & '9'.
LRED 0x67 'g' Host wants to turn on RED LED.
LGRN 0x72 'r' Host wants to turn on GREEN LED.
LOFF 0x6C 'l' Host wants to turn off status LED. (Lower case 'L')
BON 0x42 'B ' Host wants to turn on buzzer.
BOFF 0x62 'b' Host wants to turn off buzzer.
PING 0x70 'p' Host uses this to request a ping response.
PINGRSP 0x50 'P' Response from keypad on ping request.

There is no real protocol operating with this device as signal characters cause a single action. There is no checksum or verification data was correctly received by either keypad, or the host.

Therefore the operation should be simple to describe.


Requesting a response (Ping)

The host will issue a ping request ([PING]) and the keypad will return a response to the ping ([PINGRSP]). Not other effect will occur within the keypad.

[PING]

response back to host

[PINGRSP]


Status LED control

The status LED on the keypad, which can be a bi-coloured LED or two separate LED's, can be controlled to show a different colour according to the hosts program requirements. The LED can have one of three states: RED, GREEN and off.

The host will issue one of these commands to the keypad to change the LED colour. There will be no response from the keypad.

[LRED] Turn of Red LED

[LGRN] Turn on Green LED

[LOFF] Turn off both colours

Key press data

The keypad firmware is always scanning the keypad switch matrix. When a key is detected pressed it will proceed to debounce it then verify a second time that the key is still pressed. A verified key will then be transmitted directly to the host.

Key codes are represented and the ASCII equivalent that is printed on the keypad buttons. That is: '0' through '9', '*' and '#'.

Each time a key is pressed the firmware will also beep (very quickly) the buzzer giving the feel of an instant and positive response to the action. The host does not have to do this, however, it can turn of the buzzer for long periods of time.

Buzzer Control

The keypad also has a buzzer that signals a key press but also can be controller but the host to reflect other conditions. These could be alarm arming sequence, warning ticks and alarm conditions. The length of time the buzzer is operated is managed completely by the host computer.

The host can turn of the buzzer with:

[BON]

and off with

[BOFF]


Data Sheets for chips used in this design

Zilog Z86E04, or Z86E08 Z8 Micro-controller data sheet (1.2MB-pdf)
National Semiconductor DS8921A Single RS422 five volt Transmitter/Receiver (245KB-pdf)
ST UA7805 Linear DC voltage regulator

Downloads

Download schematic diagram
  (44KB PDF)
Download the schematic diagram showing the full details of the remote keypad. This circuit uses the now obsolete DS8921A. However, the Sipex SP490 is almost same and can be used to replace it.
Download z8 firmware source code 
(23KB zip)
Download the ZIP archive, extract the files, and go from there. All source, assembled listings and compiled Intel HEX formatted files are present.
Download Z8 assembler and linker tools 
(720KB zip)
Download the ZIP archive, unpack it using the supplied directory names and the make file for the source code will work first run. (IBM-PC executable code).

These tools can also be downloaded from the Zilog web site.

The source code can be compiled using Zilog's Z8 CCP Emulator (Order code: Z86CCP00ZEM) downloadable from www.zilog.com.

To program the Z86E08 you will need to get a hold of a blank chip and a programmer. Zilog also provides these in at least one form: Z8 CCP Emulator (Order code: Z86CCP00ZEM)


If you need a Z86E08 chip supplied and programmed send me an Email. Request a programmed Z8 chip

This page was last updated: Friday, February 07, 2003 14:46 Au EST.

Copyright © C.A.T.E. 2001-02