Line -... |
Line 1... |
- |
|
1 |
//Jan Chroust 15.4.2013 |
- |
|
2 |
|
- |
|
3 |
|
1 |
#include "C:\Users\Honza\Documents\pic\I2C_altimet\main.h" |
4 |
#include "C:\Users\Honza\Documents\pic\I2C_altimet\main.h" |
2 |
|
5 |
|
3 |
#define EEPROM_SDA PIN_B0 |
6 |
#define EEPROM_SDA PIN_B0 |
4 |
#define EEPROM_SCL PIN_B1 |
7 |
#define EEPROM_SCL PIN_B1 |
5 |
#use i2c(master, sda=EEPROM_SDA, scl=EEPROM_SCL) |
8 |
#use i2c(master, sda=EEPROM_SDA, scl=EEPROM_SCL) |
6 |
#use rs232(baud=9600,parity=N,xmit=PIN_B3,rcv=PIN_B2,bits=8) //rcv TXD xmit RXD |
9 |
#use rs232(baud=9600,parity=N,xmit=PIN_B3,rcv=PIN_B2,bits=8) //rcv TXD xmit RXD |
7 |
|
10 |
|
8 |
#define MPL3115_ADDR_R 0xC1 |
11 |
#define MPL3115_ADDR_R 0xC1 //addresa pro cteni |
9 |
#define MPL3115_ADDR_W 0xC0 |
12 |
#define MPL3115_ADDR_W 0xC0 |
10 |
|
13 |
|
11 |
|
14 |
|
12 |
void mpl3115_setA (void) //nastavení pro výku |
15 |
void mpl3115_setA (void) //nastavení pro výku |
13 |
{ |
16 |
{ |
Line 112... |
Line 115... |
112 |
p = (float)((m << 10)|(c<<2)|(l>>6)) + l1; |
115 |
p = (float)((m << 10)|(c<<2)|(l>>6)) + l1; |
113 |
|
116 |
|
114 |
return p; |
117 |
return p; |
115 |
} |
118 |
} |
116 |
|
119 |
|
117 |
|
- |
|
118 |
|
- |
|
119 |
|
- |
|
120 |
|
- |
|
121 |
|
- |
|
122 |
|
- |
|
123 |
|
- |
|
124 |
|
- |
|
125 |
|
- |
|
126 |
|
- |
|
127 |
|
- |
|
128 |
void main() |
120 |
void main() |
129 |
{ |
121 |
{ |
130 |
|
122 |
|
131 |
float p, t, a; |
123 |
float p, t, a; |
132 |
printf("Tlakomer nebo vyskomer \r\n",); |
124 |
printf("Tlakomer nebo vyskomer \r\n",); |
133 |
|
- |
|
134 |
|
- |
|
135 |
|
125 |
|
136 |
while(TRUE) |
126 |
while(TRUE) |
137 |
{ |
127 |
{ |
138 |
mpl3115_setP(); //nastaveni pro tlak a teplotu |
128 |
mpl3115_setP(); //nastaveni pro tlak a teplotu |
139 |
delay_ms (500); |
129 |
delay_ms (500); |