Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PIC plus-5110 LCD-GPS-BMP280-HMC5983

Status
Not open for further replies.
BB0C9797-9651-43E3-B6D0-2CD9E2E2F78A.jpeg
What is the problem and why do you keep talking about 20 bit values?

Here is a 5110 set up on a PIC
 
hi,
The 20 bit values are coming from a SPI connected BMP280 pressure sensor.
E
 
View attachment 110434 What is the problem and why do you keep talking about 20 bit values?

Here is a 5110 set up on a PIC
Hi G,
Here is a photo of my 5110 on the PCB with BMP280, GPS and provision for a compass. (Sorry about the quality)
After getting problems with the READings from the full programs (A few posts back) because they were all over the place, I decided to test each of the 3x TEMP BYTE and 3x PRESS BYTE READings individually, to see what they look like. At the moment I'm on TEMP, and so far it looks as though 2x of the BYTEs seem sensitive enough for general use, so TEMP XLSB may not be needed.
As Eric says, joining all three BYTEs (XLSB is 1/2 BYTE) gives a STRING of 20 bits would give the normal way of getting the DATA from the BMP280.
C.
 

Attachments

  • 5110.jpg
    5110.jpg
    198.8 KB · Views: 189
Last edited:
Hi, >>>>>>>>>>>>>>>>>>>>>IMPORTANT XLSB<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
I keep refering to the D/S, and find new things.
Today I found this:
It shows that the bottom 3x bits are also used in the XLSB addresses, for setting resolution. More figuring out needed.
C.
 

Attachments

  • 0xFc.jpg
    0xFc.jpg
    131.6 KB · Views: 187
hi C,
This clip from a "C" shows how the program shifts 4 Right
E.
void BME280_SPI::readPressure(void) {

int64_t var1, var2, p;

int32_t adc_P = read24(BME280_REGISTER_PRESSUREDATA); // a 24 Bit Read ie: 3 * 8 bytes
adc_P >>= 4; // shift Right 4 times
 
hi C,
This clip from a "C" shows how the program shifts 4 Right
E.
void BME280_SPI::readPressure(void) {

int64_t var1, var2, p;

int32_t adc_P = read24(BME280_REGISTER_PRESSUREDATA); // a 24 Bit Read ie: 3 * 8 bytes
adc_P >>= 4; // shift Right 4 times
Hi E,
Thanks.
I presume that in a similar way to a WRITE bit %X0000000 at the start of a BYTE, the bottom 3x BITs of the XLSB BYTE should be written first with the OSRS setting, which will set it to READ accordingly.
Does this seem correct?
I'll try it.
EDIT: The above is incorrect. (It's not an easy read) Set the resolution settings (osrs T or P) in REG 0xF4 which will give different READings in the BITs 0-3 of XLSB DATA REG 0xFC. I can only assume, that the shift to the right is bcause they didn't need the finer resolution.
Please correct me if I'm wrong.
C.
 
Last edited:
hi C,
The Pressure is a 20 bit value and so it requires 3, 8 bit bytes to hold it.
They have chosen set the lsb Nibble to 0000.
'
If you could accept a lower resolution value of say 16 bits, just ignore the LSB register
E
 
hi C,
The Pressure is a 20 bit value and so it requires 3, 8 bit bytes to hold it.
They have chosen set the lsb Nibble to 0000.
'
If you could accept a lower resolution value of say 16 bits, just ignore the LSB register
E
Hi E,
I hope you are getting the LOW BYTE XLSB mixed up with the MID BYTE LSB [TOP BYTE MSB] as I did.
If we ignore the LOW BYTE and use LSB: As Temperature is easier to change and measure with a thermometer, I have been testing t_LSB. It is time consuming as the slower the change in TEMP, the more accurate. I think I am getting consitant readings.

0-255 = approx 2DEG so for 0.1DEG perhaps 10 digits on the BMP280, and that's good enough for me. Next I'll try t_MSB.
C.
 
Hi E,
I hope you are getting the LOW BYTE XLSB mixed up with the MID BYTE LSB [TOP BYTE MSB] as I did.
If we ignore the LOW BYTE and use LSB: As Temperature is easier to change and measure with a thermometer, I have been testing t_LSB. It is time consuming as the slower the change in TEMP, the more accurate. I think I am getting consitant readings.

0-255 = approx 2DEG so for 0.1DEG perhaps 10 digits on the BMP280, and that's good enough for me. Next I'll try t_MSB.
C.


Your pressure gauge measures to about the nearest 0.1 Pascal.
Air pressure change about 12 Pa/ meter (you can the 8 or 9 LSB to change by moving it from floor to ceiling). You should even see a measurable change if you happen to be breathing on it.
 
hi C,
For the LSB I am referring to the LSB of the 3 Bytes that are being Read.
The Byte that has the Lower Nibble preloaded by the BMP with xxxx,0000, the d/s calls it xlsb.
E
 
Your pressure gauge measures to about the nearest 0.1 Pascal.
Air pressure change about 12 Pa/ meter (you can the 8 or 9 LSB to change by moving it from floor to ceiling). You should even see a measurable change if you happen to be breathing on it.
BMP280 has a resolution +-0.12 hPa -> about +- 1m
 
Reading further in the datasheet I found that BMP280 can have 0.16 Pa resolution in super resolution mode.

That is just about good enough to determine which stair you are on (it may need some temperature compensation) as you walk up to your bedroom.
 
That is just about good enough to determine which stair you are on (it may need some temperature compensation) as you walk up to your bedroom.
Hi G,
:)
EDIT: First time I read this, I read star not stair, that's what made me smile.
C
 
Last edited:
hi C,
For the LSB I am referring to the LSB of the 3 Bytes that are being Read.
The Byte that has the Lower Nibble preloaded by the BMP with xxxx,0000, the d/s calls it xlsb.
E
Hi E,
Naming the 3x BYTES as XLSB LSB and MSB has been a confusion. I've seen LSM MSB and MSB [LEAST MEDIUM MOST] on other components which was also confusing. Your way of LOW MED HIGH is clear, why don't they use that?

When I read the d/s, I saw 1MTR resolution, but these latest posts have clarified, that it is finer than that. Firstly I will use 2x BYTES, to see what happens.
C
C
 
Hi,
I've tried lots of combinations, including SPICS ON/OFF, IN or OUT, but when two BYTEs are READ at the same time, then the result is wrong.
Here's the latest: If the lines marked !!!!!!!!!!!!!!!!!!!! are commented IN, then the results of MSB are wrong. It should READ between 120 and 140, but the result is always 108.

EDIT: SOLVED
add
PORTD.5 = 1 'CHIP SELECT TEMP OFF
PORTD.5 = 0 'CHIP SELECT TEMP ON
between each SPI READ


C
 

Attachments

  • 18LF4520 250118 0900 PCB TEMP LSB MSB.bas
    8 KB · Views: 179
Last edited:
hi C,
Downloaded your file, pleased to hear your progress.
E
 
Hi,
Here is the latest PRESS program:
Using this program with T in place of P as a TEMP progam, it works with all three BYTEs being READ ok. The XLSB BYTE looks random, but is clocking round which shows in the XLSB BYTE, so must be very fine.

Using the program as is, 'PRESS', upstairs/downstairs shows difference, but I think the changes are TEMP based, as there is a bigger change by heating/cooling than change in 'altitude :) ).

C.
 

Attachments

  • 18LF4520 250118 1200 PCB PRESS XLSB LSB MSB.bas
    8.6 KB · Views: 174
hi C,
This is why the T versus P requires that Cal maths routine.
E
 
hi C,
This is why the T versus P requires that Cal maths routine.
E
Hi E,
I was trying to make it as simple as possible, at least at this stage, but perhaps you're correct. I thought that TEMP or PRESS could be skipped, but perhaps they need each other.
C.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top