Rev 23 | Rev 25 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 23 | Rev 24 | ||
---|---|---|---|
Line 342... | Line 342... | ||
342 | } |
342 | } |
343 | 343 | ||
344 | void ProcessCPUTemperature(int instance) |
344 | void ProcessCPUTemperature(int instance) |
345 | { |
345 | { |
346 | int32_t temp_val; |
346 | int32_t temp_val; |
- | 347 | ||
347 | uint16_t TS_CAL30 = *(uint16_t *) (0x1FF8007AUL); /* ADC reading for temperature sensor at 30 degrees C with Vref = 3000mV */ |
348 | uint16_t TS_CAL30 = *(uint16_t *) (0x1FF8007AUL); /* ADC reading for temperature sensor at 30 degrees C with Vref = 3000mV */ |
348 | uint16_t TS_CAL110 = *(uint16_t *) (0x1FF8007EUL); /* ADC reading for temperature sensor at 110 degrees C with Vref = 3000mV */ |
349 | uint16_t TS_CAL110 = *(uint16_t *) (0x1FF8007EUL); /* ADC reading for temperature sensor at 110 degrees C with Vref = 3000mV */ |
349 | /* get the ADC reading corresponding to ADC channel 16 after turning on the ADC */ |
350 | /* get the ADC reading corresponding to ADC channel 16 after turning on the ADC */ |
350 | 351 | ||
351 | temp_val = FILT_Samples[5]; |
352 | temp_val = FILT_Samples[5]; |
Line 367... | Line 368... | ||
367 | } |
368 | } |
368 | 369 | ||
369 | // the MAP sensor is giving us a reading of |
370 | // the MAP sensor is giving us a reading of |
370 | // 4.6 volts for 1019mB or 2.27 volts at the ADC input (resistive divider by 2.016) |
371 | // 4.6 volts for 1019mB or 2.27 volts at the ADC input (resistive divider by 2.016) |
371 | // I believe the sensor reads 4.5V at 1000kPa and 0.5V at 0kPa |
372 | // I believe the sensor reads 4.5V at 1000kPa and 0.5V at 0kPa |
- | 373 | // Calibration is a bit off |
|
- | 374 | // Real Displayed |
|
- | 375 | // 989 968 |
|
- | 376 | // 994.1 986 |
|
- | 377 | // 992.3 984 |
|
372 | 378 | ||
373 | void ProcessMAP(int instance) |
379 | void ProcessMAP(int instance) |
374 | { |
380 | { |
375 | // Using ADC_Samples[3] as the MAP input |
381 | // Using ADC_Samples[3] as the MAP input |
376 | float reading = FILT_Samples[3] * ADC_Scale; |
382 | float reading = FILT_Samples[3] * ADC_Scale; |
377 | reading = reading * 2.016; // real voltage |
383 | reading = reading * 2.016; // real voltage |
- | 384 | // values computed from slope / intercept of map.ods |
|
378 | reading = (reading) * 1000 / 4.5; // do not assume 0.5 volt offset : reading from 0 to 4.5 instead of 0.5 to 4.5 |
385 | reading = (reading) * 56.23 + 743.2; // do not assume 0.5 volt offset : reading from 0 to 4.5 instead of 0.5 to 4.5 |
379 | plx_sendword(PLX_MAP); |
386 | plx_sendword(PLX_MAP); |
380 | PutCharSerial(&uc1, instance); |
387 | PutCharSerial(&uc1, instance); |
381 | plx_sendword((uint16_t) reading); |
388 | plx_sendword((uint16_t) reading); |
382 | 389 | ||
383 | } |
390 | } |