Hello everyone,
The DS1307 sends no Ack for writing the Chipadress 0xD0?
What's wrong with this simple project? I'm a beginner, sorry...
build with Mplab XC8 v2.31
PIC16F18877 RTC-Read from DS1307
-
- Professional User
- Posts: 4
- Joined: Fri 2024-01-26 21:24
PIC16F18877 RTC-Read from DS1307
- Attachments
-
- 16F18877simpI2Cread.pdsprj
- (32.75 KiB) Downloaded 13 times
Re: PIC16F18877 RTC-Read from DS1307
Hi
I found a couple of bugs in that PIC16 family VSM model which we'll fix as soon as possible.
I attach a version of your code that I have modified to work as expected. Substantially I've improved your I2C code to make it more reliable and made a workaround because of simulated PIC16 bugs. I recommend not to use the external interrupt INT on RB0 (or other pins as well) as for some reason it won't work. Please use the IOC interrupt instead. I can PM you with a version that uses IOC interrupts if you don't know how to.
I found a couple of bugs in that PIC16 family VSM model which we'll fix as soon as possible.
I attach a version of your code that I have modified to work as expected. Substantially I've improved your I2C code to make it more reliable and made a workaround because of simulated PIC16 bugs. I recommend not to use the external interrupt INT on RB0 (or other pins as well) as for some reason it won't work. Please use the IOC interrupt instead. I can PM you with a version that uses IOC interrupts if you don't know how to.
Kind regards,
Ettore Arena - Labcenter Electronics.
Ettore Arena - Labcenter Electronics.
-
- Professional User
- Posts: 4
- Joined: Fri 2024-01-26 21:24
Re: PIC16F18877 RTC-Read from DS1307
Hello Ettore,
Thanks for the quick answer! I'll take a look at your attachment.
I found a few errors in my program.
I had reached the wrong value for "SSP1ADD", which is now a value of 0x13 at an instruction frequency of 8Mhz. And the oscillator registers also had incorrect values , which I have now adjusted. But no success, I suspected a frequency setting error. In the meantime, I found another, simple example which I am attaching here. What influence does the frequency that you can see for the PIC as shown in the screenshot actually have? independently sets?Which one is validin the simulation? I found a simpler example (smaller controller) on the site here and analyzed it as best I could in order to adapt it for the PiC16f18877. The PIC is very extensive with the registers (900pages documentation) but it seemed good to me to respond to a universal one.https://embetronicx.com/tutorials/micro ... -tutorial/
Thanks for the quick answer! I'll take a look at your attachment.
I found a few errors in my program.
I had reached the wrong value for "SSP1ADD", which is now a value of 0x13 at an instruction frequency of 8Mhz. And the oscillator registers also had incorrect values , which I have now adjusted. But no success, I suspected a frequency setting error. In the meantime, I found another, simple example which I am attaching here. What influence does the frequency that you can see for the PIC as shown in the screenshot actually have? independently sets?Which one is validin the simulation? I found a simpler example (smaller controller) on the site here and analyzed it as best I could in order to adapt it for the PiC16f18877. The PIC is very extensive with the registers (900pages documentation) but it seemed good to me to respond to a universal one.https://embetronicx.com/tutorials/micro ... -tutorial/
-
- Professional User
- Posts: 4
- Joined: Fri 2024-01-26 21:24
Re: PIC16F18877 RTC-Read from DS1307
Thanks Ettore, that looks much better!...ok, I'll take a look at it then.Ettore wrote: ↑Mon 2024-03-25 10:30 Hi
I found a couple of bugs in that PIC16 family VSM model which we'll fix as soon as possible.
I attach a version of your code that I have modified to work as expected. Substantially I've improved your I2C code to make it more reliable and made a workaround because of simulated PIC16 bugs. I recommend not to use the external interrupt INT on RB0 (or other pins as well) as for some reason it won't work. Please use the IOC interrupt instead. I can PM you with a version that uses IOC interrupts if you don't know how to.
16F18877simpI2Cread_1.pdsprj
Re: PIC16F18877 RTC-Read from DS1307
The bugs about the default PPS I2C output pins settings and external interrupt INT to RB0 have been now fixed.
The fix will be in the next service pack.
The fix will be in the next service pack.
Kind regards,
Ettore Arena - Labcenter Electronics.
Ettore Arena - Labcenter Electronics.