谢谢你的帮助,非常感谢。微笑:好的,我已经修改了i2cx写()函数,以便它轮询ACKSTAT,并将该值保存到变量NoToACK。如果变量是“1”,我调用I2C*WrreEsStutter()函数。I2CyWrad将返回变量NoToACK。我已经修改了所有调用I2CX写的函数,以便检查该函数的返回。如果(NOTIACK){返回;}从函数中跳出并跳回到主()中。AddisSpCn2BITS.ACKDT=1;在读取I2CX Read SoSo中的SSPBUF之后。我还添加了一些对LCD的调用,用于在I2C*Read短()中进行故障排除。LCDSGOOTYY(1, 1);PrtTf(“是”);I2CyReaveEnabable();//启用SurvivCDGoToYy(1, 2);PrtTf(“使它”);“是”显示在我的LCD屏幕上,但是“使”不是。
以上来自于百度翻译
以下为原文
Thanks for your help, it's much appreciated. Smile:
Okay, I have modified the i2c_write() function so that it polls ACKSTAT and saves the value to a variable not_ack. If the variable is '1', I call my i2c_write_stop() function. i2c_write will return the variable not_ack.
I have modified all of the functions calling i2c_write so that it will check the return from that function.
if(not_ack){
return;
}
To break out of the function and jump back to main().
I've added SSPCON2bits.ACKDT = 1; after I read the SSPBUF in the i2c_read_short() and i2c_read_byte() functions.
I also added some calls to my LCD for troubleshooting in i2c_read_short().
lcd_gotoxy( 1, 1);
printf("yes");
i2c_receive_enable(); // enable receive
lcd_gotoxy( 1, 2);
printf("made it");
The 'yes' is showing up on my lcd screen, but the 'made it' is not.
Attachment(s)
Battery_OneWire_LCD.c (65.55 KB) - downloaded 69 times
谢谢你的帮助,非常感谢。微笑:好的,我已经修改了i2cx写()函数,以便它轮询ACKSTAT,并将该值保存到变量NoToACK。如果变量是“1”,我调用I2C*WrreEsStutter()函数。I2CyWrad将返回变量NoToACK。我已经修改了所有调用I2CX写的函数,以便检查该函数的返回。如果(NOTIACK){返回;}从函数中跳出并跳回到主()中。AddisSpCn2BITS.ACKDT=1;在读取I2CX Read SoSo中的SSPBUF之后。我还添加了一些对LCD的调用,用于在I2C*Read短()中进行故障排除。LCDSGOOTYY(1, 1);PrtTf(“是”);I2CyReaveEnabable();//启用SurvivCDGoToYy(1, 2);PrtTf(“使它”);“是”显示在我的LCD屏幕上,但是“使”不是。
以上来自于百度翻译
以下为原文
Thanks for your help, it's much appreciated. Smile:
Okay, I have modified the i2c_write() function so that it polls ACKSTAT and saves the value to a variable not_ack. If the variable is '1', I call my i2c_write_stop() function. i2c_write will return the variable not_ack.
I have modified all of the functions calling i2c_write so that it will check the return from that function.
if(not_ack){
return;
}
To break out of the function and jump back to main().
I've added SSPCON2bits.ACKDT = 1; after I read the SSPBUF in the i2c_read_short() and i2c_read_byte() functions.
I also added some calls to my LCD for troubleshooting in i2c_read_short().
lcd_gotoxy( 1, 1);
printf("yes");
i2c_receive_enable(); // enable receive
lcd_gotoxy( 1, 2);
printf("made it");
The 'yes' is showing up on my lcd screen, but the 'made it' is not.
Attachment(s)
Battery_OneWire_LCD.c (65.55 KB) - downloaded 69 times
举报