reading from adc3550 with PIC

Hi to all. I'd like to use built in uC (mikroe.com) routines to read data from microchip adc 3550. At page 21 of the datasheet... Quote:

It is required that the microcontroller SPI port be config- ured to clock out data on the falling edge of clock and latch data in on the rising edge. Figure 5-6 depicts the operation shown in SPI mode 1,1, which requires that the SCK from the MCU idles in the High state, while Figure 5-7 shows the similar case of SPI Mode 0,0, where the clock idles in the Low state. The waveforms in the figures are examples of an MCU operating the SPI port in 8-bit mode, and the MCP3550/1/3 devices do not require data in 8-bit groups. In SPI mode 1,1, data is read using only 24 clocks or three byte transfers. The data ready bit must be read by testing the SDO/RDY line prior to a falling edge of the clock. In SPI mode 0,0, data is read using 25 clocks or four byte transfers. Please note that the data ready bit is included in the transfer as the first bit in this mode.

How can these differents mode could be done ? Now i'm trying this...

Code:

void Spi_INIT_my() { Spi_Init_Advanced (MASTER_OSC_DIV4,DATA_SAMPLE_END ,CLK_IDLE_LOW,LOW_2_HIGH) ; SSPSTAT=3D0xC0; SSPCON=3D0x20; TRISB.F2=3D0; TRISB.F1=3D1; TRISB.F6=3D0; }

void Get_ADC_Value() {

unsigned long appo; pin_CS_ADC=3D0; b3=3DSpi_Read(0); b2=3DSpi_Read(0); b1=3DSpi_Read(0);

pin_CS_ADC=3D1; delay_ms(100); valore_ADC=3D0; appo=3Db3; appo=3Dappo

Reply to
merco
Loading thread data ...

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.