5 \ Copyright (C) <2016> <J.M. THOORENS>
7 \ This program is free software: you can redistribute it and/or modify
8 \ it under the terms of the GNU General Public License as published by
9 \ the Free Software Foundation, either version 3 of the License, or
10 \ (at your option) any later version.
12 \ This program is distributed in the hope that it will be useful,
13 \ but WITHOUT ANY WARRANTY; without even the implied warranty of
14 \ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 \ GNU General Public License for more details.
17 \ You should have received a copy of the GNU General Public License
18 \ along with this program. If not, see <http://www.gnu.org/licenses/>.
22 \ R4 to R7 must be saved before use and restored after
23 \ scratch registers Y to S are free for use
24 \ under interrupt, IP is free for use
26 \ PUSHM order : PSP,TOS, IP, S, T, W, X, Y, R7, R6, R5, R4
27 \ example : PUSHM IP,Y
29 \ POPM order : R4, R5, R6, R7, Y, X, W, T, S, IP,TOS,PSP
32 \ ASSEMBLER conditionnal usage after IF UNTIL WHILE : S< S>= U< U>= 0= 0<> 0>=
33 \ ASSEMBLER conditionnal usage before GOTO ?GOTO : S< S>= U< U>= 0= 0<> <0
35 \ FORTH conditionnal usage after IF UNTIL WHILE : 0= 0< = < > U<
39 \ routines RTC for MSP430fr5xxx and MSP430FR6xxx families
40 \ target must have a LF_XTAL 32768Hz.
42 \ compile DTCforthMSP430FR5xxx.asm with the switch LF_XTAL set to ON (uncommment the line).
45 \ to set date, type : dd mm yyyy DATE!
46 \ to view date, type DATE?
47 \ to set time, type : hh mm ss TIME!, or hh mm TIME!
48 \ to view time, type TIME?
50 \ allow to write on a SD_Card file with a valid date and a valid time
52 \ ECHO ; if an error occurs during download, uncomment this line then download again
56 CODE MAX \ n1 n2 -- n3 signed maximum
64 CODE MIN \ n1 n2 -- n3 signed minimum
72 : U.R \ u n -- display u unsigned in n width
74 R> OVER - 0 MAX SPACES TYPE
81 BIT.B #RTCRDY,&RTCCTL1 \ test RTCRDY flag
82 0<> UNTIL \ wait until RTCRDY high
83 MOV &RTCYEARL,2(PSP) \ year
85 MOV TOS,0(PSP) \ month
86 MOV.B &RTCDAY,TOS \ day
95 MOV TOS,&RTCYEARL \ year
96 MOV.B @PSP,&RTCMON \ month \ @PSP+ don't work because byte format !
97 MOV.B 2(PSP),&RTCDAY \ day \ @PSP+ don't work because byte format !
107 MOV TOS,4(PSP) \ save TOS
109 BIT.B #RTCRDY,&RTCCTL1 \
110 0<> UNTIL \ wait until RTCRDY high
112 MOV TOS,2(PSP) \ seconds
114 MOV TOS,0(PSP) \ minutes
115 MOV.B &RTCHOUR,TOS \ hours
123 DEPTH 2 = IF 0 THEN \ to allow "hour min TIME!" scheme
125 MOV TOS,&RTCSEC \ seconds
126 MOV.B @PSP,&RTCMIN \ minutes \ @PSP+ don't work because byte format !
127 MOV.B 2(PSP),&RTCHOUR \ hours \ @PSP+ don't work because byte format !
139 CR CR ." DATE (DMY): "
140 ABUF ABUF 20 (ACCEPT) EVALUATE CR 3 SPACES DATE!
141 CR CR ." TIME (HMS or HM): "
142 ABUF ABUF 20 (ACCEPT) EVALUATE CR 3 SPACES TIME!
145 MOV #PSTACK,PSP \ to avoid stack empty error if lack of typed values.