AtomSoft
Well-Known Member
Hey all ive got my RFID from Parallax working fine. I can get data(keys) and it works well. My question is more on storing and testing data.
What would be the best way to store trusted "keys" so i can test them on user entered(waved) keys.
I was thinking eeprom but then i would have to make a routine just to store the data then what if there are doubles. How do i test? I manually entered 2 keys into eeprom of a 18F2525 and can turn on 2 LEDs depending on if i wave a card or keyring in front of module.
Or should i store it in seperate variables or 1 long variable. Since each key is 10 Bytes(12 if counting start and stop byte).
If i make a variable of 100 Bytes i can store 10 cards. which isnt a lot but will do for testing or home use i guess. But if its that small i can just make 10 separate variables.
Here is my current code im playing with:
EDIT:
I own 2 of these:
**broken link removed**
Its cool to see induction at work. I plugged one in and am using it. When i put the other one over the one thats powered the one thats not powered gets powered. And its awesome. Makes me want to make this for entry to my room. And if there is a blackout(no power in house) i can have a separate induction circuit to power the main one from a extrernal battery and use it to power/unlock the door in a "no power" situation.
What would be the best way to store trusted "keys" so i can test them on user entered(waved) keys.
I was thinking eeprom but then i would have to make a routine just to store the data then what if there are doubles. How do i test? I manually entered 2 keys into eeprom of a 18F2525 and can turn on 2 LEDs depending on if i wave a card or keyring in front of module.
Or should i store it in seperate variables or 1 long variable. Since each key is 10 Bytes(12 if counting start and stop byte).
If i make a variable of 100 Bytes i can store 10 cards. which isnt a lot but will do for testing or home use i guess. But if its that small i can just make 10 separate variables.
Here is my current code im playing with:
Code:
#include <p18f2525.h>
#include <stdio.h>
#include <string.h>
#include <usart.h>
#include <eep.h>
#pragma config WDT = OFF, LVP = OFF, OSC = INTIO67
/************************************
Prototypes
*************************************/
void main(void);
char MyID;
char tmp;
char tmpID[10];
char inputID[10];
/************************************
Main
*************************************/
void main(void){
char inputstr[12];
char y = 0;
char x = 0;
OSCCON = 0x72; //8MHz clock
while(!OSCCONbits.IOFS); //wait for osc stable
MyID = 0;
TRISA = TRISB = TRISC = 0;
TRISCbits.TRISC7 = 1;
OpenUSART( USART_TX_INT_OFF &
USART_RX_INT_OFF &
USART_ASYNCH_MODE &
USART_EIGHT_BIT &
USART_CONT_RX &
USART_BRGH_LOW,51);
while(1){
while(!DataRdyUSART());
getsUSART( inputstr, 12 );
if(inputstr[0] == 0x0A){
tryAgain:
if(MyID > 1)
MyID = 0;
x = MyID*10;
for(y=0;y<10;y++){
inputID[y] = inputstr[y+1];
tmpID[y] = Read_b_eep (x+y);
Busy_eep ();
}
if(memcmp(inputID,tmpID,10)){
if (MyID == 0) {
LATCbits.LATC2 = 0;
LATCbits.LATC3 = 1;
}
if (MyID == 1) {
LATCbits.LATC2 = 1;
LATCbits.LATC3 = 0;
}
} else {
LATCbits.LATC3 = 0;
LATCbits.LATC2 = 0;
MyID++;
goto tryAgain;
}
}
}
}
I own 2 of these:
**broken link removed**
Its cool to see induction at work. I plugged one in and am using it. When i put the other one over the one thats powered the one thats not powered gets powered. And its awesome. Makes me want to make this for entry to my room. And if there is a blackout(no power in house) i can have a separate induction circuit to power the main one from a extrernal battery and use it to power/unlock the door in a "no power" situation.
Last edited: