Rev 728 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 728 | Rev 729 | ||
---|---|---|---|
Line 57... | Line 57... | ||
57 | return; |
57 | return; |
Line 58... | Line 58... | ||
58 | 58 | ||
59 | case MM3_START_TRANSFER: |
59 | case MM3_START_TRANSFER: |
Line 60... | Line 60... | ||
60 | PORTC &= ~(1<<PC5); // PC5 auf Low (war ~125 µs auf High) |
60 | PORTC &= ~(1<<PC5); // PC5 auf Low (war ~125 µs auf High) |
61 | 61 | ||
62 | if (MM3.AXIS == MM3_X) SPDR = MM3_PERIOD_256 + MM3_X_AXIS; // Schreiben ins SPDR löst automatisch SPI-Übertragung (MOSI und MISO) aus |
62 | if (MM3.AXIS == MM3_X) SPDR = MM3_PERIOD_512 + MM3_X_AXIS; // Schreiben ins SPDR löst automatisch SPI-Übertragung (MOSI und MISO) aus |
Line 63... | Line 63... | ||
63 | else if (MM3.AXIS == MM3_Y) SPDR = MM3_PERIOD_256 + MM3_Y_AXIS; // Micromag Period Select ist 256 (0x30) |
63 | else if (MM3.AXIS == MM3_Y) SPDR = MM3_PERIOD_512 + MM3_Y_AXIS; // Micromag Period Select ist 256 (0x30) |
64 | else SPDR = MM3_PERIOD_256 + MM3_Z_AXIS; //if (MM3.AXIS == MM3_Z) |
64 | else SPDR = MM3_PERIOD_512 + MM3_Z_AXIS; //if (MM3.AXIS == MM3_Z) |
65 | 65 | ||
Line 66... | Line 66... | ||
66 | MM3.DRDY = SetDelay(8); // Laut Datenblatt max. Zeit bis Messung fertig (bei PS 256 eigentlich 4 ms) |
66 | MM3.DRDY = SetDelay(10); // Laut Datenblatt max. Zeit bis Messung fertig (bei PS 256 eigentlich 4 ms) |
67 | MM3.STATE = MM3_WAIT_DRDY; |
67 | MM3.STATE = MM3_WAIT_DRDY; |
Line 217... | Line 217... | ||
217 | tilt = (IntegralRoll /div_faktor); |
217 | tilt = (IntegralRoll /div_faktor); |
218 | sin_roll = sin_i(tilt); |
218 | sin_roll = sin_i(tilt); |
219 | cos_roll = cos_i(tilt); |
219 | cos_roll = cos_i(tilt); |
220 | */ |
220 | */ |
221 | // Offset und Normalisierung |
221 | // Offset und Normalisierung |
222 | Hx = (((int32_t)(mm3_x_axis - MM3_calib.X_off)) *1024) /MM3_calib.X_range; |
222 | Hx = (((int32_t)(mm3_x_axis - MM3_calib.X_off)) *512) /MM3_calib.X_range; |
223 | Hy = (((int32_t)(mm3_y_axis - MM3_calib.Y_off)) *1024) /MM3_calib.Y_range; |
223 | Hy = (((int32_t)(mm3_y_axis - MM3_calib.Y_off)) *512) /MM3_calib.Y_range; |
224 | Hz = (((int32_t)(mm3_z_axis - MM3_calib.Z_off)) *1024) /MM3_calib.Z_range; |
224 | Hz = (((int32_t)(mm3_z_axis - MM3_calib.Z_off)) *512) /MM3_calib.Z_range; |
Line 225... | Line 225... | ||
225 | 225 | ||
226 | // Neigungskompensierung |
226 | // Neigungskompensierung |
227 | x_corr = Hx * cos_nick; |
227 | x_corr = Hx * cos_nick; |
228 | x_corr -= Hz * sin_nick; |
228 | x_corr -= Hz * sin_nick; |