![]() |
Forum Index : Microcontroller and PC projects : Code Snippet Shift Register74HC595
Author | Message | ||||
atmega8![]() Guru ![]() Joined: 19/11/2013 Location: GermanyPosts: 724 |
Hello, can anyone provide me with some working code snippets for sending data to a shift Register like the 74HC595 or similar? THX ![]() ![]() ![]() |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10215 |
I used it in this thread |
||||
atmega8![]() Guru ![]() Joined: 19/11/2013 Location: GermanyPosts: 724 |
ufff, there may be some Code lines regarding SPI, but ... |
||||
MikeO Senior Member ![]() Joined: 11/09/2011 Location: AustraliaPosts: 275 |
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 ZealandPosts: 9589 |
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: GermanyPosts: 724 |
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 ZealandPosts: 9589 |
Sie sind willkommen. Grüße. ![]() Smoke makes things work. When the smoke gets out, it stops! |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |