Hali cooldmann!
"A valós idejű ora irása és olvasása számomra érthetetlen."
Nem dolgozok 200-assal, de az óra olvasására a READ_RTC az óra beállítására a SET_RTC hívás való.
Egy paramétert (címet kell neki megadni)
"The Read Real-Time Clock (TODR) instruction reads the current time and date from the hardware clock and loads it in an 8-byte Time buffer starting at address T.The Set Real-Time Clock (TODW) instruction writes the current time and date to the hardware clock beginning at the 8-byte Time buffer address specified by T."
Pár fontos momentum a dologgal kapcsolatban.
- Az időt 8 bte-ban adja vissza illetve 8 bíte-ban kell neki megadni.
- A hívás paraméterében ennek a 8 byte-nak az első byte-ját kell megadni
- Az átadott 8 byte BCD formátumú kell hogy legyen!
A SET_RTC-nél oda kell figyelni a korrekt dátum megadására (pl. január 74 hibás) de emiatt a szökőévekre is figyelni kell a februárnál)
A 8 byte tartalma:
T Byte Description Byte Data
0 year (0-99) current year (BCD value)
1 month (1-12) current month (BCD value)
2 day (1-31) current day (BCD value)
3 hour (0-23) current hour (BCD value)
4 minute (0-59) current minute (BCD value)
5 second (0-59) current second (BCD value)
6 00 reserved – always set to 00
7 day of week (1-7) current day of the week, 1=Sunday (BCD value)