Log In: Using 74HC595 To Expand Output Pins of A PIC Microcontroller: Assembly Code
Log In: Using 74HC595 To Expand Output Pins of A PIC Microcontroller: Assembly Code
Log In: Using 74HC595 To Expand Output Pins of A PIC Microcontroller: Assembly Code
LOG IN
Welcome to EDAboard.com
Register Log in
papunblg' s Blo g
This is act ually a cont inuat ion of my blog ent ry ht t ps://www.edaboard.com/blog/1628/ where I have used C
language rout ine. Now it s t he t ime t o use Assembly Language for PIC. The Code is t est ed on PIC16F84A wit h 4MHz
cryst al. Compiler used MCS-51 under M-IDE St udio.
The associat ed program shows how t o t ransfer a byt e dat a serially t o t he 74HC595 and t hen set s t he out put
accordingly.
According t o page 5 of Dat asheet , t he out put s of 74HC595 provide 8 mA. Though I have used 330E resist ors t o
drive LEDs , t his should not be done! It is t herefore recommended t o connect a higher resist ance (620E). LEDs light
up very, very lit t le, but enough t o t est t he circuit .
I will mainly cover t he t echnical det ails t o connect a 74HC595 wit h a microcont roller. I will avoid t he t heory of a
shift regist er and all t hose t heoret ical det ails.
The dat a are t ransferred int o t he shift regist er 74HC595 pin t hrough t he PIN 14 (Serial dat e).
PIN 11 (Shift regist er clock). Once finished sending dat a, just bring a high level on t he pin 12 (St orage Clock or Lat ch)
t o t ransfer dat a from t he shift regist er t o t he lat ch. The pin 13 (Out put Enable - act ive low) enables t he t ransfer of
dat a from t he lat ch t o t he out put port s when it is brought low: since we connect ed t he drive pin t o ground, t hey
meet again on t he dat a out put s as soon as we give t he shot clock on t he lat ch. The pin 10 is t he mast er reset :
placing it at a low level reset s t he cont ent s of t he shift regist er, for which we keep it up for safet y. The pin 9 we
keep it disconnect ed because it is not used in t his applicat ion.
You can use any microcont roller but be careful, in case of open collect or pins, add pull up resist ors.
Code - [expand]
Code - [expand]
1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2 ;;;;;;;;;;;;;;;;;;;;;;;;;;;HC595.inc;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;
3 ;Thanks to Nebojsa Matic of mikroElektronika for idea
4 ;Var variable whose contents is transferred to outputs of shift register.
5 ;Var1 loop counter
6 ;Here 8bit data is used, so VAR1 gets decimal 8 to continue the loop for 8 times
7
8 HC595 MACRO VAR,VAR1
9
10 LOCAL LOOP
11 MOVLW .8
12 MOVWF VAR1
13 LOOP
14
15 RLF VAR,F
16 BTFSS STATUS,C
17 BCF DATA1
18 BTFSC STATUS,C
19 BSF DATA1
20
21 BSF CLOCK
22 NOP
23 BCF CLOCK
24
25 DECFSZ VAR1,F
26 GOTO LOOP
27
28 BSF LATCH
29 NOP
30 BCF LATCH
31
32 ENDM
Share:
Comments
Part Search
Author: papunblg
Views: 383
Last update: Apr 14, 2012
N
[Debug][Keil][STM32CubeIDE] How t o debug Keil's STM32 project in STM32CubeIDE?
The background: I have found a way to debug a Keil's project using...
N
[Debug][Keil][VSCode] How t o debug Keil's STM32 project in VSCode?
Assumptions: STM32CubeIDE needs to be installed. At the time of...
N
[Keil][STM32CubeIDE] Keil int egrat ion int o STM32CubeIDE
The background: I have to use Keil in my job and honestly - I don't...
ADC Conversion Clock Select bit set t ing for PIC16F87XA, 18F2x2, 18F4x microcont roller
There is a fact to mention about the resolution of the A/D converter...
Display t emperat ure on LCD 16x2 display using LM35 and Pic16F876A
Code to display temperature on LCD 16x2 display using LM35 and...
[URL="https://www.edaboard.com/blog/using-74hc595-to-expand-output-pins-of-a-pic-microcontroller-assembly-code.1629/"]Using
[UBS=entry, 1629][/UBS]
papunblg' s Blo g
Co nne ct with us
Online statistics
Members o nline: 9
Fo rum statistics
Threads: 376,232
Messages: 1,649,681
Members: 593,226
What's ne w
New po sts
Latest activity