Dear Charu,
It is important to know how you have hooked up your 74HC595 to your displays. With the OE (Pin 13) tied to ground and the RESET(Pin 10) tied to the VDD. You should be dealing with at least 3 pins , Shift_Clock (Pin 11), Serial Data In (Pin 14) and Latch (Pin 12) hooked to your PIC. If you have multiple digits each driven by a 74HC595 then Pin9 from the first one goes to PIN 14 of the second and so on. Thus you share the Clock and the Latch of all thems in common. Normally you would hookup the Q0to Q7 outputs of the shift register to the seven segment --> dp,G,F,E,D,C,B,A . This is so because the bit you stuff in first goes to the last (shifted as supposed to be)
Now for some code examples:
Lets assume S_CLK is an alias for the clock line, S_DAT is an alias for the Serial Data line and S_LAT is an alias for the Latch Line.
Also let the characters to load for each display is DISP1, DISP2, and so on.
Please note that you would need a lookup table to convert binary values into proper segment data before dumping.
This could be done in modular way using FOR-NEXT loop. But if you are using an array for your display data then PBP does not support modifiers likeCode:S_DAT= 0 : S_CLK= 0 : S_LAT= 0 ' MAKE SURE THE CONTROL LINES ARE LOW S_DAT = DISP4.0 : S_CLK=1:S_CLK = 0 ' PUSH THE FIRST BIT S_DAT = DISP4.1 : S_CLK=1:S_CLK = 0 ' PUSH NEXT S_DAT = DISP4.1 : S_CLK=1:S_CLK = 0 ' PUSH NEXT " " " " ' REPEAT FOR OTHER DISPLAY DATA AS WELL S_LAT = 1 : S_DAT = 0 : S_LAT = 0 ' LATCH THE DATA ON THE 595
S_DAT = DISP[0].I
But it can be done by dumping it to a temporary variable.
Hope this helps.
I have used 595s in moving display app and cascades 24 of them. PCB layout and some sort of slew rate control, shared line drive and termination may be necessary if it is a long chain. For such app consider using STP16C596.




Bookmarks