Hi N,Have a look at the C++ code in the Arduino library, it's often far easier to understand that than to try and sort out information from the datasheet.
I didn't post any code, I suggested looking at the Arduino library - which is likely to be easier to understand than the datasheet - Arduino libraries are a great resource.Hi N,
Thanks, but as I understand your CODE, it is for PIC, my question is for the BMP280 D/S, and when it is taking measurements, and able to be READ by the PIC which is an 18F46K20, and doesn't appear on your list. Once I figured it was for PICs I stopped reading so aplogies if it would have helped.
C
Hi N,Have a look at the C++ code in the Arduino library, it's often far easier to understand that than to try and sort out information from the datasheet.
Hi N,I didn't post any code, I suggested looking at the Arduino library - which is likely to be easier to understand than the datasheet - Arduino libraries are a great resource.
Adafruit_BMP280_Library/Adafruit_BMP280.cpp at master · adafruit/Adafruit_BMP280_Library
Arduino Library for BMP280 sensors. Contribute to adafruit/Adafruit_BMP280_Library development by creating an account on GitHub.github.com
You should find what you need in the C++ libraries for Arduino, you need to convert it to run under BASIC on the PIC.Hi N,
Thanks, but as I understand your CODE, it is for PIC, my question is for the BMP280 D/S, and when it is taking measurements, and able to be READ by the PIC which is an 18F46K20, and doesn't appear on your list. Once I figured it was for PICs I stopped reading so aplogies if it would have helped.
C
Hi N,
I clicked the link on your first reply, but now see it's on all of your replies. I now presume you mean find the Arduino libraries, is this correct? I looked through the CODE you posted, which looked promising, but I didn't see STATUS.0 or STATUS.3 anywhere.
C.
uint8_t Adafruit_BMP280::getStatus(void) {
return read8(BMP280_REGISTER_STATUS);
}
Hi N,You should find what you need in the C++ libraries for Arduino, you need to convert it to run under BASIC on the PIC.
There's a routine that reads the status register?:
C++:uint8_t Adafruit_BMP280::getStatus(void) { return read8(BMP280_REGISTER_STATUS); }
Hi N,
I can't read C++, although I saw that it read the STATUS register but couldn't see where the 2x BITs were mentioned. When I READ a BIT, I select one and define what I want the program to do with it. e,g, WHILE.
C.
Hi N,It's not that hard to read C++, just concentrate a little and you can make out roughly what it's doing, it's not that much different to modern BASIC. Using that in conjunction with the datasheet should help you work out what's going on.
/*!
* @brief Take a new measurement (only possible in forced mode)
* !!!todo!!!
*/
/*
void Adafruit_BMP280::takeForcedMeasurement()
{
// If we are in forced mode, the BME sensor goes back to sleep after each
// measurement and we need to set it to forced mode once at this point, so
// it will take the next measurement and then return to sleep again.
// In normal mode simply does new measurements periodically.
if (_measReg.mode == MODE_FORCED) {
// set to forced mode, i.e. "take next measurement"
write8(BMP280_REGISTER_CONTROL, _measReg.get());
// wait until measurement has been completed, otherwise we would read
// the values from the last measurement
while (read8(BMP280_REGISTER_STATUS) & 0x08)
delay(1);
}
}
*/
Hi N,Been having a quick look through the code, the status register is simply read in to a byte sized variable, and doesn't appear to be used in the examples that are given.
However, there is an unimplemented mention of 'forced mode'
C++:/*! * @brief Take a new measurement (only possible in forced mode) * !!!todo!!! */ /* void Adafruit_BMP280::takeForcedMeasurement() { // If we are in forced mode, the BME sensor goes back to sleep after each // measurement and we need to set it to forced mode once at this point, so // it will take the next measurement and then return to sleep again. // In normal mode simply does new measurements periodically. if (_measReg.mode == MODE_FORCED) { // set to forced mode, i.e. "take next measurement" write8(BMP280_REGISTER_CONTROL, _measReg.get()); // wait until measurement has been completed, otherwise we would read // the values from the last measurement while (read8(BMP280_REGISTER_STATUS) & 0x08) delay(1); } } */
Hi G,Hi C .. I dont 'know' this device (I am about to code for a BME280 module ), but your 'mate' looks about right. ie check the status.3 before any data reading and conversion..
As I said above, that's only in 'forced mode' - in running mode it simply reads continually and you just need to read the data from it.Hi C .. I dont 'know' this device (I am about to code for a BME280 module ), but your 'mate' looks about right. ie check the status.3 before any data reading and conversion..
// Returns temperature in DegC, resolution is 0.01 DegC. Output value of “5123” equals 51.23
DegC.
// t_fine carries fine temperature as global value
BME280_S32_t t_fine;
BME280_S32_t BME280_compensate_T_int32(BME280_S32_t adc_T)
{
BME280_S32_t var1, var2, T;
var1 = ((((adc_T>>3) – ((BME280_S32_t)dig_T1<<1))) * ((BME280_S32_t)dig_T2)) >> 11;
var2 = (((((adc_T>>4) – ((BME280_S32_t)dig_T1)) * ((adc_T>>4) – ((BME280_S32_t)dig_T1)))
>> 12) *
((BME280_S32_t)dig_T3)) >> 14;
t_fine = var1 + var2;
T = (t_fine * 5 + 128) >> 8;
return T;
}
I was using PICs before Arduinos were introduced, and carried on using them..
The Arduino is a clever system for making things using libraries, and in a kind of LEGO way, much fatser to get results, but perhaps less knowledge learnt. Arduinos are microcomputers, with only slight differences from PIC e,g names etc. They tend to use boards with the Chip in the middle, where Pics, genrally use their own PCBs. I think they have the same manufacturer/owner.
Hi M,C .. .
I was not suggesting you should do anything but carry on using them.
There's not much of that I can agree with, but no matter.
I was just suggesting that the problems you highlighted at #13 are likely due to the 'set sampling' parameters in setup, as you will discover.
MM
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?