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.
Hi,
If the BMP280 has been setup correctly!
Should this get the byte from the PRESS_XLSB = 0xF9 address and show it on the 5110?
At the moment it shows 3xGSP lines updating ok and ALT=.
C
 

Attachments

  • fontsml.bas
    3.9 KB · Views: 159
  • get_dir.bas
    3.6 KB · Views: 164
  • 18LF4520 8MHz X4 5110 SML GPS BMP280 10118 1000.bas
    3.8 KB · Views: 189
  • get_hpa.bas
    43 bytes · Views: 197
  • get_lcd.bas
    2 KB · Views: 165
  • get_neo.bas
    2.1 KB · Views: 166
hi C,
It I follow your problem OK, try this:-

Demo:
msg1 = ""
Hseropen 9600
Hserout "Ready!", CrLf

bug:
Call word2asc(0xf9) ' converts a Byte or Word to ASCII
Hserout msg1, CrLf
Goto bug

''''''''''''''''''''
Proc word2asc(arg1 As Word)
msg1 = #arg1
End Proc
 
hi C,
It I follow your problem OK, try this:-

Demo:
msg1 = ""
Hseropen 9600
Hserout "Ready!", CrLf

bug:
Call word2asc(0xf9) ' converts a Byte or Word to ASCII
Hserout msg1, CrLf
Goto bug

''''''''''''''''''''
Proc word2asc(arg1 As Word)
msg1 = #arg1
End Proc
Hi E,
As there is the top 'paragraph already in the program I commented it out.
It reports incorrect PROC when compiling.
I hope I've got it in the correct place.
C.
 

Attachments

  • 18LF4520 8MHz X4 5110 SML GPS BMP280 10118 1300.bas
    4.2 KB · Views: 174
hi C,
This is because the,
Proc word2asc(arg1 As Word)
msg1 = #arg1
End Proc

It is already defined in one of those INC's, this is why I am reluctant to INC code until its fully proved.
Retry with the Proc def deleted.

Demo:
msg1 = ""
Hseropen 9600
Hserout "Ready!", CrLf

bug:
Call word2asc(0xf9) ' converts a Byte or Word to ASCII
Hserout msg1, CrLf
Goto bug
 
Hi,
Making the INCs was a good excercise, but I'll leave it for later as you suggest.
Here is the program with the first 3x lines of 5110 showing TIM=, LAT=, LON= all updaing ok. The 4th line shows ALT=, and waiting for the 'stralt' STRING from reading the register at oxf9 on the BMP280 barometer.
C.
 

Attachments

  • 18LF4520 8MHz X4 5110 GPS BMP280 110118 1140.bas
    7.6 KB · Views: 193
hi C,
Downloaded, will look it over
E

EDIT:
Why did you Rem out these lines, replacing them it works OK.
E
A001.gif
 
Last edited:
hi C,
Downloaded, will look it over
E

EDIT:
Why did you Rem out these lines, replacing them it works OK.
E
View attachment 110209
Hi E,

Because that is the ALT (stralt) from the GPS, and now the ALT is coming from the BMP280 barometer module, expressed in hPa.

The pressure DATA, which will give the ALT is at addresses 0xf9,0xf8 and 0xf7 on the BMP280, I am only trying to get 0xf9 as a test that the module is working.
C
 
hi C,
OK. Have you posted a BMP280 datasheet or link that I could checkout.?
The pressure data will most likely be 'weighted' ie: 0xf9 reg will contain the highest Byte and so on down to 0xf7, lowest Byte.
If that is correct you have to multiply the Reg data by its weighting.

Can you post the readings you get from those 3 registers and what hPa it represents and I will create conversion subroutine.

E
 
hi C,
OK. Have you posted a BMP280 datasheet or link that I could checkout.?
The pressure data will most likely be 'weighted' ie: 0xf9 reg will contain the highest Byte and so on down to 0xf7, lowest Byte.
If that is correct you have to multiply the Reg data by its weighting.

Can you post the readings you get from those 3 registers and what hPa it represents and I will create conversion subroutine.

E
Hi E,
I'm testing to make sure the BMP280 is working, so only the LSB (XLSB) at the moment. Although the three bytes will need joining at some point.
I'm not sure I need a conversion, instead I may use simply < or > from the ground reading.
C.
 

Attachments

  • Barometer BMP280 bought.pdf
    1.2 MB · Views: 176
hi C,
This short clip from the 18F4520 basics, shows some options in converting hex values to decimal and ASCII strings

Run it in the SIM.
E
 

Attachments

  • cam_clip4.bas
    2.7 KB · Views: 168
hi C,
This short clip from the 18F4520 basics, shows some options in converting hex values to decimal and ASCII strings

Run it in the SIM.
E
Hi E,
Thanks for the clip, it works ok in SIM. You've explained this few times in the past, I nearly get it.
Bearing that in mind. Looking at the #305 program, is it set correctly to get the DATA from 0xf9 on the BMP280 in the MAIN LOOP?
C.
 
hi C,
Looks OK.

Gosub get_neo 'Reads NMEA DATA
PORTD.4 = 1 'CHIP SELECT 5110 OFF
WaitMs 1 'Does CS need time to switch? [SHORTEN OR REMOVE THIS LINE]
PORTD.5 = 0 'CHIP SELECT [hpa] ON
SPIPrepare
SPICSOn
SPISend 0xf9
SPIReceive data
SPICSOff
PORTD.5 = 1 'CHIP SELECT OFF[hpa][SPI]
PORTD.4 = 0 'CHIP SELECT 5110 ON
WaitMs 1 'Does CS need time to switch? [SHORTEN OR REMOVE THIS LINE]

stralt = #data

E
 
hi C,
Looks OK.

Gosub get_neo 'Reads NMEA DATA
PORTD.4 = 1 'CHIP SELECT 5110 OFF
WaitMs 1 'Does CS need time to switch? [SHORTEN OR REMOVE THIS LINE]
PORTD.5 = 0 'CHIP SELECT [hpa] ON
SPIPrepare
SPICSOn
SPISend 0xf9
SPIReceive data
SPICSOff
PORTD.5 = 1 'CHIP SELECT OFF[hpa][SPI]
PORTD.4 = 0 'CHIP SELECT 5110 ON
WaitMs 1 'Does CS need time to switch? [SHORTEN OR REMOVE THIS LINE]

stralt = #data

E
Hi E,
Was it only a '#' that was stopping it:banghead:
Did you change the WAITMS time to '1'?
BMP280: I'm getting numbers at some of the addreses, but nothing sensible, so it looks as though it may be working.
Read DATA sheet next, it most probably needs setting up.
Thanks.
EDIT: Just noticed that the BMP280 starts in sleep mode, so got to wake it up.
C.
 
Last edited:
hi C,
This shows how to build a LONG value from the 3, BMP register BYTE values
E
 

Attachments

  • cam_clip5.bas
    2.1 KB · Views: 162
hi C,
This shows how to build a LONG value from the 3, BMP register BYTE values
E
Hi E,
Thanks.
It is difficult to read, so I've edited it. As there are 2x of each BYTE i,e, PRESSURE MSB and TEMPERATURE MSB I have added P_. to the 3x PRESSURE bytes.

The DATA sheet shows that the P_XLSB uses only the high end of the byte. I presume that all the bits need to be shifted along, is this true?
C.
 

Attachments

  • cam_clip5 EDITED.bas
    2.4 KB · Views: 180
  • Memory map XLSB.jpg
    Memory map XLSB.jpg
    309.5 KB · Views: 168
Last edited:
hi C,
The DATA sheet shows that the P_XLSB uses only the high end of the byte. I presume that all the bits need to be shifted along, is this true?
What is the range value of the P_XLSB of the Byte and what displayed value do you want.?
eg: say P_XLSB = 0x12 what would you want the displayed value to be, is there any Scaling factor.
eg: 0x12 = decimal 18, this may need multiplying by a scaling factor say 100 , so that becomes 1800

Post a few P_XLSB values and the required displayed values.

E
 
hi C,
You need all 3 P regs to get a pressure value...

E
A001.gif
A003.gif
 
hi C,
The DATA sheet shows that the P_XLSB uses only the high end of the byte. I presume that all the bits need to be shifted along, is this true?
What is the range value of the P_XLSB of the Byte and what displayed value do you want.?
eg: say P_XLSB = 0x12 what would you want the displayed value to be, is there any Scaling factor.
eg: 0x12 = decimal 18, this may need multiplying by a scaling factor say 100 , so that becomes 1800

Post a few P_XLSB values and the required displayed values.

E
Hi E,
The program only checks one P_BYTE at a time. [I've set the MODE to NORMAL] I've tried all three P_BYTES in turn, and got some numbers, but nothing sensible. I've got to keep reading the DATA sheet as there are lots of settings. The LCD needs a clear.

At the moment I only want to 'see' the DATA as a string from all of the P_BYTES, as you have outlined.
C
 
Hi E,
Here's the latest program, with your suggestions:
Will you put it through the SIM, and see if you can find the mistakes please.
C
 

Attachments

  • 18LF4520 8MHz X4 5110 GPS BMP280 130118 1500.bas
    9.1 KB · Views: 173
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top