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

two codes

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



Joined: 19 Jul 2009
Posts: 11

View user's profile Send private message

two codes
PostPosted: Tue Aug 04, 2009 3:20 pm     Reply with quote

I have two set of functions named as same Writetoreg (byte).
I am bit confused to see them as I don't know what is actually happening in them , my 1st effort will be to understand this.
I am talking about the SSPBUF and SSPIF things in this.. thanks.
Code:

void Writetoreg(int byteword)
{
   PORTA &= 0x04;   
   SSPBUF = byteword;
   while ( !(PORTA & 0x04) )
      ;
   PORTA |= 0x20;      
}


void Writetoreg(int byteword){
 PORTA &= 0x05;             
 SSPBUF = byteword;
 do
 {
    ;
 }while(SSPIF==0);
 SSPIF=0;
 while(!(PORTA&0x04)){     
  ;
 }
}
mkuang



Joined: 14 Dec 2007
Posts: 257

View user's profile Send private message Send e-mail

PostPosted: Tue Aug 04, 2009 3:32 pm     Reply with quote

What are you trying to do exactly? Is there any reason why you are not using the build-in spi_read() and spi_write() functions with the CCS compiler?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Aug 04, 2009 3:39 pm     Reply with quote

Please don't start a new thread every time you have a new question
on using the SSP module. You already have an existing thread here:
http://www.ccsinfo.com/forum/viewtopic.php?t=39789

Just add new questions on the SSP module (or SPI) to one thread.
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