Last active
September 9, 2016 13:46
-
-
Save Tamakichi/d755dd7d5d7da49fcf9a6e3ade2e6e1a to your computer and use it in GitHub Desktop.
IchigoJam RTC DS3231利用サンプルソースその3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 'RTC DS3231 | |
20 'T="16090805190630":GSB @SET | |
30 CLS:M=#700:A=#68:POKE M,0:L=0:S=M+16 | |
40 LET [0],31599,4681,29671,29647,23497,31183,31215,29257,31727,31695,0,1040,672 | |
50 LET [20],11,11,10,12,12,10:X=2:Y=13 | |
60 FOR I=0 TO 12:FOR J=14 TO 0 STEP -1 | |
70 IF ([I]>>J)&1 D=1 ELSE D=32 | |
80 POKE S+L,D:L=L+1:P=-1 | |
90 NEXT:NEXT | |
100 GOSUB @PDT | |
110 @LP | |
120 R=I2CR(A,M,1,M+1,7) | |
130 IF PEEK(M+5)<>P P=PEEK(M+5):GOSUB @PDT | |
140 GSB @PTM | |
150 GOTO @LP | |
160 @SET:N=M+7 | |
170 FOR I=T TO T+13 STEP 2 | |
180 POKE N,(PEEK(I)-48)<<4+PEEK(I+1)-48:N=N-1 | |
190 NEXT | |
200 R=I2CW(A,M,1,M+1,7) | |
210 RTN | |
220 @PTM:FOR I=0 TO 4:LC X,Y+I:K=20 | |
230 FOR J=2TO0STEP -1:D=PEEK(M+1+J):E=S+I*3 | |
240 ?STR$(E+(D>>4)*15,3);" ";STR$(E+(D&15)*15,3);STR$(E+[K]*15,3); | |
250 K=K+1:NEXT:NEXT | |
260 RTN | |
270 @PDT:FOR I=0 TO 4:LC 0,5+I:K=23 | |
280 FOR J=6TO 4 STEP -1:D=PEEK(M+1+J):E=S+I*3 | |
290 ?STR$(E+(D>>4)*15,3);" ";STR$(E+(D&15)*15,3);" ";STR$(E+[K]*15,3);" "; | |
300 K=K+1:NEXT:NEXT | |
310 RTN |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
プログラムソースでは時刻を設定する箇所をコメントアウトしています。
20 'T="16090805190630":GSB @set
設定時は有効にして時刻設定します。
Tの文字列は左から
西暦下2桁、月2桁、日2桁、曜日2桁(01が日、02が月・・・07が土)、時2桁、分2桁、秒2桁
です。
"16090805190630"は、
16/09/08 05(=木曜) 19:06:30
を意味します。曜日の指定は1:日曜 2:月曜 ~ 7:土曜です。