Fri Jun 22, 2007 4:43 pm
Fri Jun 22, 2007 4:56 pm
Mon Jun 25, 2007 9:39 am
public class DS75 extends I2cTerminal {
double d;
int t;
public DS75(I2cDriver driver, int adr){
super(driver, adr);
}
public double getTemp(){
int [] t = new int[2];
try {
t= recevoirOctets(2);
} catch (Exception e) {
e.printStackTrace();
}
//t = recevoirOctets(2);
t[0]=1;
//t[0]=!t[0]; // 0xFF-t[0];
//t[1];
try {
t = envoyerEtRecevoirOctet(0);
} catch (Exception e) {
e.printStackTrace();
}
// beginning 9
d=t[0];
if (t[1]!=0)
d=d+0.5;
// end of 9
// beginning 10
d = t[0];
d=d+((t[1]&0xA0)/64)*0.25;
// end of 10
// beginning 11
d=t[0];
d=d+((t[1]&0xB0)/64)*0.125;
// end of 11
// beginning 12
d=t[0];
d=d+((t[1]&0xC0)/64)*0.0625;
// end of 12
return d;
}
public static void main(String[] args){
try {
DS75 ds75 = new DS75(new I2cDriver(new I2cHardware("COM1")), 0x90);
System.out.println(ds75.getTemp());
} catch (Exception e) {
e.printStackTrace();
}
}
}
Mon Jun 25, 2007 4:48 pm
import javax.comm.*;
Mon Jun 25, 2007 4:53 pm
Mon Jun 25, 2007 4:58 pm
Mon Jun 25, 2007 5:04 pm
Tue Jun 26, 2007 2:17 pm
Tue Jun 26, 2007 4:14 pm
temparray[0]=12.2d;
Tue Jun 26, 2007 4:51 pm
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.