CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

SPI: żIt´s possible send 16 CLK´s on a SPI instruction?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
carm
Guest







SPI: żIt´s possible send 16 CLK´s on a SPI instruction?
PostPosted: Tue Jan 31, 2006 9:32 am     Reply with quote

I have a problem.
I have an ADC wich need 16 bit instructions (LTC1859).
If i use SPI instructions, i only can send 8 bits with CLK´s, and if i repeat the instruction with the correct code, appear a "dead time" between clk´s.
żIt´s possible make 2 byte intructions with SPI without the "dead time"?

Here is the code:


#include <16F873A.h>
#device adc=10
#device ICD=TRUE
#include <stdio.h>
#fuses XT,NOWDT,PUT,NOPROTECT,NOBROWNOUT,NOLVP
#use delay(clock=4000000)
#use rs232(baud=9600,xmit=pin_c6,rcv=pin_c7)



long conv=0,convh,convl;


void main (void){

setup_adc(adc_off);
setup_adc_ports(no_analogs); //configuro puerto A como digital

set_tris_a(0xFF);
set_tris_b(0xFF);
set_tris_c(0x92); //configuro puertos

setup_spi(spi_master|spi_l_to_h|spi_clk_div_4); //configuro modo SPI

output_low(pin_c2); //inicializo RD nivel bajo
output_low(pin_c0); //inicializo CONVST a nivel bajo



while(TRUE){

spi_write(0x84); //configuration to AD
spi_write(0x00); //send 0x00
output_high(pin_c0);

while (!input(pin_c1)){}
conv=spi_read(0); //
output_low(pin_c0);

printf("\n\r%ld",conv);
}//cierro while


}//cierro main
libor



Joined: 14 Dec 2004
Posts: 288
Location: Hungary

View user's profile Send private message

PostPosted: Tue Jan 31, 2006 11:06 am     Reply with quote

In synchronous data transfers (those with a CLK line) like SPI, there must be no problem having a 'dead time' anywhere in the data stream, that is the reason the CLK line is implemented for.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group