Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
I am using a PIC18F47K42 (the master) and a PIC18F46K22 (the slave). The bus also has an i2c display and using code generated from MCC. The issue that I am having is that the slave will interrupt for either address. How can I address this in the software? I thought that it only interrupted on an address match.
I am using 7 bit. I have attached a copy of the logic - Ch0 = SDA, Ch1 = SCL. The first byte is the address sent to the slave (0x18 << 1) and then the second byte is suppose to be the register (0x02) to read but that isn't sent. If I read this correct the logic low after the 9th clock is an ACK (by hardware) and then it looks like the slave is clock stretching. At the end the master sends a P because on no ACK is that correct?
Do you have 0x90 in SSPADD and 0xFF in SSPMASK? The clock stretching looks like it's just so the slave can do the address comparison. If you were in 10 bit mode the clock stretching will last until SSPADD is loaded with the low byte. Does an interrupt happen?
I assume that you're referring to the slave - SSP1ADD = 0x30, SSP1MSK = 0x30. The SSP1MSK was @0x18, but I forgot about the left shift and changed it to match the address. I only have the BLC and the SPI interrupts enabled, SEN = 1 for clock stretching, AHEN = 0, DHEN = 0, yes I do get an interrupt. I have attached the source files that were generated by MCC.