This is my first working version (00.4). But I don't have any I2C devices to test it with other than the Q68's built in RTC chip.
Is anyone prepared to do some testing with external I2C devices to see if it is working OK.
At the moment the driver is only running at a clock speed of about 34KHz. The next job is to try to get it up to the standard 100KHz
This test program will set and read the Q68's Real Time Clock
Code: Select all
100 REMark *** Q68 I2C test program ***
110 REMark Martin Head 24/03/2022
120 REMark Version 00.4
130 c=RESPR(2000)
140 LBYTES dos1_i2c_q68_BIN,c
150 PRINT "code loaded at ";c,HEX$(c,32)
160 CALL c
170 PRINT " II_DRIVE at ";PEEK_L(c+4),HEX$(PEEK_L(c+4),32)
180 STOP
190 :
200 REMark Tests
210 :
220 REMark Read Q68 backup clock
230 x$=CHR$(164)& CHR$(0) : REMark Address device
240 x$=x$&CHR$(4)&CHR$(188) : REMark Read 4 bytes
250 x$=x$&CHR$(255) : REMark Terminate cmd
260 t$=I2C_IO(x$,4,104,1)
270 :
280 REMark Result from RTC will be in little edian format
290 PRINT DATE$(2^24*CODE(t$(4))+65536*CODE(t$(3))+256*CODE(t$(2))+CODE(t$(1)))
300 STOP
310 :
320 REMark Set the Q68 backup clock
330 REMark Set RTC to 21/3/2022 ($73261E0F)
340 REMark Note send in little edian format
350 x$=CHR$(164)&CHR$(0)&CHR$($F)&CHR$($1E)&CHR$($26)&CHR$($73)
360 x$=x$&CHR$(255) : REMark Terminate cmd
370 t$=I2C_IO(x$,4,104,5)
380 STOP
390 :