The actual programming case of the 74HC595 marquee demo program

The **74HC595** is an 8-bit serial-in, parallel-out shift register with an 8-bit output latch. It features a three-state parallel output, making it ideal for driving LEDs or other digital components. The device receives serial data through the SDI (Serial Data Input) pin and shifts it into an internal 8-bit shift register on the rising edge of the SCLK (Shift Clock). Once the data is fully shifted in, the LATCH (RCK) signal transfers the data from the shift register to the output buffer, allowing the parallel outputs (Q0–Q7) to update simultaneously. This program demonstrates how to control a LED display using the 74HC595 shift register. It uses a microcontroller to send serial data to the chip and then latches it to display a moving pattern. The code includes delay routines to create visible effects and loops to cycle through different patterns. --- ;========================================================= ; 74HC595 Marquee Demonstration Program ;========================================================= ; Date of creation: 2007/08/12 ; Creator: Give me a cigarette ;========================================================= SDATA_595 EQU P1.0 ; Serial Data Input SCLK_595 EQU P1.1 ; Shift Clock Pulse RCK_595 EQU P1.2 ; Output Latch Control Pulse ;========================================================= ORG 0000H LJMP MAIN ORG 0030H ;========================================================= MAIN: MOV SP, #60H MOV R0, #0FEH MAIN1: CALL OUT_595 CALL DELAY MOV A, R0 RL A MOV R0, A JMP MAIN1 ;--------------------------------------------------------- ; Output data to the shift register ;--------------------------------------------------------- OUT_595: LCALL WR_595 CLR RCK_595 NOP NOP SETB RCK_595 ; Rising edge sends data to output latch NOP NOP NOP CLR RCK_595 RET ;--------------------------------------------------------- ; Send data to the shift register ;--------------------------------------------------------- WR_595: MOV R4, #08H MOV A, R0 WR_LOOP: RLC A MOV SDATA_595, C SETB SCLK_595 ; Shift on rising edge NOP NOP CLR SCLK_595 DJNZ R4, WR_LOOP RET ;--------------------------------------------------------- ; Delay subroutine for timing control ;--------------------------------------------------------- DELAY: MOV R5, #03H DEL0: MOV R6, #0FFH DEL1: MOV R7, #0FFH DJNZ R7, $ DJNZ R6, DEL1 DJNZ R5, DEL0 RET ;--------------------------------------------------------- END

Smart Watch Protective Case

smart watch protective cover,smart watch protector case,smart watch cases,protective watch cases

Dongguan Yingxin Technology Co., Ltd. , https://www.dgyingxintech.com

This entry was posted in on