BBCBasic – Z80-MBC2

Here you can see the adaptation of the test program for the RTC of the z80-MBC2 mother board in BBCBasic. The data from the RTC is obtained through the MCP23017 GPIO. 

10 CLS
20 REM PUT 1, numero -> accende la periferica numero
30 REM PUT 0, 1 ON
40 REM PUT 0, 0 OFF
50 REM if GET(0)=1 high input
60 REM if GET(0)=0 low input
70 PUT 1,132
80 SECONDO=GET(0)
90 MINUTO=GET(0)
100 HORA=GET(0)
110 GIORNO=GET(0)
120 MESE=GET(0)
130 ANNO=GET(0)
140 TEMP=GET(0)
160 ANNO = ANNO + 2000
170 SECONDO$ = STR$(SECONDO): SECONDO$ = RIGHT$("00"+RIGHT$(SECONDO$,LEN(SECONDO$)),2)
180 MINUTO$ = STR$(MINUTO): MINUTO$ = RIGHT$("00"+RIGHT$(MINUTO$,LEN(MINUTO$)),2)
190 HORA$ = STR$(HORA): HORA$ = RIGHT$("00"+RIGHT$(HORA$,LEN(HORA$)),2)
200 GIORNO$ = STR$(GIORNO): GIORNO$ = RIGHT$("00" + RIGHT$(GIORNO$, LEN(GIORNO$)), 2)
210 MESE$ = STR$(MESE): MESE$ = RIGHT$("00" + RIGHT$(MESE$, LEN(MESE$)), 2 )
220 ANNO$ = STR$(ANNO): ANNO$ = RIGHT$("0000" + RIGHT$(ANNO$, LEN(ANNO$)), 4)
230 PRINT CHR$(27);"[0;0H";GIORNO$;"/";MESE$;"/";ANNO$;" ";HORA$;":"; MINUTO$;":";SECONDO$
240 PRINT TEMP;"C"
250 PUT 1,128
260 IF GET(0) = 1 THEN END
270 GOTO 70

For an explanation of RTC I / O see at

https://automatico.freevar.com/index.php/z80-mbc2/mcp-23017-gpio/

Loading