I2C Slave with PIC24F16KA301/302/304

Please add any feature requests for Flowcode version 7 here

Moderator: Benj

Post Reply
Jörg Güldner
Posts: 77
Joined: Wed Jun 22, 2011 3:32 pm
Has thanked: 17 times
Been thanked: 11 times
Contact:

I2C Slave with PIC24F16KA301/302/304

Post 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

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: I2C Slave with PIC24F16KA301/302/304

Post 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 262 times
Let us know how you get on.

Jörg Güldner
Posts: 77
Joined: Wed Jun 22, 2011 3:32 pm
Has thanked: 17 times
Been thanked: 11 times
Contact:

Re: I2C Slave with PIC24F16KA301/302/304

Post 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
Attachments
PIC24FV16KA301_I2C_Slave2_OK.fcfx
(11.6 KiB) Downloaded 240 times
CPU_I2C_master_write.pdf
(413.71 KiB) Downloaded 244 times

Post Reply