ReadByte: ;Jump
cli ;No Interrupts
sbi DDRB, BKND ;BKND -> Output
sbi PORTB, BKND ;BKND = 1 = 1 Takt
ldi r16, 0x08 ;8 Bit lesen = 1 Takt
nop ; = 1 Takt
nop ; = 1 Takt
nop ; = 1 Takt
nop ; = 1 Takt
nop ; = 1 Takt
nop ; = 1 Takt
nop ; = 1 Takt
nop ; = 1 Takt
nop ; = 1 Takt
nop ; = 1 Takt -> mind. 12 Takte Overhead
ReadByteBit:
sbi DDRB, BKND ;BKND -> Output 1. Takt
cbi PORTB, BKND ;BKND = 0 2. Takt
nop ; 3. Takt
nop ; 4. Takt
cbi DDRB, BKND ;BKND -> Input 5. Takt
nop ; 6. Takt
nop ; 7. Takt
nop ; 8. Takt
nop ; 9. Takt
clc ;Carry = 0 10. Takt
sbic PINB, BKND ;BKND testen 11-12. Takt
sec ;Carry = 1 12. Takt
rol DBYTE ;Carry -> Bit 0 13. Takt
nop ; 14. Takt
nop ; 15. Takt
dec r16 ; 16. Takt
brne ReadByteBit ; 17-18.Takt
sbi DDRB, BKND ;BKND -> Output
sbi PORTB, BKND ;BKND = 1
sei
ret
//---------------------------------------------------------------------------------
SendByte: ;Jump
cli ;No Interrupts
sbi DDRB, BKND ;BKND -> Output
sbi PORTB, BKND ;BKND = 1 = 1 Takt
ldi r16, 0x08 ;8 Bit senden = 1 Takt
nop ; = 1 Takt
nop ; = 1 Takt
nop ; = 1 Takt
nop ; = 1 Takt
nop ; = 1 Takt
nop ; = 1 Takt
nop ; = 1 Takt
nop ; = 1 Takt
nop ; = 1 Takt
nop ; = 1 Takt -> mind. 12 Takte Overhead
SendByteBit:
cbi PORTB, BKND ;BKND = 0 1. Takt
nop ; 2. Takt
nop ; 3. Takt
sbrc DBYTE, 7 ;MSB testen 4-5. Takt
sbi PORTB, BKND ;BKND auf 1 5. Takt
lsl DBYTE ;Bit 6->Bit 7 6. Takt
nop ; 7. Takt
nop ; 8. Takt
nop ; 9. Takt
nop ; 10. Takt
nop ;TRGT liest Bit 11. Takt
nop ; 12. Takt
nop ; 13. Takt
sbi PORTB, BKND ;BKND = 1 14. Takt
dec r16 ; 15. Takt
brne SendByteBit ; 16-17.Takt
sei
ret |