Switches, Ft 5000 evb – Echelon Mini FX User Manual
Page 85

72 Developing
Device
Applications
Document Title
Description
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.
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.
The programming samples in this section are designed to work with both the FT 5000
EVB and the PL 3150/PL 3170 EVB. Conditional compilation is used where necessary
because some of the I/O devices on the EVBs are different. For the examples in this
chapter, define the USE_5000EVB symbol to use the FT 5000 EVB, and define the
USE_MINIGIZMO symbol to use a PL 3150/PL 3170 EVB (other Series 3100 EVB) with
a Mini Gizmo I/O board attached.
This following section demonstrates how to write Neuron C code to perform I/O on
switches, LEDs, temperature sensors, serial ports, and displays. To view the collection of
I/O definitions and functions created by these examples, see I/O Examples Toolkit at the
end of this section. The subsequent example device applications in this chapter are
based on the I/O definitions and functions.
Note: This section includes code fragments rather than complete application code. To
view complete example Neuron C device applications, see Creating Example Device
Applications later in this chapter.
Switches
The following sections describe how to write Neuron C code that interoperates with the
push buttons on the FT 5000 EVB and the Mini Gizmo I/O Board that you can attach to a
PL EVB. The code that samples the SW1 button on both EVB types can be combined
using conditional compilation. The complete code for the I/O drivers is provided in I/O
Examples Toolkit at the end of this section.
FT 5000 EVB
The FT 5000 EVB includes two push buttons: SW1 and SW2. The SW1 button is wired
straight to the I/O 9 pin and can be sampled using a simple input bit model. The SW2
push button is connected to a parallel-in/serial-out shift register. For simplicity, this
example uses the SW1 button only.
The state of a bit input signal can be read at any time through the io_in() Neuron C
library function: