BS-1 meets DS3234 RTC

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).
1202 x 690 - 105K
2048 x 1536 - 886K


  • JonnyMacJonnyMac Posts: 6,428
    edited 2017-03-28 - 17:31:43
    At EFX-TEK we have a controller called the Prop-1 which is very popular in the Halloween and Escape Rooms industries for simple props and puzzles. I've been programming the BS1 since 1994 and am always looking for code tricks.

    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.
    OUTPUT 6
    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:
      LOW CS                                        ' select device
      FOR bitc = 0 TO 15                            ' shift 16 bits
        MOSI = BIT15                                ' output msb
        sreg = sreg + sreg                          ' x2 = left shift by 1
        HIGH CLK                                    ' clock it
        LOW CLK
        BIT0 = MISO                                 ' get the input bit
    Again, I write a lot of BS1 programs for our customers, so I'm always happy to see others doing it.

    Well done.
Sign In or Register to comment.