hallo leute, ich habe probleme mit dem 9833. Ich bekommen KEIN Signal angezeigt. kann mir jmd. weiterhelfen? prog im anhang... mfg #include <avr/io.h> #include <stdlib.h> #include <util/delay_basic.h> unsigned char x; void warte(unsigned char zahl) //warteschleife. warte ist 100µsek. * zahl { do { _delay_loop_1(0x00AA); --zahl; //1 von der Variable Zahl abziehen... } while (zahl >0); // solange zahl > 0 } int main(void) { DDRD = 0xff; DDRB = 0xff; DDRA = 0x00; PORTD |= (1<<PD7) ; // FSYNC HIGH while(1) { while (PINA & (1<<PA1)); { while (!(PINA &(1<<PA1))) ; { ////////////////////////////CONFIG////////////////////////////////////// ////// warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 0 warte(30); PORTD &=~(1<<PD7); // FSYNC LOW warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 1 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 2 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 3 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 4 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 5 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 6 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 7 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 8 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 9 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 10 warte(30); PORTD &=~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 11 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 12 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 13 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 14 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 15 warte(30); PORTD &= ~(1<<PD6); warte(10); PORTD |= (1<<PD7) ; // FSYNC HIGH ///////////////////////////FREQUENZ-0/////////////////////////////////// /////////// warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 0 PORTD &=~(1<<PD7); // FSYNC LOW warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD |= (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 1 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD |= (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 2 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD |= (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 3 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD |= (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 4 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD |= (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 5 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD |= (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 6 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD |= (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 7 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD |= (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 8 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD |= (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 9 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD |= (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 10 warte(30); PORTD &=~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD |= (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 11 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD |= (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 12 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD |= (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 13 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD |= (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 14 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 15 warte(30); PORTD &= ~(1<<PD6); warte(10); PORTD |= (1<<PD7) ; // FSYNC HIGH /////////////////////////////CONFIC///////////////////////////////////// // warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 0 warte(30); PORTD &=~(1<<PD7); // FSYNC LOW warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 1 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 2 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 3 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 4 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 5 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 6 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 7 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 8 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 9 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 10 warte(30); PORTD &=~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 11 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 12 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 13 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 14 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 15 warte(30); PORTD &= ~(1<<PD6); warte(10); PORTD |= (1<<PD7) ; // FSYNC HIGH ///////////////////////////PHASE-0////////////////////////////////////// // warte(30); PORTD |= (1<<PD6); warte(30); PORTD |= (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 0 warte(30); PORTD &=~(1<<PD7); // FSYNC LOW warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD |= (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 1 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 2 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 3 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 4 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 5 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 6 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 7 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 8 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 9 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 10 warte(30); PORTD &=~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 11 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD |= (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 12 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 13 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD |= (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 14 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD |= (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 15 warte(30); PORTD &= ~(1<<PD6); warte(10); PORTD |= (1<<PD7) ; // FSYNC HIGH warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 0 warte(30); PORTD &=~(1<<PD7); // FSYNC LOW warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 1 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 2 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 3 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 4 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 5 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 6 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 7 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 8 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 9 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 10 warte(30); PORTD &=~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 11 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 12 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 13 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 14 warte(30); PORTD &= ~(1<<PD6); warte(30); PORTD |= (1<<PD6); warte(30); PORTD &=~ (1<<PD5); // ZU ÜBERTRAGENDES BIT EINGEBEN 15 warte(30); PORTD &= ~(1<<PD6); warte(10); PORTD |= (1<<PD7) ; // FSYNC HIGH } } } }
Wieso benutzt Du den SPI nicht ? Welche Portpins sind denn an die Pins des AD9833 angeschlossen ? Welchen Controller benutzt Du ?
ich benutze den Atmega 8535 mit spi hat ich da probleme, weil der ad ja kein signal zurücksendet, und das bei spi doch erforderlich ist oder?
Nö, der MISO-Pin kann unbeschaltet bleiben. Viele A/D-Wandler zum Beispiel liefern auch kein Rücksignal. Ich kann Dir mal Code zuschicken den ich im Rahmen eines Projektes mit dem Mega8 erstellt habe. Die Anpassung an den 8535 sollte dann kein Problem sein.
klar kann ich den Code auch hier reinstellen. Hab ich gar nicht dran gedacht. Der Code ist so wie er ist aus dem Gesamtprojekt kopiert und leider nicht dokumentiert. (Wie so oft musste schnell was zusammengezimmert werden :-)
Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.