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

I2C QUESTION2

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







I2C QUESTION2
PostPosted: Sat Sep 09, 2006 12:14 pm     Reply with quote

HI!I am a student!
i am writted my homework about i2c use!
but i test my written code,always find a question,
please everbody can teach my ,question exp:
*************************************************************
slave here:

#include <16F77.h>
#use delay(clock=4000000)
#fuses XT,WDT
#include "lcd.c"
#use i2c(SLAVE,address=0XA0,sda=PIN_C4,scl=PIN_C3,slow)

INT8 GG;

void main()
{
int i;


WHILE(!I2C_POLL())
{
GG=i2c_read();
BREAK;

}
LCD_INIT();
DELAY_MS(200);
LCD_GOTOXY(1,1); PRINTF(LCD_PUTC,"\fGG=%d",GG);
}
***********************************************************
master here!
#include <16F77.h>
#use delay(clock=4000000)
#fuses XT,noWDT
#use i2c(Master,sda=PIN_C4,scl=PIN_C3,slow)


int8 dk;


void main()
{

while(1)
{
i2c_start();
i2c_write(0xA0);
i2c_write('a');

i2c_stop();
i2c_start();
i2c_write(0xA1);
dk=i2c_read();
i2c_stop();
output_high (PIN_B7);
DELAY_MS(1000);
output_LOW (PIN_B7);
//IF (DK==9)
// {BREAK;}
}
}
***************************************************
i find lcd panel display a number (-96)
and i master want to send a english word .exp "A"
i must how written it . thks
i dont find question or variant code error area,
please everone can teach me ,thks
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Sep 09, 2006 12:29 pm     Reply with quote

There is no need to start a new thread every time you have another
question on i2c. I answered your question in the original thread just
two minutes ago.
cjusto



Joined: 26 Apr 2006
Posts: 38
Location: Portugal

View user's profile Send private message

PostPosted: Sat Sep 09, 2006 12:31 pm     Reply with quote

Hi! the -96 you got, is the adress.


u should read the next byte received from the i2c bus.
whung.john
Guest







how to rewritten thread code
PostPosted: Sun Sep 10, 2006 12:21 am     Reply with quote

cjusto wrote:
Hi! the -96 you got, is the adress.
u should read the next byte received from the i2c bus.


****************************************************
i understand for sir say method,but i
not method can rewritten the slave area,
so sir can help me ,how to clearly change the error get information ,
can u help me ?thks very much !
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