set80rtc.bas 536 B

123456789101112131415161718192021222324
  1. 100 REM **** Set MAX80 RTC ****
  2. 110 DIM T%(8%)
  3. 120 OUT 1%,54%
  4. 130 I%=0%
  5. 140 IF I%>8% THEN 320
  6. 150 IF (INP(1%) AND 130%)=2% THEN 190
  7. 160 Z%=INP(0%)
  8. 170 I%=I%+1%
  9. 180 GOTO 140
  10. 190 IF INP(0%)<>211% THEN 320
  11. 200 ; "YYYY,MM,DD,HH,MM,SS";
  12. 210 INPUT T%(1%),T%(2%),T%(3%),T%(4%),T%(5%),S6
  13. 220 T%(0%)=T%(1%)/100%
  14. 230 T%(1%)=T%(1%)-T%(0%)*100%
  15. 240 T%(6%)=S6 : T%(7%)=(S6-T%(6%))*100
  16. 250 OUT 2%,64%
  17. 260 IF (INP(1%) AND 65%)<>65% THEN 320
  18. 270 FOR I%=0% TO 7%
  19. 280 OUT 0%,T%(I%)
  20. 290 NEXT I%
  21. 300 OUT 2%,4%
  22. 310 END
  23. 320 ; "No MAX80 RTC detected"
  24. 330 END