Sir, I am learning SPI interfacing. I am using P89V51RD2FA microcontroller. And I have to interface it with a device using SPI interface but the problem is that I don't know what to do when I have to obtain data more than one byte.
Like in my case I need 3 bytes of data from the device. So after the usual write commands(giving command to read and the register to be read) and all, I am supposed to send some dummy byte which will be 0s. I wish to know that will the device return me three bytes just by one dummy byte or I need to send one dummy byte for each byte to be received.
That's a pretty common chip, and a very common interface.
Have you searched for examples?
What peripheral, specifically, are you trying to use? Again, have you searched for examples?
"send some dummy byte which will be 0s"
If you send any dummy bytes, 0xFF is more likely to be appropriate...
thanks for ur posts...
I wish to interface the microcontroller with ADE7753(which is a energy metering chip) . Yes I checked the examples but generally all examples are for single byte. I am not able to find any example for more than one byte...
"And sending 0xFF will be better" Can u tell the reason behind this?? It will make the concept more clear.
I didn't actually say that; what I said was,
"0xFF is more likely to be appropriate"
The reason being that the idle state is usually high - so sending FF is effectively doing nothing!
okk...thanks for ur reply
Really?!
Just googling "ADE7753 SPI" gave this:
www.avrfreaks.net/index.php
great thanks seriously I never got that result... thanks again
Sir, the code is not completely correct. Also there is some confusion it will be simpler if u could tell me how to send three bytes.
According to me since SPI is duplex there should be no problem if I do in the following way
like sending word dummy byte data obtained 1st byte dummy byte data obtained second byte dummy byte data obtained 3rd byte
each dummy byte I send will return me a byte of data due to shift registers present. Is it the correct way???? For doing this I will be making use of interrupt signal.
View all questions in Keil forum