Hallo
wie kann ich mit dem DS1621 eine Temperatur auslesen? ich habe schon einige Beispielprogramme versucht. Der liefert mir aber nur komische zahlen. wie muss ich denn diese zahl abspeichern?
Ich habe mir dieses Programm mal geschrieben. Ist das schon annähernd richtig?
Code:$regfile = "M32def.dat" ' chip $crystal = 16000000 ' frequenz $baud = 19200 ' baud rate $lib "i2c_twi.lbx" ' we do not use software emulated I2C but the TWI Config Scl = Portc.0 ' we need to provide the SCL pin name Config Sda = Portc.1 ' we need to provide the SDA pin name I2cinit ' we need to set the pins in the proper state Config Twi = 100000 ' wanted clock frequency 'will set TWBR and TWSR 'Twbr = 12 'bit rate register 'Twsr = 0 'pre scaler bits Dim T As Word Do I2creceive &H90 , T Print "T= " ; T Print "receive" ; Err Waitms 500 Loop End







Zitieren

Lesezeichen