11 years, 8 months ago.

I2C programme with basic

hi ; can you give me how i can converts my programme from basic language to C language

2 Answers

11 years, 8 months ago.

Hi, Temam, can you put your code (use the <<code>> your code <</code>> tag for better understanding) to try to help you

Greetings

Accepted Answer

I use a thermal module for the detection of the wind in meteorological station ; the module IS http://www.lextronic.fr/P1728-capteur-thermique-mtp81.html

posted by temam rabah 17 Mar 2013
temam rabah
poster
11 years, 8 months ago.

Const Device=CB220
Dim errorcom As Byte
Dim version As Byte
Dim time As Byte
Dim pixel1 As Byte
Dim pixel2 As Byte
Dim pixel3 As Byte
Dim pixel4 As Byte
Dim pixel5 As Byte
Dim pixel6 As Byte
Dim pixel7 As Byte

Set I2c 9,10

Do
I2cstart
errorcom=I2cwrite(&HD)  ;             Adress of MSU08
errorcom=I2cwrite(0);
I2cstart ;
errorromI2cwrite(&HD1);
version=I2cread(0);
errorromI2cwrite(&HD1);
temp=I2Cread(0);
errorromI2cwrite(&HD1);
pixel1=I2cread(0);
errorromI2cwrite(&HD1);
pixel2I2cread(0);
errorromI2cwrite(&HD1);
pixel3I2cread(0);
errorromI2cwrite(&HD1);
pixel4I2cread(0);
errorromI2cwrite(&HD1);
pixel5I2cread(0);
errorromI2cwrite(&HD1);
pixel6I2cread(0);
errorromI2cwrite(&HD1);
pixel7I2cread(0);
I2Cstop;

Debug"Version software:";Dec version,Cr
Debug"temperature ambiante:",Dec temp," °C",Cr
Debug"temperature pixel1:",Dec pixel1,"°C",Cr
Debug"temperature pixel2",Dec pixel2"°C",Cr
Debug"temperature pixel3",Dec pixel3"°C",Cr
Debug"temperature pixel4",Dec pixel4"°C",Cr
Debug"temperature pixel5",Dec pixel5"°C",Cr
Debug"temperature pixel6",Dec pixel6"°C",Cr
Debug"temperature pixel7",Dec pixel7"°C",cr,cr
Delay3000
loop

hi temam, please surroung your code with the <<code>> <</code>> tag to make it readable

Thanks

posted by Ney Palma 17 Mar 2013

i will check your code in this days to see if i can help you

Greetings

posted by Ney Palma 18 Mar 2013

thanks !!!

posted by temam rabah 18 Mar 2013