RTC and RFID

Hello LMR! This is sort-of a Two in one question. I need some assistance figuring how to hook up and program the following:

  1. RFID - I’ve been eying this for a while now: http://www.sparkfun.com/products/8419. I understand that pin 5 will tell you when a card is present, and 8 & 9 look like i2c, but what is pin 7 (format selector)? What sort of object (propeller) would I use to drive it, i2c? What about the cp pin?

  2. RTC - I’ve also wanted to do some experiments with this cool little chip: http://www.sparkfun.com/products/10160. I understand that data will be transferred while the chip is selected and the clock will synchronize it. But what are the serial commands to reques time/date, set things, etc. (if possible, I would like to run this off of an I/o expander, i2c, or serial controlled picaxe)

First up please loose the . at the end of your links :slight_smile:

The RFID reader has 3 modes of operation; ASCII, Magnetic Emulation, and Wiegand26. Unless you are trying to interface with something that is expecting Magnetic reader input, I would choose one of the other two options. That being the case, you won’t need the CP (Card Present). Also, according to the site, it should be used as a serial device @ 9600 bps. Check the datasheet for better/more info.

RTC

That clock uses an SPI connection which the propeller is quite happy to do, however dealing with the data when it comes in can be a little work. When I did it, I ended up finding some example code (in Arduino) and I simply translated. It isn’t too bad, but there is some bit-sifting involved and some other monkey-business. As an example (don’t use this, it will not compile):

 

PUB ReadTime   | n,i,a,b 



  i:=0 
  repeat 7
    if i==3
      i++
    low(rst)
    io.shiftout(dpin, cpin, io#MsbFirst,i+$00, 8)
    n:= io.shiftin(dpin, cpin, io#MsbPost, 8)
    high(rst)
    a:= (n&%00001111)

    if i==0  or i==1
      b:=(n&%01110000)>>4
      TimeDate[i]:=a+(b10)


             
    if i==2
      b:=(n&%00110000)>>4    '24 hour mmode
      if b==%00000010
        b:=20
      if b==%00000001
        b:=10
      TimeDate[i]:=a+b
       

    if i==4
      b:=(n&%00110000)>>4
      TimeDate[i]:=a+(b
10)

    if i==5    
      b:=(n&%00010000)>>4
      TimeDate[i]:=a+(b10)

    if i==6    
      b:=(n&%11110000)>>4
      TimeDate[i]:=a+(b
10)                 
    i++
   

** ctc, If this will work on**

 ctc, If this will work on arduino, how about picaxe:

if possible, I would like to run this off of an I/o expander, i2c, or serial controlled picaxe”

 

Yes, no no no

This will run fine off of X-series Picaxe chips but not the new M2’s (they don’t do SPI apparently).

 

if possible, I would like to run this off of an I/o expander, i2c, or serial controlled picaxe” <–You can’t, this is SPI.

 

Also, still sorta new to
Also, still sorta new to prop. code, some little “'notes” would be nice :slight_smile:

Tell you what…

This particular chip and thus the code to run it is a little funny. As you can see, data is shifted and dealt with in different ways as it come in. This has nothing to do with the Propeller or Spin, it is more so just the fact of how the chip operates. I could comment the above, but I don’t think it is going to do any good. Really, the notes are just going to say, “these bits get shifted 4 to the left then and’ed to this” etc. which doesn’t really get you anywhere. I think what you are asking is simply, “how do I make it go” which is a different question intirely. I can and probably will make an object out of this but to be honest, I have a bunch of stuff ahead of it right now. I am to understand that you don’t have this particular chip yet anyway.

Let me know if and when you actually buy and receive the break out board and we can go from there.

In the meantime, start reading up on SPI communication, check out the Arduino code (it is the only example code I can find) and see what you can get from it, and read your datasheet.

** well, like I said, I’m**

 well, like I said, I’m going to start with SD cards first, this is #11 on my current list. I’ll cross this bridge when I get to it. Thanks for the help :slight_smile:

So, any progress on that
So, any progress on that object yet :smiley: