Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Are data bytes random or not?

Status
Not open for further replies.

ghoral

Newbie level 6
Joined
Apr 4, 2019
Messages
13
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
113
mfrcwrite.png


Here,after sending register address of Mfrc522 what data bytes are send (I mean are they random values or they are specified) and what is upto n bytes..does it mean I have 2 send 2 8 bytes because the rc522 card consists of 12 bit number.
 

Never random - what good would that do?

It means there are three or more bytes:
Byte 1: is the device ID according to the I2C spec, it selects the device in case there are other I2C devices on the same bus.
Byte 2: having selected the device with byte 1, this selects which register inside that device the following data is to go to.
Byte 3 and onwards: the actual data to be written to the selected register in the selected device.

Some registers need a single byte, some need several bytes so after byte 1 and 2, you send as many as required.

Brian.
 

Yes I wanted to know about byte no 3..my actual question was what are byte 3....What bytes should I write in the register.
 

Hi,

You want to write to a register. Why?

Do you know which chip? (Byte1)
Do you know which register? (Byte2)
Do you know what data? (Byte3) If not, why do you want to write?

Klaus
 

I Know 1 and 2..The device is MFRC522 with address 0x50 and I want to write to FiFO register of address 0x09 now what byte I should send It is not given in datasheet..My purpose is to read the card data through rfid..and the data consist of 12 number..So are the data bytes just random or are the specified. here is the write and read function.

edab.png
 

I do not understand your question. If the number could be random what would be the point in using it?

When writing ANY data to something you need to know two basic things: where to write it and what to write. Where to write it is defines in Bytes 1 and 2, what to write depends on the register, its purpose and what you want it to do. The data sheet should tell you what the bits in the registers do and what values they should hold to configure the device for writing or reading.

Brian.
 

Hi,

I'm also confused by your question.

Writing data is like sending a mail.
Let's imagine you decided to write a mail to your friend.(address)
The content of the mail is words (data).

It makes sense to write useful words like "Happy birthday".
But what's the idea behind writing random words like "eifszj xdg kk fhjbc"?

For sure you can write random data to the FIFO, but tell us why?

Klaus
 

Read data of MFRC522. You write like this

I2C start
I2C Write device address
I2C Write Register address (Register address will be mentioned in datasheet of MFRC522)
I2C Write (byte 1) (the value that is to be written to register, (to the register that you selected in second I2C Write())
//If you need to write more data (bytes) to the same selected register) then send more bytes as below.
I2C Write (byte 2)
I2C Write (byte 3)
I2C Write (byte 4)
I2C Write (byte 5)
//Also while using I2C Write() many times in sequence you might need to issue I2C_Repeated_Start()
I2C Stop

Post datasheet of MFRC522.

I guess your for(j = 0... loop is wrong. It is incrementing i and not j. Is it intentional or a mistake? Also why RFID instead of RFID[j] in the loop?
 
Last edited:

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top