Hallo,
ich versuche jetzt schon einen Tag lang, die USI als TWI zu
initialisieren.
Ich bekomme es einfach nicht hin einen Takt an SCL auszugeben.
hier mein Code. (Sind auch Testsachen dabei)
1 | .include "tn2313def.inc"
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | .def temp1 = r16
|
7 | .def temp2 = r17
|
8 | .def temp3 = r18
|
9 |
|
10 |
|
11 |
|
12 | .org 0x0000
|
13 | rjmp main
|
14 |
|
15 | .org 0x000D
|
16 | rjmp timer0compare64
|
17 |
|
18 | .org 0x000E
|
19 | rjmp timer0compare128
|
20 |
|
21 | main:
|
22 |
|
23 | ldi temp1, LOW(RAMEND)
|
24 | out SPL, temp1
|
25 |
|
26 | ldi temp1, 0b00100000
|
27 | out DDRD, temp1
|
28 |
|
29 |
|
30 | ldi temp1, 0b00000001
|
31 | out TCCR0B, temp1 ;Timer 0 Voreiler 1
|
32 |
|
33 | ldi temp1, 0b01000000
|
34 | out OCR0A, temp1 ;Timer 0 Compare 128
|
35 |
|
36 | ldi temp1, 0b10001000
|
37 | out OCR0B, temp1 ;Timer 0 Compare 128
|
38 |
|
39 | ldi temp1, 0b00000111
|
40 | out TIMSK, temp1 ;Timer 0 Interrupt enable
|
41 |
|
42 |
|
43 | ldi temp1, 0b00100100
|
44 | out USICR, temp1
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 | sei
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 | loop:
|
57 |
|
58 |
|
59 |
|
60 | rjmp loop
|
61 |
|
62 | timer0compare64:
|
63 |
|
64 | cbi PORTD, 5
|
65 |
|
66 |
|
67 | reti
|
68 |
|
69 | timer0compare128:
|
70 |
|
71 | sbi PORTD,5
|
72 |
|
73 |
|
74 | ; ldi temp1, 0b00000000
|
75 | ; out TCNT0, temp1
|
76 | reti
|
Könnt ihr mir ein par Denkanstöße geben.Komme auch mit googlen nicht
weiter.
Danke!
mfg, Matthias