Jump to content
Sign in to follow this  
mityeltu

Simple Working I2C Master And Slave + Uart

Recommended Posts

After searching for a long time to find some decent working examples (that I could understand and follow), I managed to cobble together a very basic, simple working example of I2C master and slave. In additon, the master communicates via UART through MAX232 to the PC serial port. This is NOT elegent, but it does work.

 

The hardware is a pair of 16F1519 with internal 8MHz oscillator, resistor on the SDA and SCL (I2C) buses are 4.7k to VCC (+5V), LED is on both master and slave at PORTD.1 (pin 14), MAX232 chip is interfaced per the attached drawing using info from the datasheet. Tha's all there is... well, and the serial cable which follows the attached drawing. (NOTE: if the picture of the connections is too small, I found it here: http://microcontrollerprojects00.blogspot.com/2012/03/pic-serial-communication-tutorial-uart.html

 

The terminal program I am using is Realterm 2.0.0.70 - make sure you change the port to 9600 baud and set the port to whatever your serial port is (Port 1 on my laptop) and click "Change"

 

I hope this helps others.

 

Happy coding,

mit

16F1519_I2C_Master.cpp

16F1519_I2C_Slave.cpp

post-5514-0-69163800-1466170217_thumb.jpg

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...