if(state < 0x80) //Master is sending data
{
incoming = i2c_read();
if(state == 1) //First received byte is address
address = incoming;
if(state == 2) //Second received byte is data
buffer[address] = incoming;
}
if(state == 0x80) //Master is requesting data
{
i2c_write(buffer[address]);
}
}
I tried to simulate it on PROTEUS - ISIS.
I had to replace
Code:
if(state == 1)
to
Code:
if(state == 0)
and
Code:
if(state == 2)
to
Code:
if(state == 1)
to make it work.
Where's the bug? CCS or PROTEUS?
(I didnt try it physically)
Thanks
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
Posted: Thu Nov 02, 2006 1:07 am
The i2c_isr_state() function looks at the DA and RW bits in the SSP
control registers. If Proteus emulates those bits incorrectly, then
you will have a problem.
If you want to research it further, here is some more information
on the i2c_isr_state() function:
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