Line 3... |
Line 3... |
3 |
#define S_SDA PIN_C3 |
3 |
#define S_SDA PIN_C3 |
4 |
#define S_SCL PIN_C4 |
4 |
#define S_SCL PIN_C4 |
5 |
#use i2c(master, sda=S_SDA, scl=S_SCL) |
5 |
#use i2c(master, sda=S_SDA, scl=S_SCL) |
6 |
#use rs232(baud=9600,parity=N,xmit=PIN_B3,rcv=PIN_B2,bits=8) //rcv TXD xmit RXD |
6 |
#use rs232(baud=9600,parity=N,xmit=PIN_B3,rcv=PIN_B2,bits=8) //rcv TXD xmit RXD |
7 |
|
7 |
|
- |
|
8 |
//Adresa pro VDD, VDD, VDD W 0x9E R 0x9F |
- |
|
9 |
//Adresa pro GND GND GND W 0x90 R 0x91 |
8 |
|
10 |
|
9 |
void main() |
11 |
void main() |
10 |
{ |
12 |
{ |
11 |
|
13 |
|
12 |
setup_adc_ports(NO_ANALOGS|VSS_VDD); |
14 |
setup_adc_ports(NO_ANALOGS|VSS_VDD); |
Line 29... |
Line 31... |
29 |
{ |
31 |
{ |
30 |
|
32 |
|
31 |
|
33 |
|
32 |
|
34 |
|
33 |
i2c_start(); |
35 |
i2c_start(); |
34 |
I2C_Write(0x9E); |
36 |
I2C_Write(0x90); |
35 |
I2C_write(0x00); |
37 |
I2C_write(0x00); |
36 |
i2c_stop(); |
38 |
i2c_stop(); |
37 |
i2c_start(); |
39 |
i2c_start(); |
38 |
I2C_Write(0x9F); |
40 |
I2C_Write(0x91); |
39 |
MSB=i2c_read(1); |
41 |
MSB=i2c_read(1); |
40 |
LSB=i2c_read(0); |
42 |
LSB=i2c_read(0); |
41 |
i2c_stop(); |
43 |
i2c_stop(); |
42 |
|
44 |
|
43 |
t = (float)(LSB)/256.0; |
45 |
t = (float)(LSB)/256.0; |