Go Down

Topic: MPL115A1 pressure sensor integration (Read 2053 times) previous topic - next topic


Hi I am new to Arduino (uno). I have some experience with C++ but am still learning a lot. My project is an automated distilling system that will read a temperature input and pressure input and then based on those inputs, turn on or off electromechanical valves (actually they are fuel injectors). I started testing out my code and got my thermistor to work correctly. I purchased a MPL115A1 pressure sensor for absolute pressure readings. It was talked about before on the following forum:
I modified his code for the uno and am not getting anything. Based on the data sheets he provides, are the registers correct (read and write as well as all the variable mappings)?

I attached what I have done so far because it is too long for this forum.


So I decided to try and find code that will just make it work. I can work on integrating the code into my project later. I found the following example code:
When I go to compile it there are two issues:
1) I do not have (or know how to make) the MPL115A1.h library
2) It does not like the line:
Code: [Select]

static FILE mystdout = FDEV_SETUP_STREAM(uart_putchar, NULL, _FDEV_SETUP_WRITE);

Here is general program with out the functions:
Code: [Select]

#include <avr/io.h>
#include <stdio.h>
#include "MPL115A1.h"

#define PRESH 0x00 // 80
#define PRESL 0x02 // 82
#define TEMPH 0x04 // 84
#define TEMPL 0x06 // 86

#define A0MSB 0x08 // 88
#define A0LSB 0x0A // 8A
#define B1MSB 0x0C // 8C
#define B1LSB 0x0E // 8E
#define B2MSB 0x10 // 90
#define B2LSB 0x12 // 92
#define C12MSB 0x14 // 94
#define C12LSB 0x16 // 96
#define C11MSB 0x18 // 98
#define C11LSB 0x1A // 9A
#define C22MSB 0x1C // 9C
#define C22LSB 0x1E // 9E

// Macros //
#define sbi(var, mask)   ((var) |= (uint8_t)(1 << mask))
#define cbi(var, mask)   ((var) &= (uint8_t)~(1 << mask))

// MPL115A1 Defines //
#define CS 8 //pin for chip select
#define SDN 9 // pin for interrupt

// General Functions //
void ioinit(void);
void delay_ms(uint16_t x);
void delay_us(uint16_t x);
static int uart_putchar(char c, FILE *stream);
uint8_t uart_getchar(void);
static FILE mystdout = FDEV_SETUP_STREAM(uart_putchar, NULL, _FDEV_SETUP_WRITE);

Any suggestions on how to convert this code to the Arduino Uno?


2) It does not like the line:

static FILE mystdout = FDEV_SETUP_STREAM(uart_putchar, NULL, _FDEV_SETUP_WRITE);

Well, probably I'd say something like "Serial.begin (9600);"
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131