Digital sensor example, Analog sensor example – Echelon Mini EVK User Manual

Page 48

Advertising
background image

Document Title

Contents

Part Number

Scanning a Keypad
with the Neuron Chip

Describes how a Smart Transceiver or
Neuron Chip can be used to scan a simple

16-key switch matrix to provide a numeric

or special-function keyboard without the
use of a keyboard encoder.

005-0004-01

Using the Hardware

Serial Peripheral
Interface (SPI) and

Neurowire I/O Object

Models to Interface
with

Peripherals and

Microcontrollers

Describes communications between Smart

Transceivers or Neuron Chips and other
microcontrollers for designs that intend to

make use of the SPI interface for simpler

applications and also for understanding
how the SPI interfaces are implemented in

the Smart Transceivers and Neuron

Chips. Neuron C code examples of an SPI
interface are explained in this engineering

bulletin, and the source code is available

for download.

005-0165

Digital Sensor Example

The following example function reads the push buttons on a MiniGizmo and

returns TRUE if any are pressed. The push buttons are connected to a 74HC165

8-bit parallel-in/serial-out shift register. Data is shifted on the Smart
Transceiver IO4 (clock) and IO5 (data) pins, with a latch strobe on IO6 (active

low to capture). The push button readings are debounced under application
control.

// Configure the I/O pins
IO_4 input bitshift numbits(8) clockedge(-) ioButtons;
IO_6 output bit ioButtonLd = 1;

// Read the MiniGizmo buttons
boolean GetButton(void) {
// Latch the button inputs
io_out(ioButtonLd, 0);
io_out(ioButtonLd, 1);

// Shift in and return TRUE if any buttons are pressed
return !((unsigned) io_in(ioButtons) == 0xFF);
}

Analog Sensor Example

The following example function reads the temperature sensor on a MiniGizmo.

The enable_io_pullups compiler directive is required when using the
MiniGizmo temperature sensor. The temperature sensor is based on a 1-Wire

(“Touch I/O”) Dallas DS18S20 digital thermometer. The Touch I/O interface is

connected to the Smart Transceiver IO7 pin.

#pragma enable_io_pullups

// Configure the I/O pins
IO_7 touch ioThermometer;
IO_10 output serial baud (4800) ioSerialOut;

42

Mini EVK User’s Guide

Advertising