Moin
Ich habe in Bascom einen code für einen DS1624 gefunden.
wenn ich meinen Atmega8 damit beschrieben habe, dann bekomme ich im Terminal emulator so Zeichen:Code:$regfile = "m8def.dat" 'Define the chip you use $baud = 19200 'Define UART BAUD rate 'Declare RAM for temperature storage Dim I2ctemp As Byte 'Storage for the temperature 'Configure pins we want to use for the I²C bus Config Scl = Portd.1 'Is serial clock SCL Config Sda = Portd.3 'Is serial data SDA 'Declare constants - I2C chip addresses Const Ds1721wr = &B10010000 'DS1624 Sensor write Const Ds1721rd = &B10010001 'DS1624 Sensor read 'This section initializes the DS1624 I2cstart 'Sends start condition I2cwbyte Ds1721wr 'Sends the address 'byte with r/w 0 'Access the CONFIG register (&HAC address byte) I2cwbyte &HAC 'Set continuous conversion (&H00 command byte) I2cwbyte &H00 I2cstop 'Sends stop condition Waitms 25 'We have to wait some time after a stop I2cstart I2cwbyte Ds1721wr 'Start conversion (&HEE command byte) I2cwbyte &HEE I2cstop Waitms 25 'End of initialization Print 'Print empty line Do 'Get the current temperature I2cstart I2cwbyte Ds1721wr I2cwbyte &HAA 'Read temperature (&HAA command byte) I2cstart I2cwbyte Ds1721rd 'The chip will give register contents 'Temperature is stored as 12,5 but the ,5 first I2crbyte I2ctemp 'So you'll have to read twice... first the ,5 I2crbyte I2ctemp , Nack 'And then the 12... we don't store the ,5 I2cstop 'That's why we read twice. 'We give NACK if the last byte is read 'Finally we print Print "Temperature: " ; Str(i2ctemp) ; " degrees" ; Chr(13); Waitms 25 Loop End
woran kann das liegen ? ich weiß echt nicht weiter.Code:xàø€€€€€x€xþ€xà€x€x€xþ€xxxøxøxx€xà€xüxxøxà€x€xàø€€€€€x€xþ€xà€x€x€x þ€xxxøxøxx€xà€xüxxøxà€x€xàø€€€€€x€xþ€xà€x€x€xþ€xxxøxøxx€xà€xüxx øxà€x€xàø€€€€€x€xþ€xà€x€x€xþ€xxxøxøxx€xà€xüxxøxà€x€xàø€€€€€x€xþ€xà €x€x€xþ€xxxøxøxx€xà€xüxxøxà€x€xàø€€€€€x€xþ€xà€x€x€xþ€xxxøxøxx€ xà€xüxxøxà€x€xàø€€€€€x€xþ€xà€x€x€xþ€xxxøxøxx€xà€xüxxøxà€x€xàø€€€€€ x€xþ€xà€x€x€xþ€xxxøxøxx€xà€xüxxøxà€x€xàø€€€€€x€xþ€xà€x€x€xþ€xxx øxøxx€xà€xüxxøxà€x€xàø€€€€€x€xþ€xà€x€x€xþ€xxxøxøxx€xà€xüxxøxà€x€ xàø€€€€€x€xþ€xà€x€x€xþ€xxxøxøxx€xà€xüxxøxà€x€xàø€€€€€x€xþ€xà€x€x€x þ€xxxøxøxx€xà€xüxxøxà€x€xàø€€€€€x€xþ€xà€x€x€xþ€xxxøxøxx€xà€xüxx øxà€x€xàø€€€€€x€xþ€xà€x€x€xþ€xxxøxøxx€xà€xüxxøxà€x€xàø€€€€€x€xþ€xà €x€x€xþ€xxxøxøxx€xà€xüxxøxà€x€xàø€€€€€x€xþ€xà€x€x€xþ€xxxøxøxx€ xà€xüxxøxà€x€xàø€€€€€x€xþ€xà€x€x€xþ€xxxøxøxx€xà€xüxxøxà€x€xàø€€€€€ x€xþ€xà€x€x€xþ€xxxøxøxx€xà€xüxxøxà€x€xàø€€€€€x€xþ€xà€x€x€xþ€xxx øxøxx€xà€xüxxøxà€x€xàø€€€€€x€xþ€xà€x€x€xþ€xxxøxøxx€xà€xüxxøxà€x€ xàø€€€€€x€xþ€xà€x€x€xþ€xxxøxøxx€xà€xüxxøxà€x€xàø€€€€€x€xþ€xà€x€x€x þ€xxxøxøxx€xà€xüxxøxà€x€xàø€€€€€x€xþ€xà€x€x€xþ€xxxøxøxx€xà€xüxx øxà€x€xàø€€€€€x€xþ€xà€x€x€xþ€xxxøxøxx€xà€xüxxøxà€x€xàø€€€€€x€xþ€xà €x€x€xþ€xxxøxøxx€xà€xüxxøxà€x€xàø€€€€€x€xþ€xà€x€x€xþ€xxxøxøxx€ xà€xüxxøxà€x€xàø€€€€€x€xþ€xà€x€x€xþ€xxxøxøxx€xà€xüxxøxà€x€xàø€€€€€ x€xþ€xà€x€x€xþ€xxx
Vielen Dank, Lg 2A







Zitieren

Lesezeichen