Libstock prefers package manager

Package Manager

We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]

Project Request

Return
Jaskaran Singh
jsbhalla88

posted on 2015/04/13 02:52:28 PM CEST

Internal MCU modules

hardware UART and hardware/software IC2 on PIC16F1618/PIC16F1708

I am trying to get UART and I2C work on PIC16F1618 and PIC16F1708, one at a time.
I could not get it working on pic16f1618, so I tried on pic16f1708. but couldn't get it working on that either.
I have worked on hardware uart with pic18f45k22..
I need sample code for hardware UART, hardware I2C and software I2C.
I am using "MikroC for PIC", which has all the libraries built in, but somehow they aren't working for me., or I am doing something wrong this time. I got software UART working, but not hardware UART, hardware I2C and software I2C.
Also, I don't know how to use "remappable" functions.

I will be very grateful if someone can post a sample code for the above mentioned PICs.

Thanks.

USER Comments

Mike Kehrli
mikekehrli

posted on 2018/09/14 10:00:28 PM CEST

I have found documentation to be sparse for i2c. But I just worked out how to get i2c comm going with i2c eeprom, and posted the code. It's for the 18f45k22, but it worked fine with pic16f886. You just have to change the pic chip and the analog select register variables for you pic chip.

You can find my code here: https://libstock.mikroe.com/projects/view/2571/i2c-eeprom-example . Its in visual basic, but it will be easy to convert to c. It is a copy of the example code that comes with the compilers, but has a few errors fixed and more explanation of how things work. Hope it helps.

  • Rating:
0
No Abuse Reported

Do you want to report abuse comment ID: 2142 in "hardware UART and hardware/software IC2 on PIC16F1618/PIC16F1708" request.