Help using shift register STP16DPS05.

Discussion about the ZBasic language including the System Library. If you're not sure where to post your message, do it here. However, do not make test posts here; that's the purpose of the Sandbox.
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Post by dkinzer »

FFMan wrote:I still can't get this to function at all.
I suspect that you may have overlooked pin 23. It is described as "Input terminal of an external resistor for constant current programing" and it sets the value of the constant current for the output drivers. I believe that if you select this resistor correctly you can connect your LEDs directly from the outputs of the driver chip to the LED supply voltage. In my testing, I connected sixteen 330 ohm resistors from the outputs to +5V and connected a 1K ohm resistor from pin 23 to ground. According to the datasheet (Figure 11) the 1K resistance should set the output current to approximately 20mA.

With that setup, the following code produced the expected outputs:

Code: Select all

Const lePin as Byte = 13
Const dataPin as Byte = 12
Const clkPin as Byte = 11

Sub Main()
    Call PutPin(dataPin, 0)
    Call PutPin(clkPin, 0)
    Call PutPin(lePin, 0)
    Call ShiftOutEx(dataPin, clkPin, 16, &Hf0f0, &H01)
    Call PutPin(lePin, zxOutputPulse)
End Sub
Note that, contrary to what the datasheet suggests, no 17th clock pulse is needed. Instead, the pulsing of the LE pin causes the output register to be updated.

Also, you can just tie the LE input high but the output will "ripple" into place whereas a pulse on LE after the data is output will cause the outputs to change to the desired state at once.
- Don Kinzer
FFMan
Posts: 502
Joined: 09 January 2010, 12:52 PM

Post by FFMan »

thanks don.

I have a resistor on r-ext which is giving 11ma to each led

I did manage to get this mostly working in the end. I used pulseout instead of bit bang and it came alive. I struggled to get every pin controllable, in the end settling for 15 of the 16, the first one not being used which was fine for what I wanted.

I discovered the 17th pulse wasn't required by experimentation.

Is it me or is the datasheet not that great. Perhaps it makes complete sense to electronic engineers.
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Post by dkinzer »

FFMan wrote:Is it me or is the datasheet not that great.
The datasheet is not well written. Some important details are omitted (or still elude me) and some things, like the timing diagram, are quite misleading.
- Don Kinzer
FFMan
Posts: 502
Joined: 09 January 2010, 12:52 PM

Post by FFMan »

it surprises me that companies go to the effort of designing and producing chips, and then follow up with unhelpful (at best), or even misleading data sheets.

oh well - its working now with 15 leds and that's fine.

thanks for your help
Post Reply