Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 20:35 28 Nov 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : PIC based I2C devices.

     Page 3 of 3    
Author Message
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3194
Posted: 06:50pm 14 Jan 2014
Copy link to clipboard 
Print this post

The MicroMite makes a great I2C slave for creating chips with special capabilities. This is an extract from the new version of the MicroMite manual. It shows how, with 11 lines of code, the slave can read its analog ports and send the readings off to an I2C master.

2014-01-15_044915_I2C_on_MicroMites.pdf

You cannot get it much easier that that.

Geoff

P.S. Note that in the MicroMite the I2C command names have been changed. For example, I2CSEN is now I2C SLAVE OPEN.Edited by Geoffg 2014-01-16
Geoff Graham - http://geoffg.net
 
BobD

Guru

Joined: 07/12/2011
Location: Australia
Posts: 935
Posted: 06:58pm 14 Jan 2014
Copy link to clipboard 
Print this post

  Geoffg said   P.S. Note that in the MicroMite the I2C command names have been changed. For example, I2CSEN is now I2C SLAVE OPEN.


The change to the I2C commands seems like a good thing to also happen on Maximite Basic. For backward compatibility the two sets of commands could co-exist.
 
paceman
Guru

Joined: 07/10/2011
Location: Australia
Posts: 1329
Posted: 07:36pm 14 Jan 2014
Copy link to clipboard 
Print this post

That's pretty impressive Geoff - I'm glad you're on our side!

I haven't looked at the new command names yet but I certainly agree that they needed a look at; the I2CSEN/I2CSSEND/I2CSEND trio certainly confused me. Bob's point sounds like a good idea too if it's do-able.

Greg
 
BobD

Guru

Joined: 07/12/2011
Location: Australia
Posts: 935
Posted: 08:52pm 14 Jan 2014
Copy link to clipboard 
Print this post

  Grogster said  
Luckily, I don't have need to play with EEPROM's very much - yet.

I have noticed that a few of those small and usually very cheap I2C connected modules from China are now including EEPROMS. In some cases they don't even mention the memory chip but when you look close you can see it.

I got an RTC from eBay or DX recently that came with an Atmel 24C32. I haven't yet found a use for the memory. The module also came with a 3.6 volt button cell rechargeable battery, an LIR2032.
 
MOBI
Guru

Joined: 02/12/2012
Location: Australia
Posts: 819
Posted: 12:17am 15 Jan 2014
Copy link to clipboard 
Print this post

Hi,

I used i2c memory on a cattle/sheep ear tag reader I designed (and built) some years ago. It needed to store about 6 bytes (if I remember) for each tag read. It could hold several hundred tag numbers.

I2C memory is handy as a low density data logger if you don't have an SD. I used to download the data via comm port (USB to Serial) to a text file on the PC and crunch it from there using VB.

It all worked very well.
David M.
 
MOBI
Guru

Joined: 02/12/2012
Location: Australia
Posts: 819
Posted: 07:20pm 26 Jan 2014
Copy link to clipboard 
Print this post

Here (finally) is a zip file with the blank (template) for turning a PIC into an I2C slave device.

I thought I'd put it in the appropriate topic.

Originally it was designed for the PIC16F88/819 chips but works just as well with the PIC16F1503. The main difference is the pin count and port size. The 88 has two 8bit ports and the 14 pin 1503 has two 6 bit ports.

I've only put the 1503 details in this zip, when I rehash the F88 files to work on MPLABX, I'll stick them in the zip also.

Now to see if anyone is game to have a go at creating their own slave.2014-01-27_051926_pic16f1503_lcd_etc.zip
David M.
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 07:32pm 26 Jan 2014
Copy link to clipboard 
Print this post

Thanks David, i will build it on a breadboard first and get it going.

Microblocks. Build with logic.
 
MOBI
Guru

Joined: 02/12/2012
Location: Australia
Posts: 819
Posted: 08:06pm 26 Jan 2014
Copy link to clipboard 
Print this post

Hi TZA,

Do you want the HEX file, or are you going to assemble it using MPLABX and program it form there? I think I better put it in the zip file anyway.

How are you going to fit the soic chip on a bread board?

Also, the PWM works quite smoothly with 256 steps.

for x = 0 to 255
i2csend 0111000,0,3,0,x,8
next x

takes about half a second (or less) for the backlight to go from full off to full on. Mind you, you can select what ever level you like within the backlight level byte
David M.
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 11:00pm 26 Jan 2014
Copy link to clipboard 
Print this post

David,

The HEX file would be very convenient. I am not up to speed with using the assembler yet, so i have to figure a few things out. A HEX file will get it going quickly.

The soic will be on a small adapter board.


Microblocks. Build with logic.
 
MOBI
Guru

Joined: 02/12/2012
Location: Australia
Posts: 819
Posted: 01:47am 27 Jan 2014
Copy link to clipboard 
Print this post

Hello TZA

I have included the hex file in the zip folder. I programmed the 1503 using MPLABX IDE with PICKit3 and also MPLAB IPE with the same programmer. Both methods worked and ran happily in the Breadboard set up. If you've never used MPLABX IPE before, it can be a bit finicky.

Make sure you select PIC16F1503 and NOT PIC16LF1503. What programmer do you have?
Here is the latest zip file. Best of luck.


2014-01-27_114540_pic16f1503_lcd_etc.zip
David M.
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 02:06am 27 Jan 2014
Copy link to clipboard 
Print this post

I use Mplab IDE and a pickit3, so i will use that. Should work fine.
Not yet comfortable with the 'X' version yet.


Microblocks. Build with logic.
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 09:02am 31 Jan 2014
Copy link to clipboard 
Print this post

almost weekend, then i can have some fun with this.
i'll let you know how it goes.

Microblocks. Build with logic.
 
     Page 3 of 3    
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024