Shop OBEX P1 Docs P2 Docs Learn Events
Basic Stamp 2 and TPIC6B595 - Serial to Parallel Problem — Parallax Forums

Basic Stamp 2 and TPIC6B595 - Serial to Parallel Problem

I am trying to use a TPIC6B595 Serial to Parallel chip with a basic Stamp 2 - - I want the higher power - - I am using the 74HC595 chip in a previous project and they are working fine. I took the code from the earlier 74HC595 project and and things are not working - I have looked in the forum and the two chips seem to use the same logic (the TPIC6B595 sinks current and I think I accounted for that)

I am trying to blink the yellow LED as proof of concept before going on. The two red LED's in the picture but not the wiring diagram are to show that the logic is blinking. When I touch a jumper from VSS to the leg of the LED the yellow LED lights up so I think I have the polarity correct.

In looking around I did not find any big flags on the TPIC6B595 so I figure I am missing something simple

Any help is greatly appreciated - Thanks much in advance

Sorry for the mess with the code - I also see to have missed something with code posting - if someone can point me to some better instructions it will be much appreciated


tpic6b595-sketch-b.jpg

tpic6b595-board-b.jpg

TPIC6B595 Data Sheet
https://saildude.files.wordpress.com/2016/10/tpic6b595-ser-parallel-high-power.pdf

75HC595 Data Sheet
https://saildude.files.wordpress.com/2016/10/74hc595-datasheet.pdf


<pre>
'
' {$STAMP BS2} ATON Light Timer - High Power Test
' {$PBASIC 2.5}
'
' High Power Ser Parallel Test
'
' Output expander variables
'
Clock PIN 0 ' shift clock (74HC595.11)(TPIC6B595.13 - SRCK )
SerData PIN 1 ' serial data (74HC595.14)(TPIC6B595.03 - SER IN )
Latch PIN 2 ' output latch (74HC595.12)(TPIC6B595.08 - SRCLR )

' Counters for lights

Alki_LH VAR Byte ' Aton1.BIT0
QF_Quick_Flash VAR Nib ' Aton1.BIT1 Old Outfall_Line & Lower_Range_LT
VTS_T VAR Byte
Six_Seconds VAR Byte ' Old Restoration_PT & Upper_Range_LT


' Serial Output Words

Aton1 VAR Byte ' Output Byte word - for serial output


DIRH = 255 ' pins 8 TO 15 HIGH Byte all outputs

' -- Initialization --

LOW Latch ' make output and low

' Aton1 Word Counters

Alki_LH = 1 ' ATON1 Bit 0
QF_Quick_Flash = 1 ' ATON1 Bit 1
VTS_T = 1 ' ATON1 Bit 2
Six_Seconds = 1 ' ATON1 Bit 3



DO ' Start Main Loop

PAUSE 70 ' Target 0.1 sec delay for timer pulse

OUT8 = Aton1.BIT1 ' Flasher on Stamp Board show program is running
OUT9 = Aton1.BIT0 ' Alki Light


' ATON1 Word +++++++++++++++++++++++++++++++++++++++++++++

' Alki Lighthouse - 5 second light 1 sec on / 4 sec off

IF ( Alki_LH <= 40 ) THEN Aton1.BIT0 = 0 ELSE Aton1.BIT0 = 1


IF ( QF_Quick_Flash <= 5 ) THEN Aton1.BIT1 = 0 ELSE Aton1.BIT1 = 1

' 2.5s light VTS "T" @ Alki Point

IF ( VTS_T <= 18 ) THEN Aton1.BIT2 = 0 ELSE Aton1.BIT2 = 1

' Restoration Point - 6s light - Red

IF ( Six_Seconds <= 50 ) THEN Aton1.BIT3 = 0 ELSE Aton1.BIT3 = 1



' Index Counters - put at end so first scan will be at initilized Values

' ATON1 Word and Counters

Alki_LH = Alki_LH + 1
QF_Quick_Flash = QF_Quick_Flash + 1
VTS_T = VTS_T + 1
Six_Seconds = Six_Seconds + 1


' DEBUG ? Six_Seconds
' DEBUG ? Alki_LH

' Aton1 = 255 'try setting all bits HIGH

' DEBUG ? Aton1.BIT0
' DEBUG ? Aton1.BIT3
' DEBUG ? Aton1

' Reset Counters

' ATON1 Word Counters Reset

IF ( Alki_LH > 50 ) THEN Alki_LH = 1
IF ( QF_Quick_Flash > 10 ) THEN QF_Quick_Flash = 1
IF ( VTS_T > 25 ) THEN VTS_T = 1
IF ( Six_Seconds > 60 ) THEN Six_Seconds = 1


GOSUB Out_595 ' put Aton1 - 74HC595 chip 1


LOOP ' End Main Program

' -- [ Subroutines ] --

Out_595:

SHIFTOUT SerData, Clock, MSBFIRST, [Aton1] ' send pattern to (74HC595.1)
PULSOUT Latch, 5 ' latch outputs
RETURN

</pre>


Comments

  • kwinnkwinn Posts: 8,697
    You need to toggle the RCK (pin 12) (low, high, low) to transfer the data from the serial shift register to the output register.
  • Thanks much, works now
    Moved PIN2 from the Stamp to Pin 12 RCK on the TPIC6B595 - looking at the timing diagram seems real obvious in hind sight

    I did find a wiring error
    Pin 8 SRCLR (with a bar over it) needs to be held high VDD to work

    The revised wiring diagram is below


    tpic6b595-sketch-c-revised.jpg

    Also in looking at the timing diagram, I don't fully understand it but Pin 9 G (with a bar over it) seems to need to be held low VSS to work reliably

    Thanks again for the quick help - now to the rest of the design and the mechanical part
  • jmgjmg Posts: 15,145
    Saildude wrote: »
    I don't fully understand it but Pin 9 G (with a bar over it) seems to need to be held low VSS to work reliably
    Yup : /G is the /OE on this part, Low to Enable N-FET's. High to float all the outputs.

  • Thanks much

    I think I think I am observing forward progress, but a bit slow.
    Different than I was used to at work, Slowly working through the What's a Microcontroller text - starting at page 1 including all the help file stuff - also working on the design that will use these chips - so sort of two levels
  • kwinnkwinn Posts: 8,697
    Saildude wrote: »
    Thanks much, works now
    Moved PIN2 from the Stamp to Pin 12 RCK on the TPIC6B595 - looking at the timing diagram seems real obvious in hind sight

    You're welcome. Pretty much everything looks obvious in hindsight. That "doh" moment one gets with that hindsight is part of the cost of learning new things.
    I did find a wiring error
    Pin 8 SRCLR (with a bar over it) needs to be held high VDD to work ......

    Also in looking at the timing diagram, I don't fully understand it but Pin 9 G (with a bar over it) seems to need to be held low VSS to work reliably...

    /SRCLR (or SRCLR with a bar over it) is the Serial Register CLeaR signal so as long as it is low all the bits in the serial register will be low.

    /G (or G with a bar over it) is the Gate signal so as long as it is low all the output drivers will be turned off.

    Any signal with a bar over it or a / in front of it is a "low true" signal. The / was used extensively when we were stuck with plain ascii text. Now that we have these fancy WYSIWYG word processors and graphic displays we see the bar above more often than the /.
  • Thanks again for the extra help and the tutorial - greatly appreciated - board and chip level stuff is all new to me
Sign In or Register to comment.