init_max: push temp2 push temp3 ldi temp,0b11111110 ; LED aus, MAX high out PORTD,temp ; Daten - Data Port D ; Decode-Mode: no decode ldi tmp,0x09 ; Adresse des Decode Mode Registers call SEND_SPIDATA ldi tmp,0x00 ; keine Decodierung call SEND_SPIDATA sbi PORTB, 4 nop cbi PORTB, 4 ; Intensity auf Maximum stellen: ldi tmp,0x0A call SEND_SPIDATA ldi tmp,0x0F call SEND_SPIDATA sbi PORTB, 4 nop cbi PORTB, 4 ; Scan Limit auf 8 aktive Displays stellen: ldi tmp,0x0B call SEND_SPIDATA ldi tmp,0x07 call SEND_SPIDATA sbi PORTB, 4 nop cbi PORTB, 4 ; Display test mode = off: ldi tmp,0x0F ; Adresse des Display Test Registers call SEND_SPIDATA ldi tmp,0x01 ; normal operation call SEND_SPIDATA sbi PORTB, 4 nop cbi PORTB, 4 ; Shutdown auf off = Display einschalten: ldi tmp,0x0C call SEND_SPIDATA ldi tmp,0x01 ; normal operation call SEND_SPIDATA sbi PORTB, 4 nop cbi PORTB, 4 pop temp2 pop temp3 ret SEND_SPIDATA: push temp cbi PORTB, 4 ; make sure date is zero cbi PORTB, 5 ; make sure clock is zero ldi temp, 8 ; send 8 Bits ; Start transmission of data TransmitBit: lsl tmp brcc SendZero sbi PORTB, 6 ; send "1" rjmp SPICLOCK SendZero: cbi PORTB, 6 ; send "0" SPICLOCK: ; Do a clock cycle sbi PORTB, 5 nop cbi PORTB, 5 dec temp brne TransmitBit pop temp nop ret