Re: regarding SPI????
Hi viswanath,
You can definitely do it. I have implemented a couple SPI ASM routines, that are specific for my application, for a 8051 based design.
Although it is possible, it is not straight forward, since you have to consider how the SPI device you are communicating with is expecting the data to be sent.
SPI needs basically four lines for communications taking place:
MISO (Master In Slave Out, usually uC is master, other device is slave)
MOSI (Master Out Slave In)
CLK (a clock line, since SPI is a synchronous protocol)
SS (slave select)
A simple algorithm to send SPI data would be the following:
1. Make SS for the device you want to communicate low level
2. Put the bit to be sent in the MOSI line
3. Read the bit in the MISO line
4. Send a clock pulse
5. Repeat from 2 until all bits in the byte are sent and received
6. Repeat for each byte until all bytes are sent and received
7. Make SS high level
This is the basic algorithm; but is depends in your device if you have to send first the Most Significant Bit (MSBit) or the Least Significant Bit (LSBit), and even if you have to send first the MSByte or the LSByte. It also depends on your device if you have to send a low pulse or a high pulse on the clock line.
A good source of information would be your device's datasheet. Also take a look at wikipedia:
https://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus