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

slave address

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







slave address
PostPosted: Tue Jan 27, 2009 4:11 am     Reply with quote

Hello
i use i2c . in one method that we send slave address. i don't know what should i send. in my board i connect 24c16 to port A. what should i do. i think i need some explanation :( ?

this is my function :
unsigned char i2c_sendAddr(unsigned char addr)
{
//TWI transmit address in Master Transmit Mode
unsigned char STATUS;

if((addr & 0x01) == 0)
STATUS = MT_SLA_ACK;
else
STATUS = MR_SLA_ACK;

TWDR = addr; //load SLA+W into TWDR register
TWCR = (1<<TWINT)|(1<<TWEN);

while(!(TWCR & (1<<TWINT))); //wait for TWINT flag set to indicate that SLA_W has been transmitted

if ((TWSR & STATUS_MASK) == STATUS)//check value of TWI status that ACK bit has been received
return(0);
else
return(1);
}
marjan2121
Guest







PostPosted: Tue Jan 27, 2009 5:24 am     Reply with quote

i wanna to write on external EEPROM that is on 24C16. i should write 2 method read and write. i found that i should do this work with i2c ( i didn't have any knowledge about them) . i use code vision for implementing code. as you know in code vision , there is i2c.h and you can use this. and in manual can say that witch pins of portA (for example) is SDA and SCL.

i didn't use methods of i2c . i use another implementation of methods .
i am confuse now that how can connect with EEPROM . it should have a slave address ?

many question

can you help me.....
:(
Marjan
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Jan 27, 2009 2:45 pm     Reply with quote

Use the driver that comes with the CCS compiler. Here is the location:
Quote:
c:\program files\picc\drivers\2416.c
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