ldi tmp1,0x0f
out DDRB,tmp1
- ; g, rck, sck -> low / scl -> high
- ldi tmp1,0x07
- out PORTB,tmp1
- sbi PORTB,3
+ ; disable hc595 outputs
+ sbi PORTB,0
+
+ ; rck -> low
+ cbi PORTB,1
+
+ ; clear hc595 registers
+ cbi PORTB,3
+
+ ; rck -> high (store shift register data)
+ sbi PORTB,1
+
+ ; enable outputs
+ cbi PORTB,0
; port d 6 -> output
sbi DDRD,6
; ser -> low
cbi PORTD,6
+ ; port d 2 -> output (debug clk!)
+ sbi DDRD,2
+
+ ; port d 3 -> output (debug vertical!)
+ sbi DDRD,3
+
+ ; release hc595 register clear
+ sbi PORTB,3
+
ret
SET_HC595:
; storage clock -> low
- cbi PORTD,1
+ cbi PORTB,1
+
+ ; zero to everything ...
+ cbi PORTB,3 ; clear hc595 registers
+ sbi PORTB,1 ; store shift register data
+ cbi PORTB,1 ; release hc595 register clear
+ sbi PORTB,3 ; storage clock -> low
; source driver
cbi PORTB,2
; set ser line
cbi PORTD,6
- sbrc hc595_source,7
+ sbrc hc595_source,0
sbi PORTD,6
+.ifdef DEBUG_PORTS
+ ldi uart_rxtx,0x30
+ sbrc hc595_source,0
+ ldi uart_rxtx,0x31
+ rcall UART_TX
+.endif
; clock -> high
sbi PORTB,2
cbi PORTB,2
; set ser line
cbi PORTD,6
- sbrc hc595_source,6
+ sbrc hc595_source,1
sbi PORTD,6
+.ifdef DEBUG_PORTS
+ ldi uart_rxtx,0x30
+ sbrc hc595_source,1
+ ldi uart_rxtx,0x31
+ rcall UART_TX
+.endif
; clock -> high
sbi PORTB,2
cbi PORTB,2
; set ser line
cbi PORTD,6
- sbrc hc595_source,5
+ sbrc hc595_source,2
sbi PORTD,6
+.ifdef DEBUG_PORTS
+ ldi uart_rxtx,0x30
+ sbrc hc595_source,2
+ ldi uart_rxtx,0x31
+ rcall UART_TX
+.endif
; clock -> high
sbi PORTB,2
cbi PORTB,2
; set ser line
cbi PORTD,6
- sbrc hc595_source,4
+ sbrc hc595_source,3
sbi PORTD,6
+.ifdef DEBUG_PORTS
+ ldi uart_rxtx,0x30
+ sbrc hc595_source,3
+ ldi uart_rxtx,0x31
+ rcall UART_TX
+.endif
; clock -> high
sbi PORTB,2
cbi PORTB,2
; set ser line
cbi PORTD,6
- sbrc hc595_source,3
+ sbrc hc595_source,4
sbi PORTD,6
+.ifdef DEBUG_PORTS
+ ldi uart_rxtx,0x30
+ sbrc hc595_source,4
+ ldi uart_rxtx,0x31
+ rcall UART_TX
+.endif
; clock -> high
sbi PORTB,2
cbi PORTB,2
; set ser line
cbi PORTD,6
- sbrc hc595_source,2
+ sbrc hc595_source,5
sbi PORTD,6
+.ifdef DEBUG_PORTS
+ ldi uart_rxtx,0x30
+ sbrc hc595_source,5
+ ldi uart_rxtx,0x31
+ rcall UART_TX
+.endif
; clock -> high
sbi PORTB,2
cbi PORTB,2
; set ser line
cbi PORTD,6
- sbrc hc595_source,1
+ sbrc hc595_source,6
sbi PORTD,6
+.ifdef DEBUG_PORTS
+ ldi uart_rxtx,0x30
+ sbrc hc595_source,6
+ ldi uart_rxtx,0x31
+ rcall UART_TX
+.endif
; clock -> high
sbi PORTB,2
cbi PORTB,2
; set ser line
cbi PORTD,6
- sbrc hc595_source,0
+ sbrc hc595_source,7
sbi PORTD,6
+.ifdef DEBUG_PORTS
+ ldi uart_rxtx,0x30
+ sbrc hc595_source,7
+ ldi uart_rxtx,0x31
+ rcall UART_TX
+.endif
; clock -> high
sbi PORTB,2
cbi PORTD,6
sbrc hc595_sink,7
sbi PORTD,6
+.ifdef DEBUG_PORTS
+ ldi uart_rxtx,0x30
+ sbrc hc595_sink,7
+ ldi uart_rxtx,0x31
+ rcall UART_TX
+.endif
; clock -> high
sbi PORTB,2
cbi PORTD,6
sbrc hc595_sink,6
sbi PORTD,6
+.ifdef DEBUG_PORTS
+ ldi uart_rxtx,0x30
+ sbrc hc595_sink,6
+ ldi uart_rxtx,0x31
+ rcall UART_TX
+.endif
; clock -> high
sbi PORTB,2
cbi PORTD,6
sbrc hc595_sink,5
sbi PORTD,6
+.ifdef DEBUG_PORTS
+ ldi uart_rxtx,0x30
+ sbrc hc595_sink,5
+ ldi uart_rxtx,0x31
+ rcall UART_TX
+.endif
; clock -> high
sbi PORTB,2
cbi PORTD,6
sbrc hc595_sink,4
sbi PORTD,6
+.ifdef DEBUG_PORTS
+ ldi uart_rxtx,0x30
+ sbrc hc595_sink,4
+ ldi uart_rxtx,0x31
+ rcall UART_TX
+.endif
; clock -> high
sbi PORTB,2
cbi PORTD,6
sbrc hc595_sink,3
sbi PORTD,6
+.ifdef DEBUG_PORTS
+ ldi uart_rxtx,0x30
+ sbrc hc595_sink,3
+ ldi uart_rxtx,0x31
+ rcall UART_TX
+.endif
; clock -> high
sbi PORTB,2
cbi PORTD,6
sbrc hc595_sink,2
sbi PORTD,6
+.ifdef DEBUG_PORTS
+ ldi uart_rxtx,0x30
+ sbrc hc595_sink,2
+ ldi uart_rxtx,0x31
+ rcall UART_TX
+.endif
; clock -> high
sbi PORTB,2
cbi PORTD,6
sbrc hc595_sink,1
sbi PORTD,6
+.ifdef DEBUG_PORTS
+ ldi uart_rxtx,0x30
+ sbrc hc595_sink,1
+ ldi uart_rxtx,0x31
+ rcall UART_TX
+.endif
; clock -> high
sbi PORTB,2
cbi PORTD,6
sbrc hc595_sink,0
sbi PORTD,6
+.ifdef DEBUG_PORTS
+ ldi uart_rxtx,0x30
+ sbrc hc595_sink,0
+ ldi uart_rxtx,0x31
+ rcall UART_TX
+.endif
; clock -> high
sbi PORTB,2