MEL PICBASIC Forum - Add New Section

• Recent Forum Posts

Re: Interfacing a BME280 on a PIC18F2431

Hi Richard,

Thanks for your reply, and I do agree (I thought I'd check first!).

This would have been used in an existing project as an upgrade to replace a DS18B20 - it looks like a good sensor...

Re: Interfacing a BME280 on a PIC18F2431

a quick look at the data sheet yields :-
temperature would be ok using longs
humidity might be awkward since it uses unsigned longs that pbp cannot
pressure would be a challenge since its done...

richard Today, 13:54

Interfacing a BME280 on a PIC18F2431

Hello Everyone,

I'm currently interfacing a BME280 digital humidity, pressure and temperature sensor (I²C) with a 18F2431:
https://www.bosch-sensortec.com/bst/products/all_products/bme280

I...

Re: Help with Using the Catalex MP3 Player

Hi

Program is doing what I want for now.... putting the clear in before the goto has cleared a lot of the issues.

I know it is still not elegant and will have issues still... I am "not" a...

andybarrett1 Yesterday, 09:13

Re: Doing something at predefined amount of steps?

for the sign, so long as a & b are the same variable type:

if (a - b) > a then
sign = 1 ' result will be negative
else
sign = 0 ' result will be positive or zero
endif

Art Yesterday, 05:24

Re: Doing something at predefined amount of steps?

No, 200-300=65436.
65435 is -101 in two's complement because 65435+101 = 65536 which, when being truncated to 16 bits is 0.

If what you want is the difference between the two numbers while not...

HenrikOlsson - 21st July 2019, 23:01

Re: Doing something at predefined amount of steps?

Thanks Henrik, so Say A=200 B=300, C in this case will be 65535-100=65435, right? So if I take 65535 and minus it result, I should receive correct difference between A and B, right?

CuriousOne - 21st July 2019, 18:46

Re: Doing something at predefined amount of steps?

towlerg - 21st July 2019, 18:13

Re: Doing something at predefined amount of steps?

It will wrap around, 0-1=65535 provided the variable where the result is stored is a WORD.

HenrikOlsson - 21st July 2019, 17:23

Re: Doing something at predefined amount of steps?

Oh and by the way, currently I don't have access to machine with PBP, what will happen if C=A-B and B is > A ? all variables are word length. I need to determine difference between A and B, but...

CuriousOne - 21st July 2019, 16:56
• A/D

Precision Volts and Amps Meter

by Published on - 27th June 2012 15:31  Number of Views: 2297

Hi All!
Here is the code to create a voltmeter and ammeter. Everyone has a "display of choice" so you can ...

by Published on - 15th October 2010 16:51  Number of Views: 6936

Darrel Taylor has a great oversampling include file. This can give you a 10 through 16 bit result from a 10 bit A/D PIC ...

Analog to digital averaging with hysteresis

by Published on - 15th October 2010 16:29  Number of Views: 6702

You know how the least sigificant digit will "wobble" back and forth between 2 numbers? It's half-way between ...

Voltage Divider Example

by Published on - 7th October 2010 03:19  Number of Views: 7130

Here is an example by Darrel Taylor for a voltage divider circuit. This makes it possible for a PIC to give an analog measurement ...

How to use the HLVD module as a low voltage monitor

by Published on - 29th May 2010 15:05  Number of Views: 3901

In hopes this might help someone avoid the time it took me to learn this I will make this contribution of code as a solution ...

Sensor Scaling

by Published on - 27th May 2010 17:17  Number of Views: 4667

Scaling an analog sensor is not a difficult as it may seem. Even when zero units is not zero volts.

...

All Digital

by  Number of Views: 5198

ALLDIGITAL.pbp

If you want to use all the pins on your PIC as general Input/Output, you must first enable ...