electroRF
Member
Hi,
I got PIC18F (master) and I2C GLCD (Slave).
I managed to draw shapes in the GLCD, meaning, the I2C works well.
Now, before moving on to do some complicate stuff, like drawing pictures, I'd like to settle on a method.
I got a few questions and I'd appreciate your guide lines.
1.
when master loads SSPBUF with a byte, it waits for an ACK from the slave via - while (ACKSTAT) (ACKSTAT is cleared when ACK is received, and set when not).
The problem is that code will be stuck there if no ack is received from slave.
How should it be done then?
And what should be done if ack is not received - should I send Stop bit and start all over again?
How much time should I wait for an ACK before calling that no ACK was received?
2.
When Master receives bytes from Slave, should it ACK each byte?
The Slave datasheet doesn't say anything about it, so I guess I should do some trial and error?
3.
You think that it's OK to work without interrupts, or if I want to get PRO, interrupts are better.
Thanks guys
I got PIC18F (master) and I2C GLCD (Slave).
I managed to draw shapes in the GLCD, meaning, the I2C works well.
Now, before moving on to do some complicate stuff, like drawing pictures, I'd like to settle on a method.
I got a few questions and I'd appreciate your guide lines.
1.
when master loads SSPBUF with a byte, it waits for an ACK from the slave via - while (ACKSTAT) (ACKSTAT is cleared when ACK is received, and set when not).
The problem is that code will be stuck there if no ack is received from slave.
How should it be done then?
And what should be done if ack is not received - should I send Stop bit and start all over again?
How much time should I wait for an ACK before calling that no ACK was received?
2.
When Master receives bytes from Slave, should it ACK each byte?
The Slave datasheet doesn't say anything about it, so I guess I should do some trial and error?
3.
You think that it's OK to work without interrupts, or if I want to get PRO, interrupts are better.
Thanks guys