BS-1 meets DS3234 RTC
tomcrawford
Posts: 1,129
in BASIC Stamp
There was a BS-1 data logger discussion which touched on connecting a RTC to the BS-1. I thought I would give it a try. The attachments pretty much say it all, except:
1. I took advantage of the separate MOSI/MISO pins on the DS3234 to build a generalized ShiftInOut subroutine. 2. because BS-1 doesn't do SHIFTIN/SHIFTOUT. 3. I assumed BS-1 SEROUT had more formatting functions that it does (no HEX or BINOUT).
Comments
Of course you know that the BS1 has a very small memory. Here's an idea that may trim your shift code and speed it up a tiny bit.
You'll need to define MOSI like the MISO pin -- using a bit variable
Since that's an output, you'll need to do set it that way.
I typically set all my directions at once with DIRS = %????????.
Using W0 for your 16-bit shift value was smart in that it gives you access to bit variables. With them, I think you can shorten the shift routine to this:
Again, I write a lot of BS1 programs for our customers, so I'm always happy to see others doing it.
Well done.