Any success to use I2C module with 18FxxK42 on MikroC pro?

mikroC, mikroBasic and mikroPascal PRO for Microchip’s 8-bit PIC MCUs.
Post Reply
Author
Message
gfaman
Posts: 3
Joined: 11 Feb 2021 09:38

Any success to use I2C module with 18FxxK42 on MikroC pro?

#1 Post by gfaman » 04 Oct 2021 05:03

Hi,
I'm struggling to make work I2C module (different from other PIC18) on the 18F26K42.
MikroC Pro is using special routine for this PIC and so far, cannot make it work.
Init is done and code block on the first I2C1_Wr operation. On the scope, SDA/SCL jump high and stayed there. No start ever send.
Display SSD1380 is connected to normal RC3 and RC4.
Tried many things, mapping with PPS, open drain, etc...
Anyone succeed to use this integrated module with MikroC pro ?

Thanks,

Laurent

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: Any success to use I2C module with 18FxxK42 on MikroC pro?

#2 Post by filip » 05 Oct 2021 10:58

Hi,

Please find the example for the EEPROM that uses I2C on PIC18F47K42, it is from the same family as PIC18f26K42.

Regards,
Filip.
Attachments
EasyPIC_v8-master-SW-HW Rev 0.74-DIP40 PIC18F47K42-I2C-I2C mikroBUS2.zip
(8.11 KiB) Downloaded 71 times

gfaman
Posts: 3
Joined: 11 Feb 2021 09:38

Re: Any success to use I2C module with 18FxxK42 on MikroC pro?

#3 Post by gfaman » 06 Oct 2021 06:22

Thanks, will try. Very simple your code.
Yesterday found a way to make it work:
- Need use PPS to redeclare the I2C RC3 and RC4 despite same value than the default value after POR
- Found that the I2C addr need be in 7 bits (with 0 at b7) as a left shift will be done to add R/W in the I2C_Wr routine
- Found that if the I2C addr is wrong or not device with this address, the I2C_Wr is dead loop

BR,

Laurent

Post Reply

Return to “PIC PRO Compilers”