RFID Keyless Ignition

Posted on August 17, 2010, 7:34 am UTC by Jake Saunders (about 1 year ago)

Code (highlighted for Text)

  1. Presets:
  2.  
  3. setfreq m8
  4. 'Double the clock freqency to double the serial comms baud rate
  5.  
  6. poke $90, 5
  7. 'Detune the internal clock oscilator (experiment with values 0 to 10)
  8. 'Choose the value that is lowest that works reliably then add one or 2
  9. 'to this
  10.  
  11.  
  12. Read_RFID:
  13. serin 3,N2400,b0,b0,b0,b0,b1,b2,b3,b4,b5 'reads the card/tag
  14. setfreq m4 ' reset to 4mhz to allow for onscreen debug
  15. debug b0 'Use on-screen debug to determine Card Numbers
  16. serout 0,N2400,(#b0,9,#b1,9,#b2,9,#b3,9,#b4,9,#b5,13,10)
  17.  
  18.  
  19. Check_List:'checks the cards numbers
  20.  
  21. if b1<>246 then
  22. goto Wrongcard
  23. endif
  24.  
  25. if b2=30 then
  26. goto Card
  27. endif
  28.  
  29. if b2=94 then
  30. goto Tag
  31. endif
  32.  
  33. goto Read_RFID
  34.  
  35.  
  36. Card:'just a last check to make sure its the right card
  37.  
  38. if b4<>19 then
  39. goto Wrongcard
  40. endif
  41.  
  42. if b5=159 then
  43. goto Correct
  44. endif
  45.  
  46. goto Read_RFID
  47.  
  48.  
  49. Tag: 'just a last check to make sure its the right card
  50.  
  51. if b4<>82 then
  52. goto Wrongcard
  53. endif
  54.  
  55. if b5=191 then
  56. goto Correct
  57. endif
  58.  
  59. goto Read_RFID
  60.  
  61. Correct:'right card so action.
  62. toggle 1 ' green LED
  63. toggle 2 ' Solid state relay
  64. goto Read_RFID
  65.  
  66. Wrongcard:
  67. toggle 4 'red lED
  68. pause 2000
  69. toggle 4
  70. goto Read_RFID

Comments

Code for Keyless ignition. Picaxe 08M and ID-12.