// * I2C INTERRUPT HANDLER *****************************************************
#int_ssp
void i2c_handler(void) {
int8 state, incoming;
state=i2c_isr_state();
if(state<0x80) { // Master is sending data
incoming = i2c_read(1);
if(state==1) mem_addr=incoming; // Store the address
if(state==2) card_data[mem_addr]=incoming; // Read and store the data
}
if(state>=0x80) { // Master is requesting data
i2c_write(card_data[mem_addr]); // Write the memory over i2c
}
}
// *****************************************************************************
jeremiah
Joined: 20 Jul 2010 Posts: 1371
Posted: Fri Aug 02, 2013 9:41 am
One thing to note on #use i2c(). At some point in the early 4.100's, they swapped to 7bit addressing for the address parameter. They did switch back to 8bit addressing later on, but I dont' remember which versions were affected. You might try changing the address in your #use i2c() to 7 bit format for the 4.124 version and see if that works. If not, make sure to swap back to 8bit so you don't forget.
muhibraza1
Joined: 26 Jul 2013 Posts: 23
Posted: Mon Aug 05, 2013 6:48 am
I am thankful to all of you for your valuable comments. the errata thing was the actual problem. It wasted so many days.
After ticking the Dont Do BSR15, I can see the system is not hanging at least. Now I am making tweaks and trying to understand the basic i2c communication.
All times are GMT - 6 Hours Goto page Previous1, 2
Page 2 of 2
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