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 support@ccsinfo.com

read_spi

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



Joined: 12 Dec 2003
Posts: 16

View user's profile Send private message

read_spi
PostPosted: Fri Feb 06, 2004 9:07 pm     Reply with quote

Can anybody help me to find my code bug? I can not read any data by 3 wire SPI. Thanks!

Code:

unsigned long read_spi()
{
   byte i;
   unsigned long data16=0;
   
   write_spi(0x04);
   write_spi(0x28);
   delay_us(10);
   output_low(MAX1463_CS);
   delay_us(10);
   for(i=0; i<16;++i) {     
      if (input(MAX1463_DO)) bit_set(data16, i);
  //    shift_left(&data16, 1, input(MAX1463_DO));   //I tried this way too
      delay_us(5);
      output_high(MAX1463_CLK);
      delay_us(5);
      output_low(MAX1463_CLK);
      delay_us(5);
   }       
   delay_us(10);
   output_high(MAX1463_CS);
   return(data16);
}
Neutone



Joined: 08 Sep 2003
Posts: 839
Location: Houston

View user's profile Send private message

PostPosted: Fri Feb 06, 2004 9:29 pm     Reply with quote

That chips loaded. I would get the dev kit.
The MAX1463EVKIT Setup and Functional Verification

You might want to lower the chip select before you try talking to it.
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