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

Burr-Brown ads1211

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



Joined: 28 Apr 2004
Posts: 14

View user's profile Send private message

Burr-Brown ads1211
PostPosted: Wed Apr 28, 2004 2:42 am     Reply with quote

Hi to everybody !

I try to use the A/D in the subject with a Pic microcontroller, but I have some problem with the serial comunication.

Someone had just use this IC ?

Thanx
Haplo



Joined: 06 Sep 2003
Posts: 659
Location: Sydney, Australia

View user's profile Send private message

PostPosted: Wed Apr 28, 2004 3:02 am     Reply with quote

Give us more information about the PIC you are using and your setup, and post your code.
Inkwaterman



Joined: 28 Apr 2004
Posts: 14

View user's profile Send private message

PostPosted: Wed Apr 28, 2004 3:28 am     Reply with quote

I use a Pic 18f252 and these are my routine for write ad read through the SPI:


void write_spi(byte data)
{
byte i;
for(i=0; i<8; i++)
{
output_high(PIN_C3);
delay_us(10);
if(bit_test(data,7)) output_high(PIN_C5);
else output_low(PIN_C5);
output_low(PIN_C3);
delay_us(10);
data <<= 1;
}
delay_ms(11);
}


BYTE read_spi()
{
byte i, data=0;

delay_us(10);
for(i=0; i<8;i++)
{
output_high(PIN_C3);
delay_us(10);
if(input(PIN_C5)) bit_set(data, i);
output_low(PIN_C3);
delay_us(10);
}
return(data);
}


I found, in one example for jar compiler, a reset routine for the serial communication. I try to use it but the problems remains.

This is the reset routine (I'm sorry for the unpolite code ; ) ):

void reset_ADS()
{
output_high(PIN_C3);
delay_us(10);
output_low(PIN_C3);
delay_us(10);
output_high(PIN_C3);
delay_us(10);
output_low(PIN_C3);
delay_us(10);
output_high(PIN_C3);
delay_us(10);
output_low(PIN_C3);
delay_us(10);
output_high(PIN_C3);
delay_us(10);
output_low(PIN_C3);
delay_us(10);
output_high(PIN_C3);
delay_us(10);
output_low(PIN_C3);
delay_us(10);
delay_ms(100);
}



Regard
Neutone



Joined: 08 Sep 2003
Posts: 839
Location: Houston

View user's profile Send private message

PostPosted: Wed Apr 28, 2004 7:51 am     Reply with quote

You should read the manual/help file reguarding the commands shift right and shift left. Performing a bit test/set with a variable bit location is a very dificult task to generate assembly code for. The compiler can do it but it's not efficient. The examples in the manual/help file are just what you need.
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