|
|
View previous topic :: View next topic |
Author |
Message |
WHUNG.JOHN Guest
|
I2C QUESTION2 |
Posted: Sat Sep 09, 2006 12:14 pm |
|
|
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
|
|
Posted: Sat Sep 09, 2006 12:29 pm |
|
|
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
|
|
Posted: Sat Sep 09, 2006 12:31 pm |
|
|
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 |
Posted: Sun Sep 10, 2006 12:21 am |
|
|
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 ! |
|
|
|
|
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
|