Enabling I2C component on a 16F887 [Solved]

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
User avatar
Crenwick
Posts: 127
Joined: Sun Aug 07, 2011 1:40 pm
Location: Belgium
Has thanked: 7 times
Been thanked: 21 times
Contact:

Enabling I2C component on a 16F887 [Solved]

Post 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
Attachments
Test SAA1064.fcf
(5.5 KiB) Downloaded 285 times
Last edited by Crenwick on Mon Oct 24, 2011 3:54 pm, edited 2 times in total.
Bernard

Flowcode 6 / EB006-V9

User avatar
Crenwick
Posts: 127
Joined: Sun Aug 07, 2011 1:40 pm
Location: Belgium
Has thanked: 7 times
Been thanked: 21 times
Contact:

Re: Enabling I2C component on a 16F887

Post 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
Bernard

Flowcode 6 / EB006-V9

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Enabling I2C component on a 16F887

Post 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.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Enabling I2C component on a 16F887

Post 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.

User avatar
Crenwick
Posts: 127
Joined: Sun Aug 07, 2011 1:40 pm
Location: Belgium
Has thanked: 7 times
Been thanked: 21 times
Contact:

Re: Enabling I2C component on a 16F887

Post 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
Bernard

Flowcode 6 / EB006-V9

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Enabling I2C component on a 16F887

Post 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?

User avatar
Crenwick
Posts: 127
Joined: Sun Aug 07, 2011 1:40 pm
Location: Belgium
Has thanked: 7 times
Been thanked: 21 times
Contact:

Re: Enabling I2C component on a 16F887

Post 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 5862 times
Bernard

Flowcode 6 / EB006-V9

User avatar
Crenwick
Posts: 127
Joined: Sun Aug 07, 2011 1:40 pm
Location: Belgium
Has thanked: 7 times
Been thanked: 21 times
Contact:

Re: Enabling I2C component on a 16F887

Post by Crenwick »

And here is the same program but with a 18F4455 (crazy)
hantek30_2.gif
hantek30_2.gif (12.93 KiB) Viewed 5861 times
Bernard

Flowcode 6 / EB006-V9

User avatar
Crenwick
Posts: 127
Joined: Sun Aug 07, 2011 1:40 pm
Location: Belgium
Has thanked: 7 times
Been thanked: 21 times
Contact:

Re: Enabling I2C component on a 16F887

Post 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
Bernard

Flowcode 6 / EB006-V9

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

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

Post by Benj »

Brilliant, glad you got it working correctly.

Thanks for letting us know.

Post Reply