CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

BME280.c driver how to

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Jody



Joined: 08 Sep 2006
Posts: 182

View user's profile Send private message Send e-mail

BME280.c driver how to
PostPosted: Tue Sep 11, 2018 2:30 am     Reply with quote

Hello,
I am trying to communicate with this device (BME280) with the driver provided from CCS.ver.5.080.
Have some questions. There is a debug defined in this driver. How can I let that part send it's info to my RS232 stream ?

And (or better) is there someone who has used this driver before ? A short example would be very nice.

Best regards,
Jody
Jody



Joined: 08 Sep 2006
Posts: 182

View user's profile Send private message Send e-mail

PostPosted: Tue Sep 11, 2018 4:14 am     Reply with quote

Code:

long long    Tempie;
unsigned long long   Drukkie;
unsigned long long   Hummie;


mode = bme280_init();
bme280_set_mode(BM280_MODE_NORMAL);
mode = bme280_ok();
fprintf(LORA,"BME280 OK = %Ld\n\r",mode);

mode = bme280_get_humidity(&Tempie, &Drukkie, &Hummie);
fprintf(LORA,"BME280 Temp = %Ld Drukkie = %Ld Hummie = %Ld \n\r",Tempie, Drukkie, Hummie);

temtronic



Joined: 01 Jul 2010
Posts: 9246
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Sep 11, 2018 5:14 am     Reply with quote

You need to look at 'streams' in the CCS manual.

If you press F11 when your project is open, the manual comes alive, simple 'search' for 'stream'. CCS has examples in there.
It's as simple as adding one more option to the #use RS232(....).

jay
Jody



Joined: 08 Sep 2006
Posts: 182

View user's profile Send private message Send e-mail

PostPosted: Wed Sep 12, 2018 12:43 am     Reply with quote

Yes I know... but when I use the driver for the BME280 in the code there they use:
Code:
debug_bme280(debug_putc, "VER_OK ");

this part I can't get to my LORA or other stream...
So I am doing something wrong...

The driver is functioning by the way!!!

Greetings,
Jody
temtronic



Joined: 01 Jul 2010
Posts: 9246
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Wed Sep 12, 2018 5:41 am     Reply with quote

hmm, OK I don't have that driver as my compiler is, well, kind ,old....
But based upon what I've seen in the past 2 decades...
It appears the driver has a function called 'debug_bme280' where they pass (send ) "ver_OK" to another function called 'debug_putc' which I assume goes to a serial port,probably a PC though it could just as easily be a serial LCD module. I'm assuming that this serial port is different from the 'main' one as it is for debugging,so visual confirmation that 'stuff is being done'.. It could be a SW xmit only serial pin...

CCS does tend to make drivers 'universal', trying to please everyone and since it's 'all there', you should be able to customize it as required.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Sep 12, 2018 12:21 pm     Reply with quote

Jody wrote:
Yes I know... but when I use the driver for the BME280 in the code there they use:
Code:
debug_bme280(debug_putc, "VER_OK ");

this part I can't get to my LORA or other stream...
So I am doing something wrong...

The driver is functioning by the way!!!

Greetings,
Jody

You need to create your own debug_putc() routine. This is the most
simple way to do it. This will write a character to your stream LORA:
Code:

void debug_putc(int8 c)
{
fputc(c, LORA);
}
jaka



Joined: 04 May 2014
Posts: 36
Location: Finland

View user's profile Send private message

PostPosted: Wed Sep 12, 2018 12:50 pm     Reply with quote

I have used the CCS provided bme280 driver for quite some time and it is working well. However recently I noticed that the oversampling and filter settings were not working correctly. I found that the config register address is incorrect. It is 0xF4 in the driver but it should be 0xF5. It is located on row 417 of the bme280.c. I have reported this to CCS so it will probably get fixed in next update.

Another tip if using PIC16F series chips, you will probably get out of ROM error. This can be fixed by adding a #separate directive before int32 _bme280_compensate_H_int32 function. This forces the compiler to realize this function as separate, not inline, and allows the code to fit in the memory segments.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group