Rev 408 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 408 | Rev 409 | ||
---|---|---|---|
Line 31... | Line 31... | ||
31 | 31 | ||
Line 32... | Line 32... | ||
32 | DDRB |= (1<<PB7)|(1<<PB5)|(1<<PB2); // J8, MOSI, SCK Ausgang |
32 | DDRB |= (1<<PB7)|(1<<PB5)|(1<<PB2); // J8, MOSI, SCK Ausgang |
Line -... | Line 33... | ||
- | 33 | ||
33 | 34 | PORTD &= ~(1<<PD3); // J5 auf Low |
|
34 | PORTD &= ~(1<<PD3); // J5 auf Low |
35 | |
Line 35... | Line 36... | ||
35 | 36 | // Init Statemachine |
|
36 | MM3.AXIS = MM3_X; |
37 | MM3.AXIS = MM3_X; |
Line 58... | Line 59... | ||
58 | 59 | ||
59 | if (MM3.AXIS == MM3_X) SPDR = 0x31; // Schreiben ins SPDR löst automatisch Übertragung (MOSI und MISO) aus |
60 | if (MM3.AXIS == MM3_X) SPDR = 0x31; // Schreiben ins SPDR löst automatisch Übertragung (MOSI und MISO) aus |
60 | else if (MM3.AXIS == MM3_Y) SPDR = 0x32; // Micromag Period Select ist auf 256 (0x30) |
61 | else if (MM3.AXIS == MM3_Y) SPDR = 0x32; // Micromag Period Select ist auf 256 (0x30) |
Line 61... | Line 62... | ||
61 | else if (MM3.AXIS == MM3_Z) SPDR = 0x33; // 1: x-Achse, 2: Y-Achse, 3: Z-Achse |
62 | else if (MM3.AXIS == MM3_Z) SPDR = 0x33; // 1: x-Achse, 2: Y-Achse, 3: Z-Achse |
62 | 63 | ||
63 | MM3.DRDY = SetDelay(5); // Laut Datenblatt max. Zeit bis Messung fertig (bei PS 256 eigentlich 4 ms) |
64 | MM3.DRDY = SetDelay(8); // Laut Datenblatt max. Zeit bis Messung fertig (bei PS 256 eigentlich 4 ms) |
Line 64... | Line 65... | ||
64 | MM3.STATE = MM3_WAIT_DRDY; |
65 | MM3.STATE = MM3_WAIT_DRDY; |
65 | return; |
66 | return; |
Line 193... | Line 194... | ||
193 | //############################################################################ |
194 | //############################################################################ |
194 | { |
195 | { |
195 | float sin_nick, cos_nick, sin_roll, cos_roll; |
196 | float sin_nick, cos_nick, sin_roll, cos_roll; |
196 | float x_corr, y_corr; |
197 | float x_corr, y_corr; |
197 | signed int x_axis,y_axis,z_axis, heading; |
198 | signed int x_axis,y_axis,z_axis, heading; |
198 | unsigned int div_faktor; |
199 | uint16_t div_faktor; |
Line 199... | Line 200... | ||
199 | 200 | ||
Line 200... | Line 201... | ||
200 | div_faktor = (uint16_t)EE_Parameter.UserParam1 * 8; |
201 | div_faktor = (uint16_t)EE_Parameter.UserParam1 * 8; |
201 | 202 |