parthiv2eng
Member level 2
Hello, Here's my SPI.C file. I don't get any output from _RF8 or SDO1 port. Please Help..!!
Code:
[syntax=c]#include "main.h"
volatile SPI_STORE SPI_store;
void WriteSPI1(unsigned int data_out)
{
SPI1BUF = data_out & 0xff; /* byte write */
}
void InitSPI1()
{
TRISF = 0x0000; // output
SPI1CON1 = 0x0120;
SPI1STAT = 0x8000;
TCSSRC = 0;// make CSSRC pin output
CSSRC = 1;// de-select the Serial SRC
SPI_store.REG1 = 0xC0; // Track ON, Mode default
SPI_store.REG2 = 0x00; // Filter control register
SPI_store.REG3 = 0x11; // 24 bit i/o I2S format
SPI_store.REG4 = 10; // Initial value??
CSSRC = 0;// select the SRC4193
WriteSPI1(1);// write Reg Address (Byte 0)
WriteSPI1(0);// write Dummy (Byte 1)
WriteSPI1(SPI_store.REG1);// write Reg 1 (Byte 2)
WriteSPI1(SPI_store.REG2);// write Reg 2 (Byte 3) Auto Address increament
WriteSPI1(SPI_store.REG3);// write Reg 3 (Byte 4) Auto Address increament
WriteSPI1(SPI_store.REG4);// write Reg 4 (Byte 5) Auto Address increament
CSSRC = 1;// deselect to complete the buffer
}
[/syntax]