A shorter get.rtc for the PCF8563 RTC library:

: get.rtc ( -- tos> YY MM WD DD HH MM SS )
2                     \ start address
1 i2c_addr_rtc >i2c   \ send > rtc
7 i2c_addr_rtc <i2c   \ read 7 Bytes
>r >r >r >r >r >r >r  \ removes garbage
r> $7f and      \ SS
r> $7f and      \ MM
r> $3f and      \ HH
r> $3f and      \ DD
r> $07 and      \ WeekDay
r> $1f and      \ MONTH
r> $ff and      \ YY
;

Ex:
> printdate.rtc
2010/09/09-04-10:44:48 ok
> 
p.


------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Amforth-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/amforth-devel

Reply via email to