*Blah*
Pulling “all night” (and well into the morning) programming sessions ain’t as easy on the body as it was back in my college days.
But, with approximately 16 hours coding time, I have mastered the ‘art’ of i2c slavery on the picmicro.
I2C stands for inter-ic communications. It is something Philips cooked up mainly to allow microprocessors to communicate with other devices on the board, as sort of a back-channel communication
Most desktop computers use I2C to read information about the system memory and monitor the health of system components (temps, voltages, etc).
My objective is to use I2C to allow data collection from a large bi-directional led sensor array. I plan to have several PIC microcontrollers each controlling a line in an array of leds and then use another PIC as an I2C master to coordinate scanning of the array and interface with a host PC. Most compilers support I2C master communications ‘out of the box’ for things like talking to serial eeproms and real-time clocks. However, no compilers that I know of offer any support for I2C slave-side communications. I think this is because very few picmicro actually have the proper hardware to implement the i2c slave role (which is very timing sensitive), and there are other methods (which may have been easier) such as RS485. I also think that the majority of picmicro compilers are used by hobbyists, and hobbyists have little need to network multiple picmicros – usually programming and managing a single pic is enough trouble.
I have the basic interrupt driven i2c slave routines available in heavily commented source code if anyone needs them. I will probably setup a static webpage with some more information, but its lower on the priority list. It is written is in Proton Basic. If anyone wants the code, let me know and I’ll send it your way.
Holger said:
I’m just trying to bring two 16F88 PICs to talk to each other by I2C. Master works fine, but slave will not receive more then 10 byte before hanging.
Looking for any running I2C-slave code to help me find my errors. Could you send me yours, please?
Thanks a lot!
please send to Holger.Suchi(a)siemens.com
Vielen Dank!
Holger
justDIY said:
Holger,
I sent you an email … no problem sharing the code, hopefully it will be of some help!
justDIY
Jan Lichtenberg said:
Hi,
I was wondering whether you could send me your I2C slave code. I’d like to implement a solution for smal PIC10F controllers, which have no I2C hardware.
Thanks in advance,
Jan
justDIY said:
Jan,
I’ll send the code – give me a little time, I need to take my latest version and strip out all my A2D junk.
Just to let you know, my code is for pics with I2C hardware – it will not work on PICs without a SSP or MSSP module.
justDIY
Charles said:
If at all posible, I would like to look at the code you have cut that allows PIC to talk via I2C. I have a project that I have started on (hardware only at this stage) that uses several 16F88 as slave devices and an 18F4550 as a master device. What I would like to get is bi-directional data happening over the I2C network between all devices. So far your information looks as though it will make things happen. At the least it will be a great starting point.
Thanks in advance
Brian said:
Sounds interesting!
I’m trying to build a slave process with a PIC for data collection off the bus. Anything you could send would be helpful.
Regards,
Brain
Daniel said:
Please send me the code. My senior design group and I need to use I2C on our LED programming in assembly language. We have a Microchip Pic24. Please help!
justDIY said:
you should be using the free C compiler for that advanced 16 bit pic. Microchip includes code samples for i2c slaves with their IDE, both C and ASM versions. It’s also in the datasheet.
Robert Romero said:
Is there any chance of getting the code… I’d love to disclose my intent but NDA’s suck….
Steven Frank said:
I would like a copy of our Slave code.
Thanks
Steven Frank
William Sokolowsky said:
Don’t know if this post is still active, but curious to look at the code. Looking to have a PIC as a slave taking directions from an Arduino for a senior project. Internet hasn’t given great instructions on how to set it up so was hoping this may provide some good insight. Just for clarification, this code is in Basic not C? Thanks, looking forward to hearing from you.