Page 1 of 1

Enabling I2C component on a 16F887 [Solved]

Posted: Wed Oct 19, 2011 10:43 am
by Crenwick
Hello,

I try to communicate with a DS1307 and a SAA1064 via the I2C of a 16f887 (RC3 & RC4 used with pull-ups).
I checked with my scope but I have no output... I switched over to a 18F4455 and then it works !
So I came back to the 16F887 and tested the RC0-7 ports with just led's and it was ok.

I attached my test program, did I make a mistake or does the I2c component has problem with this pic ?

Thanks,

Bernard

Re: Enabling I2C component on a 16F887

Posted: Fri Oct 21, 2011 10:42 am
by Crenwick
Hello all,

Can someone please test the program above and check if signals are ok on RC3/4 ?

I passed a lot of houres without any results :(

Thanks

Bernard

Re: Enabling I2C component on a 16F887

Posted: Mon Oct 24, 2011 10:04 am
by Benj
Hello Bernard,

Sorry for the delay. I have tested your program on a 16F887 device here and the problem seems to be related to programming rather then related to the Flowcode program. I programmed using a PICkit and the program is running correctly. I will see if I can work out what is wrong with the PPP programming software regarding this device and let you know.

Re: Enabling I2C component on a 16F887

Posted: Mon Oct 24, 2011 10:44 am
by Benj
Seems to get the device working correctly from PPP or from Flowcode using the EB006 programmer you will need to reset the device after it has been programmed. This seems to allow it to run correctly with I2C.

Re: Enabling I2C component on a 16F887

Posted: Mon Oct 24, 2011 11:29 am
by Crenwick
Thanks ben for looking at my problem,

I am also using the EB006 V07 but unfortunately the program did not run...

What do you mean with "reset" is it just do a MCLR reset with the push button ?

Thaks for the help,

Bernard

Re: Enabling I2C component on a 16F887

Posted: Mon Oct 24, 2011 12:39 pm
by Benj
Hello Bernard,

Yes just pressing the reset button on the EB006 after a program cycle seems to get my device working. Are you getting any error messages or any warnings during the programming portion of the compile to chip process?

Re: Enabling I2C component on a 16F887

Posted: Mon Oct 24, 2011 1:07 pm
by Crenwick
When I press reset the only thing I see on my scope is SDA that goes done for 850us and not after each reset.

I checked the log, in the C compile no errors just warnings in assembler part (see copy)

Test SAA1064.c success

success

Return code = 0

Launching the linker/assembler...
c:\program files (x86)\matrix multimedia\flowcode v4\boostc\boostlink_pic.exe -ld "C:\Program Files (x86)\Matrix Multimedia\Flowcode V4\BoostC\lib" libc.pic16.lib flowcode.pic16.lib rand.pic16.lib float.pic16.lib "Test SAA1064.obj" -t PIC16F887 -d "S:\Documents de Bernard\Fichier Flowcode\RTC" -p "Test SAA1064"
BoostLink Optimizing Linker Version 7.03
http://www.sourceboost.com
Copyright(C) 2004-2011 Pavel Baranov
Copyright(C) 2004-2011 David Hobday


Caution: Delay inaccurrate: 'delay_ms', Delay overhead:0ms, Unit delay:1.00016ms, Delay resolution:1 units
Warning unreferenced functions removed:
FCI_FLOAT_TO_STRING in: C:\Program Files (x86)\Matrix Multimedia\Flowcode V4\FCD\internals.h
FCI_NUMBER_TO_HEX in: C:\Program Files (x86)\Matrix Multimedia\Flowcode V4\FCD\internals.h
FCI_STRING_TO_INT in: C:\Program Files (x86)\Matrix Multimedia\Flowcode V4\FCD\internals.h
FCI_STRING_TO_FLOAT in: C:\Program Files (x86)\Matrix Multimedia\Flowcode V4\FCD\internals.h
Wdt_Delay_S in: C:\Program Files (x86)\Matrix Multimedia\Flowcode V4\FCD\internals.h
Wdt_Delay_Ms in: C:\Program Files (x86)\Matrix Multimedia\Flowcode V4\FCD\internals.h
isinf in: C:\Program Files (x86)\Matrix Multimedia\Flowcode V4\FCD\internals.h
FCD_I2C_Master0_MI2C_Restart in: S:\Documents de Bernard\Fichier Flowcode\RTC\Test SAA1064.c
FCD_I2C_Master0_MI2C_Receive_Byte in: S:\Documents de Bernard\Fichier Flowcode\RTC\Test SAA1064.c
FCD_I2C_Master0_MI2C_Send_Byte_Transaction in: S:\Documents de Bernard\Fichier Flowcode\RTC\Test SAA1064.c
FCD_I2C_Master0_MI2C_Receive_Byte_Transaction in: S:\Documents de Bernard\Fichier Flowcode\RTC\Test SAA1064.c
hantek30_1.gif
hantek30_1.gif (16.72 KiB) Viewed 6697 times

Re: Enabling I2C component on a 16F887

Posted: Mon Oct 24, 2011 1:50 pm
by Crenwick
And here is the same program but with a 18F4455 (crazy)
hantek30_2.gif
hantek30_2.gif (12.93 KiB) Viewed 6696 times

Re: Enabling I2C component on a 16F887

Posted: Mon Oct 24, 2011 3:46 pm
by Crenwick
Problem solved !

I had also a DS1307 in circuit and it seems to be a bad one ...

But I can't explain why it worked with the 18f4455 :?:

I'm happy, now I can go further :D

Thanks

Re: Enabling I2C component on a 16F887 [Solved]

Posted: Mon Oct 24, 2011 4:30 pm
by Benj
Brilliant, glad you got it working correctly.

Thanks for letting us know.