<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	>
<channel>
	<title>
	Comments on: How to use 74hc595 Shift Register with Raspberry PI Pico and MicroPython	</title>
	<atom:link href="https://peppe8o.com/how-to-use-74hc595-shift-register-with-raspberry-pi-pico-and-micropython/feed/" rel="self" type="application/rss+xml" />
	<link>https://peppe8o.com/how-to-use-74hc595-shift-register-with-raspberry-pi-pico-and-micropython/</link>
	<description>Raspberry PI, Arduino and Electronics made simple</description>
	<lastBuildDate>Tue, 03 Sep 2024 19:38:01 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>
		By: peppe8o		</title>
		<link>https://peppe8o.com/how-to-use-74hc595-shift-register-with-raspberry-pi-pico-and-micropython/#comment-31904</link>

		<dc:creator><![CDATA[peppe8o]]></dc:creator>
		<pubDate>Fri, 19 Jul 2024 14:55:29 +0000</pubDate>
		<guid isPermaLink="false">https://peppe8o.com/?p=5000#comment-31904</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://peppe8o.com/how-to-use-74hc595-shift-register-with-raspberry-pi-pico-and-micropython/#comment-31823&quot;&gt;Jean-Pierre Mommens&lt;/a&gt;.

Thank you for your feedback, Jean-Pierre. Please send me the pictures of your project if you want to share it with peppe8o&#039;s readers ;)]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://peppe8o.com/how-to-use-74hc595-shift-register-with-raspberry-pi-pico-and-micropython/#comment-31823">Jean-Pierre Mommens</a>.</p>
<p>Thank you for your feedback, Jean-Pierre. Please send me the pictures of your project if you want to share it with peppe8o&#8217;s readers 😉</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Jean-Pierre Mommens		</title>
		<link>https://peppe8o.com/how-to-use-74hc595-shift-register-with-raspberry-pi-pico-and-micropython/#comment-31823</link>

		<dc:creator><![CDATA[Jean-Pierre Mommens]]></dc:creator>
		<pubDate>Wed, 17 Jul 2024 07:42:24 +0000</pubDate>
		<guid isPermaLink="false">https://peppe8o.com/?p=5000#comment-31823</guid>

					<description><![CDATA[Thank you for your good idea. I use it in a python script to illuminate colored LEDS 20000lux (20mA) and it&#039;s OK.

To simplify I create a library file. I don&#039;t think it&#039;s necessary to give data, clock and latch as arguments during the update.


The library in a file lib74HC595.py

from machine import Pin
import utime

class 74HC595:
    &#039;&#039;&#039;
    Classe class_74HC595
    8-bit serial-in/serial or parallel-out shift register with output latches; 3-state

    &#039;&#039;&#039;
    #
    # 
    #
    def __init__(self, dataPin, latchPin, clockPin): # 
        &#039;&#039;&#039;
        Constructeur :
        
        On y défini les trois signaux de commande du shift register
        &#039;&#039;&#039;
        self.dataPIN = Pin(dataPin, Pin.OUT)
        self.latchPIN = Pin(latchPin, Pin.OUT)
        self.clockPIN = Pin(clockPin, Pin.OUT)

    def update(self, input):
        &#039;&#039;&#039;
        Mise à jour du shift register selon les data dans input

        &#039;&#039;&#039;
        #put latch down to start data sending
        self.clockPIN.value(0)
        self.latchPIN.value(0)
        self.clockPIN.value(1)
  
        #load data in reverse order
        for i in range(7, -1, -1):
            self.clockPIN.value(0)
            self.dataPIN.value(int(input[i]))
            self.clockPIN.value(1)

        #put latch up to store data on register
        self.clocPINk.value(0)
        self.latchPIN.value(1)
        self.clockPIN.value(1)


Usage in script Raspberry Pico

from lib74HC595 import class_74HC595

..

    # Instantiation d&#039;un objet de type 74HC595
    shiftRegister = class_74HC595(dataPin, latchPin, clockPin)
    
    # Initialisation (Le shitRegister est en mode Common Anode, Inversion)
    bit_string=&quot;11111111&quot;
    shiftRegister.update(bit_string)
    
... later

    bit_string=&quot;00000000&quot;

    while True:
        update(bit_string)
        bit_string = str(random.randint(0, 1))+bit_string[:-1]
        utime.sleep(0.3)]]></description>
			<content:encoded><![CDATA[<p>Thank you for your good idea. I use it in a python script to illuminate colored LEDS 20000lux (20mA) and it&#8217;s OK.</p>
<p>To simplify I create a library file. I don&#8217;t think it&#8217;s necessary to give data, clock and latch as arguments during the update.</p>
<p>The library in a file lib74HC595.py</p>
<p>from machine import Pin<br />
import utime</p>
<p>class 74HC595:<br />
    &#8221;&#8217;<br />
    Classe class_74HC595<br />
    8-bit serial-in/serial or parallel-out shift register with output latches; 3-state</p>
<p>    &#8221;&#8217;<br />
    #<br />
    #<br />
    #<br />
    def __init__(self, dataPin, latchPin, clockPin): #<br />
        &#8221;&#8217;<br />
        Constructeur :</p>
<p>        On y défini les trois signaux de commande du shift register<br />
        &#8221;&#8217;<br />
        self.dataPIN = Pin(dataPin, Pin.OUT)<br />
        self.latchPIN = Pin(latchPin, Pin.OUT)<br />
        self.clockPIN = Pin(clockPin, Pin.OUT)</p>
<p>    def update(self, input):<br />
        &#8221;&#8217;<br />
        Mise à jour du shift register selon les data dans input</p>
<p>        &#8221;&#8217;<br />
        #put latch down to start data sending<br />
        self.clockPIN.value(0)<br />
        self.latchPIN.value(0)<br />
        self.clockPIN.value(1)</p>
<p>        #load data in reverse order<br />
        for i in range(7, -1, -1):<br />
            self.clockPIN.value(0)<br />
            self.dataPIN.value(int(input[i]))<br />
            self.clockPIN.value(1)</p>
<p>        #put latch up to store data on register<br />
        self.clocPINk.value(0)<br />
        self.latchPIN.value(1)<br />
        self.clockPIN.value(1)</p>
<p>Usage in script Raspberry Pico</p>
<p>from lib74HC595 import class_74HC595</p>
<p>..</p>
<p>    # Instantiation d&#8217;un objet de type 74HC595<br />
    shiftRegister = class_74HC595(dataPin, latchPin, clockPin)</p>
<p>    # Initialisation (Le shitRegister est en mode Common Anode, Inversion)<br />
    bit_string=&#8221;11111111&#8243;<br />
    shiftRegister.update(bit_string)</p>
<p>&#8230; later</p>
<p>    bit_string=&#8221;00000000&#8243;</p>
<p>    while True:<br />
        update(bit_string)<br />
        bit_string = str(random.randint(0, 1))+bit_string[:-1]<br />
        utime.sleep(0.3)</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: peppe8o		</title>
		<link>https://peppe8o.com/how-to-use-74hc595-shift-register-with-raspberry-pi-pico-and-micropython/#comment-26010</link>

		<dc:creator><![CDATA[peppe8o]]></dc:creator>
		<pubDate>Sun, 03 Mar 2024 18:57:45 +0000</pubDate>
		<guid isPermaLink="false">https://peppe8o.com/?p=5000#comment-26010</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://peppe8o.com/how-to-use-74hc595-shift-register-with-raspberry-pi-pico-and-micropython/#comment-25969&quot;&gt;David&lt;/a&gt;.

Thank you for your feedback and for the proposed code alternative, David!]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://peppe8o.com/how-to-use-74hc595-shift-register-with-raspberry-pi-pico-and-micropython/#comment-25969">David</a>.</p>
<p>Thank you for your feedback and for the proposed code alternative, David!</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: David		</title>
		<link>https://peppe8o.com/how-to-use-74hc595-shift-register-with-raspberry-pi-pico-and-micropython/#comment-25969</link>

		<dc:creator><![CDATA[David]]></dc:creator>
		<pubDate>Sat, 02 Mar 2024 17:23:39 +0000</pubDate>
		<guid isPermaLink="false">https://peppe8o.com/?p=5000#comment-25969</guid>

					<description><![CDATA[I modified the code so that it uses 16 LEDs/2 shift registers and uses a virtual timer to control the animation. This way you can keep control of the REPL. I also changed it so that it uses the default SPI pins on the Pi Pico. The code isn&#039;t all that different.

**********************************************

from machine import Pin, Timer
import random

#define PINs according to cabling
dataPIN = 19
latchPIN = 17
clockPIN = 18

#set pins to output PIN objects
dataPIN=Pin(dataPIN, Pin.OUT)
latchPIN=Pin(latchPIN, Pin.OUT)
clockPIN=Pin(clockPIN, Pin.OUT)

bit_string=&quot;0000000000000000&quot;

#define shift register update function
def shift_update(tim):

    # get the previously defined global values.
    global bit_string
    global dataPIN
    global clockPIN
    global latchPIN

    #put latch down to start data sending
    clockPIN.value(0)
    latchPIN.value(0)
    clockPIN.value(1)
  
    #load data in reverse order
    for i in range(15, -1, -1):
        clockPIN.value(0)
        dataPIN.value(int(bit_string[i]))
        clockPIN.value(1)

    #put latch up to store data on register
    clockPIN.value(0)
    latchPIN.value(1)
    clockPIN.value(1)

    bit_string = str(random.randint(0, 1))+bit_string[:-1]

def main():

    #start the timer, calling shift register function as a callback
    Timer(-1).init(period=100, mode=Timer.PERIODIC, callback=shift_update)
    
if __name__==&quot;__main__&quot;:
    main()]]></description>
			<content:encoded><![CDATA[<p>I modified the code so that it uses 16 LEDs/2 shift registers and uses a virtual timer to control the animation. This way you can keep control of the REPL. I also changed it so that it uses the default SPI pins on the Pi Pico. The code isn&#8217;t all that different.</p>
<p>**********************************************</p>
<p>from machine import Pin, Timer<br />
import random</p>
<p>#define PINs according to cabling<br />
dataPIN = 19<br />
latchPIN = 17<br />
clockPIN = 18</p>
<p>#set pins to output PIN objects<br />
dataPIN=Pin(dataPIN, Pin.OUT)<br />
latchPIN=Pin(latchPIN, Pin.OUT)<br />
clockPIN=Pin(clockPIN, Pin.OUT)</p>
<p>bit_string=&#8221;0000000000000000&#8243;</p>
<p>#define shift register update function<br />
def shift_update(tim):</p>
<p>    # get the previously defined global values.<br />
    global bit_string<br />
    global dataPIN<br />
    global clockPIN<br />
    global latchPIN</p>
<p>    #put latch down to start data sending<br />
    clockPIN.value(0)<br />
    latchPIN.value(0)<br />
    clockPIN.value(1)</p>
<p>    #load data in reverse order<br />
    for i in range(15, -1, -1):<br />
        clockPIN.value(0)<br />
        dataPIN.value(int(bit_string[i]))<br />
        clockPIN.value(1)</p>
<p>    #put latch up to store data on register<br />
    clockPIN.value(0)<br />
    latchPIN.value(1)<br />
    clockPIN.value(1)</p>
<p>    bit_string = str(random.randint(0, 1))+bit_string[:-1]</p>
<p>def main():</p>
<p>    #start the timer, calling shift register function as a callback<br />
    Timer(-1).init(period=100, mode=Timer.PERIODIC, callback=shift_update)</p>
<p>if __name__==&#8221;__main__&#8221;:<br />
    main()</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: peppe8o		</title>
		<link>https://peppe8o.com/how-to-use-74hc595-shift-register-with-raspberry-pi-pico-and-micropython/#comment-24094</link>

		<dc:creator><![CDATA[peppe8o]]></dc:creator>
		<pubDate>Thu, 01 Feb 2024 06:40:15 +0000</pubDate>
		<guid isPermaLink="false">https://peppe8o.com/?p=5000#comment-24094</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://peppe8o.com/how-to-use-74hc595-shift-register-with-raspberry-pi-pico-and-micropython/#comment-23976&quot;&gt;Oleksii&lt;/a&gt;.

Please, can you send me a photo of your wiring? Send it to my email address: giuseppe@peppe8o.com]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://peppe8o.com/how-to-use-74hc595-shift-register-with-raspberry-pi-pico-and-micropython/#comment-23976">Oleksii</a>.</p>
<p>Please, can you send me a photo of your wiring? Send it to my email address: <a href="mailto:giuseppe@peppe8o.com">giuseppe@peppe8o.com</a></p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Oleksii		</title>
		<link>https://peppe8o.com/how-to-use-74hc595-shift-register-with-raspberry-pi-pico-and-micropython/#comment-23976</link>

		<dc:creator><![CDATA[Oleksii]]></dc:creator>
		<pubDate>Mon, 29 Jan 2024 07:42:49 +0000</pubDate>
		<guid isPermaLink="false">https://peppe8o.com/?p=5000#comment-23976</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://peppe8o.com/how-to-use-74hc595-shift-register-with-raspberry-pi-pico-and-micropython/#comment-23974&quot;&gt;peppe8o&lt;/a&gt;.

Yeah, I thought it could be power, so replaced Pico with buttons, and attached 5V source. Clicking the buttons I can make diods blinking, still situation is the same... It works only when any 7 of them are connected (except q0)... I think this 74hc595 can be just broken]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://peppe8o.com/how-to-use-74hc595-shift-register-with-raspberry-pi-pico-and-micropython/#comment-23974">peppe8o</a>.</p>
<p>Yeah, I thought it could be power, so replaced Pico with buttons, and attached 5V source. Clicking the buttons I can make diods blinking, still situation is the same&#8230; It works only when any 7 of them are connected (except q0)&#8230; I think this 74hc595 can be just broken</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: peppe8o		</title>
		<link>https://peppe8o.com/how-to-use-74hc595-shift-register-with-raspberry-pi-pico-and-micropython/#comment-23974</link>

		<dc:creator><![CDATA[peppe8o]]></dc:creator>
		<pubDate>Mon, 29 Jan 2024 05:41:19 +0000</pubDate>
		<guid isPermaLink="false">https://peppe8o.com/?p=5000#comment-23974</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://peppe8o.com/how-to-use-74hc595-shift-register-with-raspberry-pi-pico-and-micropython/#comment-23955&quot;&gt;Oleksii&lt;/a&gt;.

It seems to me that the power passed to the Pico may not be enough in your case. Try changing the power source]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://peppe8o.com/how-to-use-74hc595-shift-register-with-raspberry-pi-pico-and-micropython/#comment-23955">Oleksii</a>.</p>
<p>It seems to me that the power passed to the Pico may not be enough in your case. Try changing the power source</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Oleksii		</title>
		<link>https://peppe8o.com/how-to-use-74hc595-shift-register-with-raspberry-pi-pico-and-micropython/#comment-23955</link>

		<dc:creator><![CDATA[Oleksii]]></dc:creator>
		<pubDate>Sun, 28 Jan 2024 21:16:55 +0000</pubDate>
		<guid isPermaLink="false">https://peppe8o.com/?p=5000#comment-23955</guid>

					<description><![CDATA[I&#039;ve made the same circuit and trying to make it work, but it behaves really strange. Only led connected to Q0 lights up. When I remove any other led (just connecting using resistor), all start working properly (just without that disconnected led). 
Any ideas what am I doing wrong? Thank you.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve made the same circuit and trying to make it work, but it behaves really strange. Only led connected to Q0 lights up. When I remove any other led (just connecting using resistor), all start working properly (just without that disconnected led).<br />
Any ideas what am I doing wrong? Thank you.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: GioH		</title>
		<link>https://peppe8o.com/how-to-use-74hc595-shift-register-with-raspberry-pi-pico-and-micropython/#comment-9688</link>

		<dc:creator><![CDATA[GioH]]></dc:creator>
		<pubDate>Tue, 11 Jan 2022 23:11:39 +0000</pubDate>
		<guid isPermaLink="false">https://peppe8o.com/?p=5000#comment-9688</guid>

					<description><![CDATA[Thanks a lot peppe8o.  Works like a charm... thanks for help.]]></description>
			<content:encoded><![CDATA[<p>Thanks a lot peppe8o.  Works like a charm&#8230; thanks for help.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: peppe8o		</title>
		<link>https://peppe8o.com/how-to-use-74hc595-shift-register-with-raspberry-pi-pico-and-micropython/#comment-9626</link>

		<dc:creator><![CDATA[peppe8o]]></dc:creator>
		<pubDate>Sat, 08 Jan 2022 05:54:35 +0000</pubDate>
		<guid isPermaLink="false">https://peppe8o.com/?p=5000#comment-9626</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://peppe8o.com/how-to-use-74hc595-shift-register-with-raspberry-pi-pico-and-micropython/#comment-9621&quot;&gt;GioH&lt;/a&gt;.

Hi GioH.
To manage multiple Shift registers, you can put them in serial connection or in parallel.
In serial connection, you attach the serialout of first SR to data of second and so on. Latch for allow SR are connected together, same forclock. You can use my code, running it as times as the number of connected SR:at the first update you load data for last SR, then you update data for the prev one and so in up to the first.
Parallel configuration require one GP for each data, while clock and latch are still together. In this case you need to change my code.
For quite all project, the serial configuration is the best option as the SR are so fast that user will never see intermediate effects]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://peppe8o.com/how-to-use-74hc595-shift-register-with-raspberry-pi-pico-and-micropython/#comment-9621">GioH</a>.</p>
<p>Hi GioH.<br />
To manage multiple Shift registers, you can put them in serial connection or in parallel.<br />
In serial connection, you attach the serialout of first SR to data of second and so on. Latch for allow SR are connected together, same forclock. You can use my code, running it as times as the number of connected SR:at the first update you load data for last SR, then you update data for the prev one and so in up to the first.<br />
Parallel configuration require one GP for each data, while clock and latch are still together. In this case you need to change my code.<br />
For quite all project, the serial configuration is the best option as the SR are so fast that user will never see intermediate effects</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
