You are on page 1of 30

Home PIC Resources PIC Arduino Resources PIC C Course - 25% Off 18F Training

Home
Become a subscriber (Free)
Projects
Join 29,000 other subscribers to receive subscriber sale
Arduino discounts and other free resources.
Name: Your First Name
MAX7219 Dotmatrix
E-Mail: Your Email
MCP23017 I/O Expander

BMP280 Pressure Sensor

DS18B20 Thermometer

Humidity DHT22/11
Don't worry -- youre-mail address is totally secure. I
Rotary Encoder promise to use it only to send you MicroZine.
MAX6675 0 to 1024 DegC
BACK TO
Battery Charger TOP

SSD1306 OLED
74HC595 Shift Register Show Index
74HC595 I/O Expander The 74HC595 is useful if you find yourself needing more outputs than you have
available on your microcontroller; Its time to think about using a serial shift

Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Hitachi HD44780 register such as this chip.

Logic Level Converter Using a few of your existing microcontroller outputs you can add multiple 595's to
DigitalWrite
extend outputs in multiples of 8; 8 outputs per 595. When you add more 595s
you don't use up any more of your existing microcontroller output pins.
Ebooks

Digital download eBooks

PIC

LED Dot Matrix 8x8 Direct


drive

Serial LCD

LCD Keypad

Frequency Counter LCD

Frequency Counter 7seg

DS1307 Clock

Binary Clock 8x8 matrix

Infrared Receiver

A PIC 12F675 tutorial.

LCD Volt Meter

PIC Sonar

PIC Projects BACK TO


The way it works is that you use one microcontroller pin as a data output and TOP
Project Ideas another as the clock. Simply toggle the clock pin low to high to clock in the value
at the data input of the 595. Since the 595 has 8 outputs you do this 8 times to report Show
this ad Index

Interfaces fill the 595 memory. To transfer the new stored data to the outputs toggle
another pin and you're done - 8 new outputs working. Like 18
SPI Interface

Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
I2C Interface Search Site...
Tip: The 74HC595 series chips are useful but only provide outputs. If
PIC Resources Visit our Facebook Page:
you need both Inputs and Outputs (and interrupts on input) then have a
To Visit Click Here
look at this device : The MCP23017.
PIC Introduction

PIC ICSP
You can also string together multiple 595's for even more outputs! There are
Programmer Types several examples here that show you how to do it. Recent Articles

Resources This 74HC595 tutorial shows you examples of driving 7 segments, LEDs, and PCF8591: An 8
using multiple 595's for 8, 16 or 32 outputs all using just a 3 wire interface. You bit ADC you can
Tips & Techniques
can also find out the correct way of using these devices to drive LEDs and seven easily connect
PIC Tutorials segment displays and learn how to add 8, 16, 32, or more, outputs with multiple using I2C
595's.
Microcontroller Blog

Site map The 74HC595 is a serial-to-parallel shift register or SIPO (Serial In Parallel Out) PCF8591: A four input
device for increasing the number of outputs from your microcontroller. Its simply ADC with single DAC.
Other a memory device that sequentially stores each bit of data passed to it. How good is this 8 bit
ADC, and should you
Articles You send it data by presenting a data bit at the data input and supplying a clock
use it in your next
Books
signal to the clock input. At each clock signal the data is passed along a chain of
project?
d-types - the output of each d-type feeds into the input of the next.
Read more
When you have clocked in 8 bits of data you can then activate the parallel 8 bit
output from the d-type stores.
AD9833 a
versatile easy
to use signal
generator on a BACK TO
TOP
chip
Show Index

Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Find out how to use
the AD9833 to
generate sine, square
and triangle waves at
0.1Hz resolution.

Read more

How to use an
SPI Interface arduno Nano as
an ISP (In
The 595 uses the standard SPI interface. The three serial control signals from the System
microcontroller are: Programmer)
Serial Data In.
Serial Clock.
Latch Clock.

With only these 3 serial controls you can add as many outputs as you need - the
number of serial control wires always remains the same.

On the chip there are also two other control signals: BACK TO
TOP

report this ad Master reset (MR) Arduino Nano ISP:


Show Index
Output Enable (OE) How to program an
ATmega328P using an

Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
The output enable is not really useful for modern designs just connect it to Arduino Nano as the
ground (see here for what it should really used for). ISP programmmer.
One common
problem:
Programming a
sketch into the chip
without a reset
control - solved here.

Read more

Arduino
Voltage
Reference
Capabilities

You can wire the Master Reset (MR) control inactive unless it is vital that the
outputs are reset to zero on power up. Leaving it active means a software reset is
required at the start to send zeros to the shift register and then strobe them to
the output using the latch clock.

Arduino Voltage BACK TO


TOP
reference: Both the
Uno and Nano have a
Show Index
built-in voltage
reference: Find out
how to make it more

Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
accurate. In addition
find out how to use it
to measure the
supply voltage 1V8 ~
5V5

Read more

Arduino
EEPROM - how
it works and
how to use it -
with examples.
Arduino EEPROM:
Note: On my bench, on first power up, all the outputs came up fully On! How to use it and
If this is a problem then use a global reset signal (that you make from a How to preserve the
few components to hold the reset line low for a while after power up). life of EEPROM. Two
You can also use this signal to reset any other components that have an examples sketches to
active low reset - they usually do - such as the processor. save multiple values
to EEPROM.

The 595 allows you to transmit data in a serial stream using a few wires with the Read more
outputs at the destination delivered in parallel. In addition multiple 595's can be
daisy chained so you can have as many outputs as you need without any increase
How to use the
in serial wiring.
ADS1115
Microcontroller systems come in 8, 16, 32 bit parallel bus designs because it is
BACK TO
faster to send data internally inside a chip using a wide bus (a set of parallel TOP
connections). However when you need to interconnect devices outside the
processor, connecting and routing 32 wires all over the place becomes a problem Show Index
(even 8 is a pain). The solution is to use a serial interface and translate the A tutorial on using the
ADS1115 precision 16

Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
parallel 8, 16 or 32 bit data into a timed stream of data. The 595 will translate bit ADC for low power
that back into an 8 bit output (see later for increasing the parallel output width). use.

Read more

Structure of the 74HC595


Readers Comments
The 595 has two main registers:
"I wanted to thank
The shift register.
you so so so much
The output register (or data latch or sometimes called a register latch).
for all the information
you have provided in
The 74HC595 is arranged this way, so, when you update the shift register data
your site it's
using the serial clock (SRCLK) and serial data (SER) inputs, the outputs from the
chip do not change .i.e. you can feed data into the shift register and it will ripple
SUPERB and FANTASTIC."
through without affecting the output pin state. Only when the output data clock is
strobed (latch clock or register clock - RCLK) will the data be transferred from the
- Ranish Pottath
shift register to the output pins.

The diagram below shows the internal structure of the 595: "This site really is
the best and my favorite.
I find here many useful
projects and tips."

- Milan

bursach<at>gmail.com<

"Awesome site,
BACK TO
very, very easy and nice TOP
to navigate!"
Show Index
- Matt

Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
matt_tr<at>
wolf359.cjb.net

Learn Microcontrollers

"Interested in
Microcontrollers?"

Sign up for The


Free 7 day
guide:

FREE GUIDE :
CLICK HERE

"I am a newbie to PIC


and I wanted to say
how great your
site has been for me."

- Dave

de_scott<at>bellsouth.net

"Your site is a great


BACK TO
and perfect work. TOP

congratulations."
Show Index

- Suresh

Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
integratredinfosys<at>
yahoo.com

"I couldn't find the correct


words to define
yourweb site.

Very useful, uncovered,


honest and clear.

Thanks so much for


your time and works.
Regards."

- Anon
74HC595 pinout
The diagram below shows the pinout of the 74HC595. It follows the standard TTL
chip layout with power at top right and ground at bottom left. All outputs except
one are on the left side of the chip and control signals are on the right. The serial
output QH' is at bottom right and this is for daisy chaining the devices.

BACK TO
TOP

Show Index

Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Pin name Functions
QA-QH Outputs Q0 (QA) to Q7 (QH).
QH' Serial data output.
SER Serial data input.
SRCLK Serial data input clock.
RCLK Output register (Latch) clock.
SRCLR Active low, Asynchronous Shift register Clear.
OE Active low, Output Enable.
VCC Positive Power Supply.
GND Negative Power supply (Ground - 0V).

How to make a 16 bit shift register


with the 74HC595
Making a 16 bit shift register is very simple it is just using a 74HC595 daisy
chain. All you do, is to use two 595's and connect the data output from the first
shift register to the data input of the next one i.e. connect the QH' of the first 595
to the SER (serial data input) of the next.

The diagram below shows the simple connections required (note how the serial
clock signals are fed into both chips while the data signal is shifted out from the
1st chip and into the 2nd chip):

BACK TO
TOP

report Show
this ad Index

Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
BACK TO
TOP

Show Index

Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
BACK TO
TOP

Show Index
Note: The only change that is required to control the outputs is that instead of 8
x SRCLK clock pulses you will need 16 x SRCLK clock pulses, with associated
serial data (SER) i.e. a software change is required.

Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Daisy chaining more than 2 x 74HC595s
How to serial connect 4 74HC595s in a chain; This is very simple to do - it is just
an extension of the above process i.e. connect the serial out of the previous
74HC595 to the serial input of the next. The only difference is the total number of
bits to be transmitted.

Note: The only change is a software change, and that is to send more
serial data and serial clocks to the 1st 595. The data then ripples
through to the last 595, as long as you send enough clocks!

View larger image here.

A Project using the 74HC595


arduino for 7 segment Display. BACK TO
TOP

This project shows how to wire up and control 16 LEDs and two seven segment Show Index
displays using 4 74HC595 chips. There are three sets of code going through 8,16
and 32 outputs to allow easy wiring of the devices.

Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Note: You can wire each chip up in turn as you go through the three
examples below - you don't need to do them all at once.

View larger image here.

Note: all resistors for led drives including the seven segment displays
are : 470 Ohms. See discussion here for why this should be the lowest
value i.e. not 330 Ohms

As you can see only three connections are required from the Arduino and you can
add more 595 chips as you require more outputs, without using any more
Arduino pins.

The Arduino connections are:

P3 - RCLK - register or latch (output) clock.


P6 - SRCLK - Serial Register Clock. BACK TO
TOP
P4 - SER - Serial Data input.
Show Index
Example 1 : 8 LED Walking 1

Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
This example Arduino sketch shows how to drive a single 74HC595 using the
outputs for driving LEDs. The walking one direction is controlled by the variable
dir while the actual value is set into variable d. If a high bit is detected at either
end of the byte then the direction is changed. in this way the walking one goes
left and right through the byte. After each shift the value is output to the 595
using the shiftOut function, MSB first. Note: shiftOut operates on bytes only.

Copy Sketch

// Demonstration code for 74HC595 8 bit output


int RCLKPin = 3; // pin 12 on the 74hc595 latch - nSS
int SRCLKPin = 6; // pin 11 on the 74hc595 shift register clock - SCK
int SERPin = 4; // pin 14 on the 74hc595 data - MOSI
unsigned int d; // Data to be sent to the shift reg.
int dir =0; // Direction of walking 1.
char buf[12]; // General purpose buffer.

void setup() {
Serial.begin(9600); // start serial port (debug).

pinMode(RCLKPin, OUTPUT); // Set 595 control PIN sto output.


pinMode(SRCLKPin, OUTPUT);
pinMode(SERPin, OUTPUT);

Serial.println("74HC595 Demo.");

d=1;
BACK TO
} TOP

void loop() { Show Index

Example 2 : 16 LED Walking 1


Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
This example Arduino sketch extends the previous example to to drive two 595s
creating a 16 bit shift register with the 74HC595 and using the outputs for driving
LEDs. Again a walking one is created but this time the code uses an unsigned
integer to store the value allowing 16 bits of output. Note how the shiftOut
function must be used twice to output the 16 bit value (that also has to be split
into 2 pieces using bit shifting since shiftOut can only handle 8 bits of data at a
time ).

Copy Sketch

// Demonstration code for 74HC595 16 bit output


int RCLKPin = 3; // pin 12 on the 74hc595 latch - nSS
int SRCLKPin = 6; // pin 11 on the 74hc595 shift register clock - SCK
int SERPin = 4; // pin 14 on the 74hc595 data - MOSI
unsigned int d; // Data to be sent to the shift reg.
int dir =0; // Direction of walking 1.
char buf[12]; // General purpose buffer.

void setup() {
Serial.begin(9600); // start serial port (debug).

pinMode(RCLKPin, OUTPUT); // Set 595 control PIN sto output.


pinMode(SRCLKPin, OUTPUT);
pinMode(SERPin, OUTPUT);

Serial.println("74HC595 Demo 2xchips for 16 bit register.");

BACK TO
d=1; TOP
}
Show Index
void loop() {

Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Example 3 : 32 bit walking 1 and 2 x 7 segments
This example Arduino sketch extends the previous example keeping the original
operation but now driving 2 seven segment displays as well. Seven segment
displays are just arrangements of LEDs that are used to represent digits. In the
datasheet each LED is assigned a letter in a standard position; These are letters
are 'a' through 'g' and 'dp' (for the decimal point). To make coding easier it is
best to assign 'a'-'g' to b0-b6 of the output and dp to b7. Note to make routing a
pcb easier, you could assign outputs as needed but then the array holding the
conversions value (display digit) would have to be changed.

In this example the "walking one is kept as before" but now to further 8 bit
shiftOut calls are made. Note how everything is shifted right to get it to the lower
8 bits for the shiftOut function.

Note: Even for 32 outputs (or even more) you still only need 3 control
wires!

Copy Sketch

// Demonstration code for 74HC595 16 bit output and 2x7 segment display
int RCLKPin = 3; // pin 12 on the 74hc595 latch - nSS
int SRCLKPin = 6; // pin 11 on the 74hc595 shift register clock - SCK
int SERPin = 4; // pin 14 on the 74hc595 data - MOSI
unsigned long d; // Data to be sent to the shift reg.
int dir,num; // Direction of walking 1, output number.
BACK TO
char buf[12]; // General purpose buffer. TOP

// Define an array to translate number to 7segment Show Index


char segment[10] = { // segment bit pos: dp g f e d c b a
0x3f, // zero

Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
0x06, // one
0x5b, // two
0x4f, // three
0x66, // four
0x6d, // five
0x7c, // six
0x07, // seven
0x7f, // eight
0x67 // nine

74HC595 Arduino library


It is not really worth using an Arduino library for the 74HC595 as shiftout does all
the work required to get the data into the chip. The only extra code you need is
to control the latch output clock (RCLK) before and after using shiftOut.

Arduino library code modules are available but they use shiftOut as does the code
above. So it may not really be worth using them as all you need to do is set RCLK
low, send out the data using shiftOut, then set RCLK high. The library will just
tidy the code a bit. I have also read that the 74HC595 library can not cater for
more than 8 bits - not sure if that is true but if it is, then definitely use the
method shown in the examples in this page.

74HC595 datasheet
BACK TO
Click the image or the link to open the 74HC595 data sheet in a new window. TOP

Show Index

Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
74HC595 as an LED Driver (output
current)
BACK TO
Driving LEDs with the 74HC595 TOP

You can drive LEDs with the 595 but the output current must be kept low (70mA) Show Index
for the whole chip. The following discussion details how to do this and

Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
recommends a reliable current limit resistor value. Note that the LED output
current also depends on the LEDs being driven (see discussion below).

Note: The datasheet does suggests use of the device as a low current
LED driver i.e. limit the max output current for the total "all-on-state" to
70mA (this is the 74HC595 max current for the whole chip!).

Dangers of 'Web' Designs


There are lots of designs on the web using the 74HC595 as a high current LED
driver. The key question is : Should it be used for this at all? Some of these
"designers"? have completely mis-read the data sheet and operate the outputs at
high current. As with all chips you can go beyond the tested limits, and these
limits may be conservative for the device but for a reliable design you do not
want to go against the datasheet because at some point (likely when 100s of
units have been made) units will start to fail - and that can be very expensive to
correct.

Side Note: For instance this instructable [opens in a new window]


states:

"this chip ... can output as much as 70mA per pin";

It does not. The datasheet has been mis-read; The actual value (70mA)
is for the total current through the chip. While the maximum for any pin
is 35mA the total current through the whole chip should not exceed
70mA. BACK TO
TOP

Also note that in that instructable there is a statement that holding the
latch pin low disables the output - rubbish, it does not - all it does is "not Show Index
update the output" - there is no disabling.

Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
The control pin OE disables the output (see here for information on OE).
The actual operation is that a rising edge on the Latch pin clocks the
data to the output.

Warning: Do not believe everything (anything?) in that instructable.

Getting something right by design is more important than testing just a couple of
chips and saying it works! Datasheets show what has been tested to guarantee
operation and long term reliability. Yes, the conditions may be a bit conservative
and less than could be achieved, and yes, the chip may work for a while under
extreme overdrive but it is not worth the risk for a "real" design.

So should you use the 74HC595 as a high current LED driver?

The answer is therefore No (for high current output).; Any electronics designer
reading the datasheet will see that the maximum output current for the whole
chip is 70mA meaning for 8 LED the maximum that can be output for each LED is
70e-3/8=8.75. In fact the Motorola datasheet states ±6mA per output pin (other
datasheets don't state this) - this is probably to allow current for internal FET
operation. The solution is to use boost the output using FETs or Transistors or a
transistor array.

Warning: The maximum current into/out-of the 74HC595 is 70mA


maximum with a 500mW max dissipation - any higher than that then
you are operating the device outside its specification and risk heat
damage to the chip i.e. it may work for a while but then again, it may BACK TO
TOP
fail if driven beyond these limits for a long time.
Show Index

Driving Different LEDs

Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
You can probably get away driving LEDs if either:

1. You don't drive all the LEDs at the same time.


2. Drive different LEDs at different power levels (I limit resistors) observing
max dissipation and max current.
3. Drive LEDs at low current.

When you see a design that uses 330Ω (Rd) resistor in series with and LED
driven by the output of a 595 then the current that should be driven is:

I=(5-1.7)/330 = 10mA, (Vtot - Vdiode) / Rd

Assuming a RED led Vf= 1.7V

Note: Different LEDs have different forward voltage drops (see below).

The following table shows current for a 330Ω current limit resistor with different
LED colours (with a 5V power supply).

Current Current
(mA) (mA)
LED type Vf (V)
( Rd = 330Ω ( Rd = 470Ω
) )

Red LED (standard) forward


1.7 10 7.0
voltage

Red LED (Bright) forward


1.9 9.3 6.5 BACK TO
voltage TOP

Orange / Yellow LED forward Show Index


2.0 9 6.4
voltage

Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Green LED forward voltage 2.1 8.7 6.1

Bright White ~ Blue LED


3.2 ~ 3.6 5.4 ~ 4.2 3.8 ~ 2.9
forward voltage

You can see that those designs are not driving the LEDs at maximum output
(usually 20mA - check each LED datasheet for max. allowed). However on the
bench, with standard LEDs, they look bright enough to me! Also the 7 segment
display looks good at about 7mA (Rd=470Ω) for each red LED segment..

For the 330Ω current limit resistor:

However for 10mA at each output there will be 80mA used which is beyond the
design limit for the 595. The only one that will be in-spec is the Bright White or
Blue LED (5.4 x 8 = ~48mA).

For the 470Ω current limit resistor:

By changing to a 470Ω current limit resistor the corresponding current draw is


reduced and all outputs are within specification of the device 8 x 7mA) = 56mA
(max design output must be below 70mA - see datasheet).

There is a little bit of room to decrease the resistor but the LEDs will be
underpowered. However the question is do you really need maximum brightness?

Conclusion

Probably the best way to go (for long term reliability) is to choose a high
brightness type and adjust the resistor accordingly. However the safe route is to
BACK TO
use 470Ω for all current limit resistors. TOP

Note: This is also why the example circuit shown in the datasheet Show Index
(above) uses current limit resistors of value 560Ω for driving LEDs -

Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
that value seems a bit conservative which is why I used 470Ω which also
allows the total output current to be below 70mA.

More Output Current Drive

Boost current output


The even safer route for this chip, actually the way an electronics designer would
choose if the design could not afford to use a different device, is to boost the
output with a transistor or FET. A logic mosfet will do the job or use a transistor
array (8 to a pack).

High current 595's

Another solution is to use a high current version of the 74HC595. A suitable


version is the TIPC6595 (or TIPC6C595) -which is(are) capable of 250mA
output per pin! - this is a high power shift register. But you are going to find that
it is more expensive than a 595!

Advanced Topics
Data bandwidth
As with all serial interfaces the ultimate outcome is the appearance of data at the
output from end to end. You start off with an 8 bit quantity serialise it and then
reconstruct it at the output. The time taken to do this process is the limiting BACK TO
TOP
factor.
Show Index
If you are only setting indicators or turning slow speed relays on and off, then
this is not an issue, however, if you are doing a more complex operation such as

Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
driving PWM outputs or other high speed operation then the bandwidth is
important (this chip is not the best for PWM - use a dedicated PWM device e.g.
TLC5940 for easy PWM expansion).

if you want to turn on and off the outputs at a specific rate then you can work out
the required operational speed. As an example say you want to go at 100kHz
(turn on an d off an output at 100kHz). When you serialise it the data has to be 8
times faster (plus a bit more for the strobe signal) i.e. ~800kHz. If you had 16
outputs then it would require an update rate of ~1600kHz or ~1.6MHz.

Getting a microcontroller to go at 1.6MHz strobe rate will be impossible (for a


20MHz device it would not be able to do anything else - obviously a very high
speed device could achieve this) but the internal SPI module can typically operate
at 20MHz.

That sounds like I have contradicted myself but I haven't. The internal module
can operate very fast so a burst of serial data can be output very fast. That does
not mean that the slower processor can keep up. This is what determines the
overall data rate i.e. there will be a highs speed burst and then a waiting period
while the processor decides to react to the interrupt generated from the SPI
module. It is the processor speed that determines throughput.

SPI operation
You could use the internal SPI module to output data faster, so that the processor
operation is not consumed by the 595 update. However the limiting factor now
becomes how fast can you update the SPI module and that depends on interrupt
timing and processor speed i.e. what other stuff it is doing. The other limiting BACK TO
factor is the speed of the HC595 (25MHz) as some microcontrollers can operate TOP

faster than this! However 74AHC can go at 100MHz!


Show Index
These are just items to think about when designing this kind of system and are
not investigated further here.

Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
74HC595 OE
What is the (OE) Output Enable for?

In the old, old days of yore, when a high end design consisted of an 8 bit system
(similar to an 8 bit microcontroller) the only design technique was to buy
individual components such as:

A processor e.g. a Z80.


EPROM - Erasable Programmable Read Only Memory.
RAM (requiring refresh).
An ADC.
...plus more devices as needed.

Each of the above chips is a separate, individual device and the question was:

How do I connect these things together to make a functioning system?

The answer is that each device has an 8 bit bus, so that bus had to be used to
transfer data around the system.

The next question is:

If the EPROM is constantly outputting data, how do I get the ADC to output
data to the processor instead?

The answer is that you have to be able to turn off the output at a specific time (a
set period in the processor instruction cycle) e.g. during a processor read
operation the relevant device needs to be activated. The processor will have a
BACK TO
dedicated read signal output usually labeled active low RD. Note a similar signal TOP
is used for write nWR.
Show Index
You do that by setting all output enables of all other devices high (output is
inactive) so that all other devices are not driving the bus and then you pull the

Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
ADC output enable low, so that only the ADC drives the bus - in this way the
processor can read the ADC output when it wants to.

Note: All the above components are now inside a microchip but the
same design process is used to enable each individual unit to access the
(internal) bus. It is just that now you do not need to think about it i.e. it
is hidden.

Note: If you want to really understand processor operation try looking


at an old chip design (there are people who are designing with them as a
hobby) e.g. a Z80, 6502 or 68000 etc. will show you how it is done -
look for a chip select device (unless the processor has chip select
outputs) e.g. 74LS138 that enables each unit.

So OE is a legacy from that design process. The advantage was that you could
keep on adding devices to the main bus (within the fan out limitation of the
processor) as long as you could control the output enable of the device. That is
why there is an OE control pin in the 74HC595.

TIP: One unusual idea I have seen on the web for making use of the OE control
input is as a current output controller i.e. a dimmer (if using the outputs as LED
drivers). All you do is feed in a PWM signal to the OE input and voila, instant
dimmability (of course this affects all the outputs of the 74HC595 at once).

Like 18 people like this. Sign Up to see what your friends BACK TO
like. TOP

New! Comments Show Index

Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Have your say about what you just read! Leave me a comment in the box
below.

14 Comments Sort by Oldest

Add a comment...

Sree Sreedhara
sir, iam student pls post me regarding pic microcintroller basics
Like · Reply · 3y

John Main
Hi Sree, Thanks for commenting here. As I develop projects etc
I notify you of them via email so jst sign up using the forms on
any page.
Like · Reply · 2 · 3y

Abdul Majid Bhatti


nice tutorial
Like · Reply · 3y

John Main
Hi Abdul, Glad you like it. Thanks
Like · Reply · 3y

Aec Shammu
BACK TO
I want to learn how could interface a pic sirial port with usb port. TOP

Like · Reply · 2y
Show Index
John Main
Hi Aec, The easier way is to use a PIC with a built in USB
hardware module e g 18F2550 or 18F4550 These have built in
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
hardware module e.g. 18F2550 or 18F4550. These have built in
support for USB. It is jst a matter of setting up the code in the
PIC - following the datasheet. When you do this the PIC device
looks just like another serial port in the Windows software - you
set the baud rate in the PIC and match that in the Windows
terminal program. Then you can transfer serial data to/from the
PC and PIC.

The alternative way is to use that common FTDI chip -FT232RL


seems to be the most commonly used one. This allows any
microcontroller to access USB as long as it has a UART inside.
Like · Reply · 1 · 2y

Alvin Peter Schmitt


I copied your LCD guide to a documentation file for later access if that is
OK?
Like · Reply · 2y

Sarath Chandrasena
Excellent Article, Good Job, Keep It Up and Condrat's.
Like · Reply · 2y

Load 9 more comments

Facebook Comments Plugin

BACK TO
TOP

Privacy Policy | Contact | About Me


Show Index

Site Map | Terms of Use

Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Copyright © 2005-2020 Best-Microcontroller-Projects
All Rights Reserved.
No reproduction without permission.

BACK TO
TOP

Show Index

Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD

You might also like