DataSheet.es    


PDF AN-203 Data sheet ( Hoja de datos )

Número de pieza AN-203
Descripción I/O Expansion Techniques
Fabricantes ZBasic 
Logotipo ZBasic Logotipo



Hay una vista previa y un enlace de descarga de AN-203 (archivo pdf) en la parte inferior de esta página.


Total 8 Páginas

No Preview Available ! AN-203 Hoja de datos, Descripción, Manual

ZBasic
AN-203 I/O Expansion Techniques
Application Note
Introduction
On more complex projects it is often the case that more I/O lines are needed than the number that are available on
the chosen processor. In this situation, you might first try to redesign the application to require fewer I/O lines. For
example, you may be able to use a given output for multiple purposes. If you still need additional I/O lines, there
are several techniques that you might employ, separately or in combination, to solve the problem.
Although the examples given in this application note are based on the ZX-24, the principles can be equally well
applied to the other ZX processors.
Using a Multiplexer for Multiple Inputs
If your application has a number of signals that only need to be connected to the processor when it is time to read
the input, you may benefit from utilizing an external digital multiplexer. These devices allow 1 of N input signals to
be selected for passing on to the processor, where N is a power of two. Examples of such a device are the
74HC151 (single 8 to 1), the 74HC153 (dual 4 to 1) and the 74HC157 (quad 2 to 1). Figure 1 shows how a ‘151
can be connected to a ZX-24.
Figure 1 Multiplexing 8 Digital Inputs
In this example, using the multiplexer allows up to eight inputs to be read while only using 4 I/O lines of the
processor. The I/O pins 18-20 are used to select the desired input and pin 17 is used to read the state of the
selected input.
An example of the code required to read one of the 8 inputs is given below. Note that the example code may not
work well in a multi-tasking environment depending on how the ports are used. The reason is because the first line
in the GetInput() function reads the value of Register.PortA, modifies it and writes it back. In a multi-tasking
environment, it is possible for a task switch to occur between the time when the value of Register.PortA is read and
when it is written back. If another task gets control between those actions and that task modifies the value of
Register.PortA, the value written back when the Main() task resumes will be incorrect. This problem can be
avoided by either using a semaphore to control access to Register.PortA or by locking the Main() task before the
operation and unlocking it afterward. It should be pointed out, however, that if a task is awaiting an external
Copyright © 2005 Elba Corp.
Rev. A
Published November 2005
Free Datasheet http://www.datasheet4u.net/

1 page




AN-203 pdf
AN-203 I/O Expansion Techniques
Depending on the requirements of the application, a shift register with no output latch (e.g. the 74HC164) might
also be used. The difference is that as the data is being shifted out the outputs of this type of shift register will
“ripple” to their final state. If the data is being presented in parallel to an external device like an LCD this difference
may be insignificant since those devices usually have there own “strobe” input to direct them to accept the data.
Using a Shift Register for Multiple Inputs
A shift register can also be used to free up some I/O lines by sampling input data in parallel and then shifting it in
serially. An example circuit is shown in Figure 4. The shift register shown has an input to control the loading of
input data into the internal register (pin 1, /PL). To read the 8 data inputs you set the /PL input low and then high
again. The logic level that was present at the P7 input of the shift register when the load signal goes high appears
immediately on the Q7 output of the shift register. Then, on each subsequent rising edge of the clock input (pin 1,
CP1 or pin 2, CP2) the logic level of the next lower input will appear at the Q7 output. The DS input (pin 10) is the
data that is shifted into the internal register as it is clocked. If the Q7 output is connected to DS (instead of
grounding DS as is shown), the register will maintain its data value through a cycle of 8 clock signals. This
capability may or may not be useful in your application.
Figure 4: Using a Shift Register for Inputs
The sample code below shows how to read data in from the external shift register. Note, particularly, that the call to
ShiftInEx() uses a ‘flags’ value that causes the data input to be sampled before the clock signal is generated. This
is necessary since the shift register is already presenting the MSB of the data before the first clock transition
occurs.
Private Const dataPin as Byte = 20
Private Const clockPin as Byte = 19
Private Const latchPin as Byte = 19
Dim b as Byte
Sub Main()
' initialize the I/O pins
Call PutPin(dataPin, zxInputTriState)
Call PutPin(clockPin, zxOutputLow)
Call PutPin(latchPin, zxOutputHigh)
' read data from the shift register
b = GetInput()
End Sub
Copyright © 2005 Elba Corp.
-5-
Published November 2005
Free Datasheet http://www.datasheet4u.net/

5 Page










PáginasTotal 8 Páginas
PDF Descargar[ Datasheet AN-203.PDF ]




Hoja de datos destacado

Número de piezaDescripciónFabricantes
AN-203I/O Expansion TechniquesZBasic
ZBasic
AN-203Using the AD2S80A Series Resolver-to-Digital Converters As a Controller TransformerAnalog Devices
Analog Devices

Número de piezaDescripciónFabricantes
SLA6805M

High Voltage 3 phase Motor Driver IC.

Sanken
Sanken
SDC1742

12- and 14-Bit Hybrid Synchro / Resolver-to-Digital Converters.

Analog Devices
Analog Devices


DataSheet.es es una pagina web que funciona como un repositorio de manuales o hoja de datos de muchos de los productos más populares,
permitiéndote verlos en linea o descargarlos en PDF.


DataSheet.es    |   2020   |  Privacy Policy  |  Contacto  |  Buscar