Page 1 of 1

I2C Slave with PIC24F16KA301/302/304

Posted: Sat Jan 13, 2018 10:02 am
by Jörg Güldner
Hello Matrix team,
I already describe in the 16bit area this following situation:
I need to fix a problem in replacing a 16 bit IO I2C with a controller.

The Master sends at 100 kHz without time-out:
chip-address + R/W -/- register-address -/- databyte
In this case, the pic24 has about 50us to receive and process the data.

The I2C component allows only 1 Byte to read and write to the slave.
An interrupt for I2C channel 1 or 2 could resolve the problem, but is not present
in the interrupt icon.

Trying himself was without succes, because the compiler stops with errors.
I´m working with I2C-Slave 1 + 2 and some sfr-keywords are missing.
Can you have a look to them and write a example for interrupt?



Best regards
Jörg

Re: I2C Slave with PIC24F16KA301/302/304

Posted: Mon Jan 15, 2018 12:03 pm
by Benj
Hi Jörg,

I've added the I2C slave interrupts to the attached definition files. Simply extract the files to your "Flowcode 7/FCD/PIC16" folder and restart Flowcode.
PIC16.zip
(54.82 KiB) Downloaded 271 times
Let us know how you get on.

Re: I2C Slave with PIC24F16KA301/302/304

Posted: Thu Jan 18, 2018 6:08 pm
by Jörg Güldner
Hello Benj,
I try with PIC24FV16KA301 and it works, well done.
We will now replace a lot of components in our new design.
My simple program is attached. I send from a master two 3bytes values to the slave
and do some restriction with the result to a port pin.
With these possibility I could write a slave with 126 addresses and 255 registers.

Thanks
Jörg