Hallo sasa,
ich stehe gerade vor einen rätzel ich, ich versuche die ganze Zeit den
mlx90316 über SPI auszuwerten aber bekomme leider nur Mull raus,
entweder Nullen oder Einsen, als µc benutze ich einen atmega168, und
einen npn-transistor(BC547), mein relevante stückCode Sieht So aus:
//*******************************************************
DDRB &= ~(1 << MISO);
DDRB |= ( (1 << MOSI) | (1 << SCK)| (1 << CS) );
PORTB &= ~((1 << MOSI) | (1 << MISO) | (1 << SCK)); //
PORTB |= (1<<CS); //CS auf High
SPCR |= (1<<SPE)|(1<<MSTR)|(0<<CPOL)|(1<<CPHA)|(1 << SPR1 )|( 0<< SPR0);
SPSR &= ~(1 << SPI2X);
PORTB &=~(1<<CS);
_delay_us(10);
SPDR = 0xaa;
while (!(SPSR&(1<<SPIF)));
SPDR = 0xff;
while (!(SPSR&(1<<SPIF)));
x0 = SPDR;
_delay_us(10);
SPDR = 0x00;
while (!(SPSR&(1<<SPIF)));
SPDR = 0xff;
while (!(SPSR&(1<<SPIF)));
x1 = SPDR;
_delay_us(10);
SPDR = 0x00;
while (!(SPSR&(1<<SPIF)));
SPDR = 0xff;
while (!(SPSR&(1<<SPIF)));
x2 = SPDR;
_delay_us(10);
SPDR = 0x00;
while (!(SPSR&(1<<SPIF)));
SPDR = 0xff;
while (!(SPSR&(1<<SPIF)));
x3 = SPDR;
_delay_us(10);
SPDR = 0x00;
while (!(SPSR&(1<<SPIF)));
SPDR = 0xff;
while (!(SPSR&(1<<SPIF)));
x4 = SPDR;
_delay_us(10);
SPDR = 0x00;
while (!(SPSR&(1<<SPIF)));
SPDR = 0xff;
while (!(SPSR&(1<<SPIF)));
x5 = SPDR;
_delay_us(10);
SPDR = 0x00;
while (!(SPSR&(1<<SPIF)));
SPDR = 0xff;
while (!(SPSR&(1<<SPIF)));
x6 = SPDR;
_delay_us(10);
SPDR = 0x00;
while (!(SPSR&(1<<SPIF)));
SPDR = 0xff;
while (!(SPSR&(1<<SPIF)));
x7 = SPDR;
_delay_us(10);
SPDR = 0x00;
while (!(SPSR&(1<<SPIF)));
SPDR = 0xff;
while (!(SPSR&(1<<SPIF)));
x8 = SPDR;
_delay_us(10);
SPDR = 0x00;
while (!(SPSR&(1<<SPIF)));
SPDR = 0xff;
while (!(SPSR&(1<<SPIF)));
x9 = SPDR;
_delay_us(10);
PORTB|=(1<<CS);
_delay_ms(1);
habe ich was falsches dabei gemacht, ohne es zu merken?
ich bin für jede Art hilfe dankbar.