PDA

View Full Version : Saving RFID Data



Pesticida
- 29th January 2008, 16:25
Hi,

I search the Best way to save RFID Data !

Did some one have experience what I should use EEprom or something else.

I Try with 24C08 but the problem is that I have a adress byte but how this can work when I go for example to adress 512 this is more then a byte.

Adress var byte
Adress = 512 but this is not byte anymore

I2CWrite sda,scl,%10101000,Adress,[$00,$16,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$0 0,$00,$00,$00]

Thanks for any example.

Regards Pesti

skimask
- 29th January 2008, 18:11
Hi,
I search the Best way to save RFID Data !
Did some one have experience what I should use EEprom or something else.
I Try with 24C08 but the problem is that I have a adress byte but how this can work when I go for example to adress 512 this is more then a byte.
Adress var byte
Adress = 512 but this is not byte anymore
I2CWrite sda,scl,%10101000,Adress,[$00,$16,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$0 0,$00,$00,$00]
Thanks for any example.
Regards Pesti

Then I suppose your address might magically become a WORD just like the good book says in the I2CWrite section...and I quote:

The Address size sent (byte or word) is determined by the size of the variable that is used. If a byte-sized variable is used for the Address, an 8-bit address is sent. If a word-sized variable is used, a 16-bit address is sent. Be sure to use the proper sized variable for the device you wish to communicate with. Constants should not be used for the Address as the size can vary dependent on the size of the constant. Also, expressions should not be used as they can cause an improper Address size to be sent.

Pesticida
- 29th January 2008, 18:40
Hi,

Thank you !
I understand what you mean but on the PDF File for the 24C08 they says that the adress is just a byte and not a word.

Now my question is how can I write for example on adress 512 or 700 when I can just use a byte adress and not a word.

For the 24c02 and 24c01 I dont have Problems but when I need more then 256 bytes I can not read or write.
Can I use this I2CWrite sda,scl,$A9,here >512<here,[Tmp_Data]

Thanks

Regards Pesti

Pesticida
- 29th January 2008, 18:48
Ok!

I found that the 24C08 have 2 Blocks but thats mean that each block have 512 Bytes!
how can I read or write the first block or the second!?

I have just a byte adress!

regards Pesti

skimask
- 29th January 2008, 18:57
Ok!
I found that the 24C08 have 2 Blocks but thats mean that each block have 512 Bytes!
how can I read or write the first block or the second!?
I have just a byte adress!
regards Pesti

Now the answer you want is in the I2CREAD section instead of the I2CWRITE, which, incidentally, goes hand in hand with I2CREAD, because to I2CREAD something, first you have to I2CWRITE something, unless you would rather I2CREAD an empty chip, which isn't really empty, but full of no data, and sometimes no data is better than some data, either of which can be I2CREAD quite effectively, and either of which can be I2CWRITTEN over to replace either the no data or the some data which will be I2CREAD later on.

Pesticida
- 29th January 2008, 19:48
Thats mean i must use something like this:

EraseEEprom= $A8
EEprom_Block = 0
Tmp_Daten = $00

EraseEEprom:
Erase_Loop:
for NextAdr = 0 to 255
I2CWrite sda,scl,EEprom_Adresse,NextAdr,[Tmp_Daten]
pause 10
Sound Buzzer,[122,1]
next NextAdr
EEprom_Adresse = EEprom_Adresse + 2
EEprom_Block = EEprom_Block + 1
if EEprom_Block => 4 then EEprom_Block = 0 : goto Exit_Loop2
goto Erase_Loop
Exit_Loop2:
Sound Buzzer,[122,250]
goto Main


Regards pesti

skimask
- 29th January 2008, 20:20
Make it easy on yourself, get a 24C256, 32k x 8 eeprom. Word address, byte data

I2Cwrite datapin, clockpin, $a0, address, data

But if you're hellbent on using the 24c08...

address var word 'only use lower 10 bit
addr var byte
control var byte

addr = address.lowbyte
control = $a0 + ( address.highbyte << 2 )
i2cwrite datapin, clockpin, control, address, data-whatever

Pesticida
- 29th January 2008, 20:54
OK,

I must write this :
Control = $A1
For address = 0 to 1023
addr = address.lowbyte
control = $a0 + ( address.highbyte << 2 )
I2CRead sda, scl,Control, addr,[EEprom_Daten[Byte_Count]]
Pause 10
Byte_Count = Byte_Count + 1
if Byte_Count > 15 then
Byte_Count = 0
HSEROUT [DEC3 NextAdr-15, ": ",HEX2 EEprom_Daten[0],HEX2 EEprom_Daten[1],HEX2 EEprom_Daten[2],HEX2 EEprom_Daten[3],HEX2 EEprom_Daten[4],HEX2 EEprom_Daten[5],HEX2 EEprom_Daten[6],HEX2 EEprom_Daten[7],DEC2 EEprom_Daten[8],DEC2 EEprom_Daten[9],DEC2 EEprom_Daten[10],DEC2 EEprom_Daten[11],DEC2 EEprom_Daten[12],DEC2 EEprom_Daten[13],HEX2 EEprom_Daten[14],HEX2 EEprom_Daten[15],13,10]
endif
next address

Or I make again a mistake ?!

Regards Pesti

skimask
- 29th January 2008, 21:18
Or I make again a mistake ?!

Regards Pesti

I don't know. Does it work?
If it does, then you didn't make a mistake.
If it doesn't, then there must be a flaw in your logic.

Pesticida
- 30th January 2008, 15:41
Hi

No this dont work!

My chip have the Pin E2 to VCC thats mean The Device Adress is :10101000 for Write and
10101001 For Reading.

I try all combination but dont work.

Regards Pesti

skimask
- 30th January 2008, 17:24
Hi

No this dont work!

My chip have the Pin E2 to VCC thats mean The Device Adress is :10101000 for Write and
10101001 For Reading.

I try all combination but dont work.

Regards Pesti

Ok, is it the serial part that's not working?
The EEPROM is returning bad data?
Is the program running?
Which is it?
Think simple...build it up...
Make the LED blink...Show some data on the LED...Make the HSEROUT work
I know you don't have an LED here...maybe you should put one there eh?

Pesticida
- 30th January 2008, 19:16
Hi,

im so Stupid I forgott something important ,on the Chip I forgott to set WC Low,and i use now more pause to write and to read data.
Now is working but what i don't understand ,on the 24C02 i dont set wc too and has working!

What you think is this a good Idea to use 24c chips to store rfid tags data,the chips have a 1000.000 write cyclus.

When I write on one day Double (Write and Erase) I have then on one Day maybe 4 Write Cycle.

Thank You

Regards Pesti

mister_e
- 30th January 2008, 19:52
depending the warranty and service you want to provide... but you could use F-RAM instead


Endurance
Internally, a FRAM operates with a read and restore
mechanism. Therefore, endurance cycles are applied
for each read or write cycle. The FRAM architecture
is based on an array of rows and columns. Rows are
defined by A8-A2. Each access causes an endurance
cycle for a row. Endurance is virtually unlimited. At
3000 accesses per second to the same segment, it will
take more than 10 years to reach the endurance limit.

not bad ;)

Pesticida
- 30th January 2008, 20:21
Thank You Mister_e

The RFID Data will be stored on the 24C and then Send trough GPRS Transmitter to Central Unit.

If all is ok the data will be Erased.

And I have again free space for new data.

Regards Pesti

Pesticida
- 31st January 2008, 19:27
Ok

All work fine now but :-)

I receive the data from rfid reader in ascii i use to receive data on the pic this:

Serin2 PortD.0,84,[Wait("E0") ,Daten[6],Daten[5],Daten[4],Daten[3],Daten[2],Daten[1],Daten[0]]

Daten[7] = $E0

but when I send to pc and to LCD with this

HSEROUT [hex2 Daten[7],hex2 Daten[6],hex2 Daten[5],hex2 Daten[4],hex2 Daten[3],hex2 Daten[2],hex2 Daten[1],hex2 Daten[0],13,10]

Lcdout $fe,$80,hex2 Daten[7],hex2 Daten[6],hex2 Daten[5],hex2 Daten[4],hex2 Daten[3],hex2 Daten[2],hex2 Daten[1],hex2 Daten[0]

I receive on the PC and on the LCD this : E030343031303030

I don't have found the way to convert to hex I need Hex on PC and on LCD.

Thanks

Regards Pesti

skimask
- 31st January 2008, 20:12
All work fine now but :-)
I receive the data from rfid reader in ascii i use to receive data on the pic this:
Serin2 PortD.0,84,[Wait("E0") ,Daten[6],Daten[5],Daten[4],Daten[3],Daten[2],Daten[1],Daten[0]]
Daten[7] = $E0
but when I send to pc and to LCD with this
HSEROUT [hex2 Daten[7],hex2 Daten[6],hex2 Daten[5],hex2 Daten[4],hex2 Daten[3],hex2 Daten[2],hex2 Daten[1],hex2 Daten[0],13,10]
Lcdout $fe,$80,hex2 Daten[7],hex2 Daten[6],hex2 Daten[5],hex2 Daten[4],hex2 Daten[3],hex2 Daten[2],hex2 Daten[1],hex2 Daten[0]
I receive on the PC and on the LCD this : E030343031303030
I don't have found the way to convert to hex I need Hex on PC and on LCD.
Thanks
Regards Pesti

Have you opened your PicBasicPro manual since you bought PicBasicPro?
What do you think the HEX2 does FOR you?
Take the HEX2 out of your HSEROUT and you'll get raw data.

Pesticida
- 31st January 2008, 20:26
Hi

Yes I read the book and i now that hex is to convert decimal in hex !
I think i have a serial problem i have read more rfid chips and i receive always the same serial.

Thank you

Regards Pesti

Pesticida
- 31st January 2008, 21:56
Hi

Yes I now what is happen the rfid send ascii,the pic receive the ascii and convert all the characters in decimal values 0 is 30 ,4 is 34 and so on.
Than I have more than 8 bytes I have 16 bytes.
I must now convert the decimals in hex,while i need hex data.

I try with hex but dont work!

Regards Pesti

skimask
- 31st January 2008, 22:07
Hi
Yes I now what is happen the rfid send ascii,the pic receive the ascii and convert all the characters in decimal values 0 is 30 ,4 is 34 and so on.
Than I have more than 8 bytes I have 16 bytes.
I must now convert the decimals in hex,while i need hex data.
I try with hex but dont work!
Regards Pesti

Re-Read Post #16...then refer to your PBP on the proper use of SERIN/SEROUT/(etc) available modifiers and you WILL have your answer. I understand what you want, but I'm not going to give you the answer you need because you have all of the resources you need to get that answer...and you might learn something.

Pesticida
- 31st January 2008, 22:49
Sorry Skimask!

When I have 30 34 30 31 thats mean i need a modifier with 4 to have 04 and 01.

Regards Pesti

skimask
- 1st February 2008, 03:07
Sorry Skimask!
When I have 30 34 30 31 thats mean i need a modifier with 4 to have 04 and 01.
Regards Pesti

Yes, I know...and your answer awaits...

Pesticida
- 1st February 2008, 10:38
Hi,:-)

I Use this:

DEBUGIN [WAIT("E0"),dec4 Daten[14], dec4 Daten[13], dec4 Daten[12], dec4 Daten[11], dec4 Daten[10], dec4 Daten[9], dec4 Daten[8],dec4 Daten[7], dec4 Daten[6], dec4 Daten[5], dec4 Daten[4], dec4 Daten[3], dec4 Daten[2], dec4 Daten[1],dec4 Daten[0]]

While DEBUGIN more fast is,but i have now more bytes this is not what I want.

And that with Raw data what you have mean is working: :-)

HSEROUT ["E0",Daten[14], Daten[13],Daten[12], Daten[11], Daten[10], Daten[9], Daten[8], Daten[7], Daten[6], Daten[5], Daten[4], Daten[3], Daten[2], Daten[1],Daten[0],13,10]

What is if I use instead dec4 hex modifier,can I reduce my bytes!?

Thank you Skimask

Regards Pesti

Pesticida
- 1st February 2008, 18:50
This is the Solution :-)

DEBUGIN [WAIT("E0"),Daten[13],Daten[12],Daten[11], Daten[10], Daten[9],Daten[8], Daten[7],Daten[6], Daten[5], Daten[4], Daten[3], Daten[2], Daten[1], Daten[0]]
Pause 50
for N = 13 to 1 step - 2
Daten[N]= ((Daten[N]-$30) *10) + (Daten[N-1]-$30)
Pause 5
next N
High Led_Tag
Gosub ReadTime
Gosub Read_BCD

HSEROUT ["E0",hex2 Daten[13],hex2 Daten[11],hex2 Daten[9],hex2 Daten[7],hex2 Daten[5],hex2 Daten[3],hex2 Daten[1],13,10]

Regards Pesti

skimask
- 1st February 2008, 19:17
That wasn't quite the solution I was going for, but what you've got will work just fine.

One thiing to note...in the first line below:

Daten[N]= ((Daten[N]-$30) *10) + (Daten[N-1]-$30)

You might want to put in some code for checking an out-of-bounds condition.

Pesticida
- 1st February 2008, 19:26
Hi Skimask,

What you mean with out of bond!?

Did you mean when I receive a wrong character.

Regards Pesti

skimask
- 1st February 2008, 22:02
Hi Skimask,
What you mean with out of bond!?
Did you mean when I receive a wrong character.
Regards Pesti

What happens if you get a character that you weren't expecting? One with a value too low or too high...

For instance:
Daten[N]= ((Daten[N]-$30) *10) + (Daten[N-1]-$30)

What happens if the value in 'Daten[N]' or 'Daten[N-1] is $30? is $20? is $0?

Pesticida
- 2nd February 2008, 06:39
Hi,

Ok this is a very good argument ! :-)

Is good that you have warnning me I forgot this :-(

I think that i should the Data discard !

Or I think wrong !?

Something like this:

Bad_Data var bit
Bad_Data = 0

Data_Check:
for N = 0 to 13
If Daten(N) < $30 then Bad_Data = 1 : Daten(N) = $30
Next N
Select case Bad_Data
case 0 ' it's all ok
for N = 13 to 1 step - 2
Daten[N]= ((Daten[N]-$30) *10) + (Daten[N-1]-$30)
Pause 5
next N
case 1 ' no good :-)
Bad_Data = 0
Goto Warning or something like that
end select

If I have Daten[N] = $30 this is not bad while $30-$30 = 0

Regards Pesti