[Flashforth-devel] Latest Flashforth - DS1307 driver anomaly?
Brought to you by:
oh2aun
From: Christian H. <hin...@ou...> - 2023-01-07 22:40:06
|
Hi to all members of the Flashforth support team. I recently experimented with the DS1307 based TinyRTC module and FlashForth 5 ATmega328 19.11.2022. I noticed that the i2c.ds1307.n@ word in i2c-ds1307.fs is returning 1 extra byte when attempting to read 8 registers starting at register address 0. 8 0 i2c.ds1307.n@ ok<$,ram> 7 17 16 6 7 1 23 93 ff I can prevent this by using 7 instead of 8 in my example, but then n is no longer the number of bytes to be read. Instead, I modified the original code to subtract 1 from the number of bytes to read (8 in my example). Should the original code be corrected to be: : i2c.ds1307.n@2 ( n addr -- ) ds1307.addr! addr-ds1307 i2c.read 1- for i2c.c@.ack next i2c.c@.nack i2c.stop ; Thanks again for the great Flashforth on AVR and PIC MCUs. Christian Hinse |