![]() |
![]() |
![]() |
|
|
|||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
|
|
Thread Tools | Display Modes |
|
|
(permalink) |
|
the code looks ok, but when using software i2c implementation you have to pay attention on few things:
- interrupts must be disabled as it is time critical operation - you have to setup the correct frequency in mikroC project for it to be able to calculate delays properly. So if you are using 8MHz crystal with internal 4xpll then you have to enter 32MHz to the mikroC project etc.. - making software i2c work with internal oscillator never worked for me, maybe because the internal oscillator was not precise enough or because I miss configured something, but in any case, I never made it work with internal oscillator (that by any mens do not mean it cannot be done, just that *I* have not manage to do it) - the frequency your project have set, your config is setup for and the one selected in ISIS for the uC must be the same. The ISIS by default set the "speed" to 1MHz AFAIK, and that will work for hw i2c but not for sw i2c implementation. On top of all this, you also have I2C analyzer in ISIS so you can actually look at the I2C communication. Do not forget to put pull up resistors to I2C lines in ISIS because I2C will not work without pull up resistors.
__________________
http://www.it4um.com |
|
|
|
|
|
|
(permalink) |
|
Thank you dear Arhi for your information.
__________________
http://www.kamalan.com/default.aspx?lang=En Illegal free books links deleted - moderator. |
|
|
|
|
|
|
(permalink) |
|
u r welcome, just check the frequencies and post back if everything works ok. I never personally used that software i2c lib as most of the uC's have hw i2c and as I use i2c a lot for communication between my devices (eprom, rtc, port extender, glcd...) I tend to use hw one.
__________________
http://www.it4um.com |
|
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Latest |
| Quik PIC Programming kit | Krumlink | General Electronics Chat | 5 | 27th January 2008 11:27 PM |
| Capturing and reproducing audio with a PIC | Fred.Amoson | Micro Controllers | 14 | 14th December 2007 08:21 PM |
| Controlling i2c data bus by PIC 16f84a | rukshankb | Micro Controllers | 3 | 30th October 2007 01:55 PM |
| High ADC sampling rate PIC, 18F needed? | bananasiong | Micro Controllers | 24 | 28th October 2007 12:13 PM |
| Need help! I2c data bus with pic 16f84a | rukshankb | Micro Controllers | 2 | 7th October 2007 11:57 AM |