Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 08:59 07 Jul 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Code Snippet Shift Register74HC595

Author Message
atmega8

Guru

Joined: 19/11/2013
Location: Germany
Posts: 724
Posted: 12:52am 08 Sep 2016
Copy link to clipboard 
Print this post

Hello,

can anyone provide me with some working code snippets for sending data to a
shift Register like the 74HC595 or similar?


THX


Edited by atmega8 2016-09-09
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10215
Posted: 01:41am 08 Sep 2016
Copy link to clipboard 
Print this post

I used it in this thread
 
atmega8

Guru

Joined: 19/11/2013
Location: Germany
Posts: 724
Posted: 01:49am 08 Sep 2016
Copy link to clipboard 
Print this post

ufff,

there may be some Code lines regarding SPI, but ...

 
MikeO
Senior Member

Joined: 11/09/2011
Location: Australia
Posts: 275
Posted: 02:19pm 08 Sep 2016
Copy link to clipboard 
Print this post

Hi, DRK posted this thread

I have some done some early testing for an upcoming project using a single 74HC595B chip. Schematic and DRK code changed a bit to do testing.



'SPI-16IO.BAS
'16 I/0 POINT HANDLING BY SPI
'2016.03.09--MM-V5.1
'DRK V1.0
'16 OUT: 2*HCF4094 16 IN: 2*MC14021 - BOTH ARE SHIFT-REGISTERS
'======[ INITIALISING ]================================================
OPTION EXPLICIT
OPTION AUTORUN ON
DIM K1,B1
CONST STRB=24: SETPIN STRB,DOUT:PIN(STRB)=1 'CONFIGURE DISPLAY LATCH PIN
'----------------------------------------------------------------------
'INP TO OUTP - UNCOMMENT NEXT 9 LINES
'DO
'SPI OPEN 500000,0,16
' PIN(STRB)=0
' PAUSE 1
' B1=SPI(0) 'READ FROM IN-SHREG TO B1
' K1=SPI(B1) 'B1 CONTENT WRITE TO OUT-SHREG
' SPI CLOSE
' PIN(STRB)=1
'LOOP
'----------------------------------------------------------------------
'0.5 SEC 16 BIT OUTPUT TOGGLE
DO
' K1=K1 XOR 8192
SPI OPEN 500000,0,8
PIN(STRB)=0
PAUSE 1
k1=k1+1
B1=SPI(k1) 'B1 = THE CONTENT OF INP-SHREG
SPI CLOSE
? k1
PIN(STRB)=1
PAUSE 10
LOOP
'----------------------------------------------------------------------
END



Codenquilts
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9589
Posted: 05:08pm 08 Sep 2016
Copy link to clipboard 
Print this post

There is also this thread which documents my experiments with the 595's used in an LED display. You will see if you read that thread, that I was confused by them too for a start, then it all came together by the end of the thread.(only two pages).
Smoke makes things work. When the smoke gets out, it stops!
 
atmega8

Guru

Joined: 19/11/2013
Location: Germany
Posts: 724
Posted: 05:22am 09 Sep 2016
Copy link to clipboard 
Print this post

Hello to ALL,

after investigating some minutes in Grogster's well documented code,
it was very simple for me to get my program running.

You saved me some hours of my life ;-)


Thank you so much


 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9589
Posted: 12:55am 10 Sep 2016
Copy link to clipboard 
Print this post

Sie sind willkommen.
Grüße.


Smoke makes things work. When the smoke gets out, it stops!
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025