Gast
#1740585
Hallo!
Mal wieder ein verzweifelter Anfänger!
Ein Atmega8 und ein SRF08, das Ganze mit Assembler, funktioniert nach
diesem Schema:
1. Send a start sequence
2. Send 0xE0 ( I2C address of the SRF08 with the R/W bit low (even
address)
3. Send 0x00 (Internal address of the command register)
4. Send 0x51 (The command to start the SRF08 ranging)
5. Send the stop sequence.
Dies geht sogar als loop! Knackt und blinkt lustig vor sich hin.
Jetzt aber:
1. Send a start sequence
2. Send 0xC0 ( I2C address of the CMPS03 with the R/W bit low (even
address)
3. Send 0x01 (Internal address of the bearing register)
4. Send a start sequence again (repeated start)
5. Send 0xC1 ( I2C address of the CMPS03 with the R/W bit high (odd
address)
6. Read data byte from CMPS03
7. Send the stop sequence.
Diese Schema habe ich auf den SRF umgewandelt und habe Punkt 6 vorerst
ausgelassen. Sieht so aus:
twidata: ldi temp,(1<<TWINT)|(1<<TWSTA)|(1<<TWEN)
out TWCR,temp
rcall INTcheck
ldi temp,0xE0
out TWDR,temp
ldi temp, (1<<TWINT) | (1<<TWEN)
out TWCR,temp
rcall INTcheck
ldi temp,0x00
out TWDR,temp
ldi temp, (1<<TWINT) | (1<<TWEN)
out TWCR,temp
rcall INTcheck
ldi temp,(1<<TWINT)|(1<<TWSTA)|(1<<TWEN)
out TWCR,temp
rcall INTcheck
ldi temp,0xE1
out TWDR,temp
ldi temp, (1<<TWINT) | (1<<TWEN)|(1<<TWEA)
out TWCR,temp
rcall INTcheck
ldi temp,(1<<TWINT)|(1<<TWSTO)|(1<<TWEN)
out TWCR,temp
rcall clear (löscht das Display)
rcall schreib (schreibt irgendwas auf das Display)
Wenn ich jetzt per rjmp eine messung auslösen will geht das nicht. Wieso
nicht? Zeit ist genug da "clear" und "schreib" eine lange warteschleife
beinhalten.
Ändere ich das "0xE1" zu "0xE0" , tu also so als ob da noch ein befehl
and den SRF gesendet erden soll, läuft es wieder prima,das SRF knackt
und blinkt wieder und auf dem Display blinkt ein Zeichen.
Ich entschuldige mich jetzt schonmal für die miserable Darstellung des
Problems hoffe aber das es dennoch verständlich ist.
Hat jemand eine Idee?