Hallo,
hab gerade geschafft, die Zeit vom DS3234 auf dem LCD MI0283QT2 anzuzeigen.
Komme aber nicht klar, die Temperaturdaten aufzubereiten. Die Abfrage erfolgt so :
void ReadTemperatur(){
digitalWrite(cs, LOW);
SPI.transfer(0x11);
unsigned int nt = SPI.transfer(0x00);
digitalWrite(cs, HIGH);
temph=nt;
digitalWrite(cs, LOW);
SPI.transfer(0x12);
unsigned int nt1 = SPI.transfer(0x00);
digitalWrite(cs, HIGH);
templ=nt1;
}
Wer kann mir helfen. Werte werden zwar übertragen, aber es feht eine Umwandlung.
Du kannst aber auch die Funktion der Bibiothek verwenden.
Das Datenblatt sagt:
Temperature Registers (11h–12h)
Temperature is represented as a 10-bit code with a resolution
of 0.25°C and is accessible at location 11h and
12h. The temperature is encoded in two’s complement
format, with bit 7 in the MSB representing the SIGN bit.
The upper 8 bits, the integer portion, are at location 11h
and the lower 2 bits, the fractional portion, are in the
upper nibble at location 12h. Example: 00011001 01b =
+25.25°C. Upon power reset, the registers are set to a
default temperature of 0°C and the controller starts a
temperature conversion.
The temperature is read on initial application of VCC
and once every 64 seconds afterwards. The temperature
registers are updated after each user-initiated conversion
and on every 64-second conversion. The
temperature registers are read-only.
habe das Beispiel angepasst, ausprobiert und es funktioniert. Danke !
Für die aktuelle Anwendung hat es aber keinen Zweck, RTC sitzt zwischen LCD und mSD-Shield und zeigt
eine unsinnige Temperatur an. Für weitere Anwendungen steht es dann aber zur Verfügung.
Noch eine Frage, warum schreibt man oft "int8_t" statt "int", ist es nur zur Speicherplatzeinsparung oder hat es noch einen
anderen Grund ?