Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

A test for sending CODE

Hey mate, what are you trying to do?
Hi S,
I was failing at posting CODE using </>, it appears to be working now.

My initial question was going to be regarding READing of a peripheral registers of a Compass.
which appears to be getting the odd wrong READing, making the calculated DEGREES slightly wrong, so in the past I've been averaging. I think now that my seeting are a bit wrong.

I'll save you reading the data sheet, plus understanding Oshonsoft BASIC, which is what I use, and I've been given lots of things to try by an electrical forum.
Cheers, C
Code:
A TEST ONLY!!!!!!!!!!!!!!!!!!!!!!!!!!

'ALTITUDE TEMP CALC
Proc calca()  'ALTMTR BMP280
    'Calculate temperature
    var1 = ((adc_t / 16384 - (dig_t1 / 1024))) * dig_t2
    var2 = (((adc_t) / 131072 - (dig_t1) / 8192) * (adc_t / 131072 - dig_t1 / 8192) * dig_t3)
    t_fine = var1 + var2
    tp = (var1 + var2) / 5120
    'Calculate pressure
    var1 = t_fine / 2 - 64000
    var2 = var1 * var1 * dig_p6 / 32768
    var2 = var2 + var1 * dig_p5 * 2
    var2 = var2 / 4 + dig_p4 * 65536
    var1 = ((dig_p3) * var1 * var1 / 524288 + dig_p2 * var1) / 524288
    var1 = (1 + var1 / 32768) * dig_p1
    pr = 1048576 - adc_p
    pr = (pr - (var2 / 4096)) * 6250 / var1
    var1 = dig_p9 * pr * pr / 2147483648
    var2 = pr * dig_p8 / 32768
    pr = pr + (var1 + var2 + dig_p7) / 16
End Proc
 

New Threads

Latest posts

Buy us a coffee!

Back
Top Bottom