View previous topic :: View next topic |
Author |
Message |
BruceS Anderson
Joined: 31 Oct 2014 Posts: 3 Location: Scotland
|
#use i2c with DS1338 |
Posted: Fri Nov 21, 2014 9:51 am |
|
|
I am using the driver for the DS1338 RTC with a PIC18F66K22 and force-sw setup as I do not have any spare serial ports.
I am using latest MplabX.
The code compiles but seems to hang or take a long time to perform any function such as rtc_get_date().
Is there any way of debugging the CCS embedded functions? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19553
|
|
Posted: Fri Nov 21, 2014 10:01 am |
|
|
and as a further comment, the internal functions are just as much there are anything else. You can step them in the program memory window as easily as anything else.
However, if you change the line near the top of the processor include file:
#nolist
Just 'remming' it out as:
//#nolist
Then the assembler will be visible in the listing file as well. Makes debugging a lot easier.
PCM_programmers I2C scanning program (that he has pointed you to), should be a 'standard' tool as the first place to go with any I2C problem. No point in trying to debug the functions, if the chip is not responding correctly.... |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9247 Location: Greensville,Ontario
|
|
Posted: Fri Nov 21, 2014 10:16 am |
|
|
hmmm is the whole program 'slow' ? If so, did you compiler in 'debug' mode ? Needs to be compiled in 'release' mode to have the PIC run right.
Other possibilities include having 'debug' enabled, maybe even having WDT enabled ?
Wrong 'clock' speed ? Does the PIC run the '1Hz LED' program right ?
hth
jay |
|
|
BruceS Anderson
Joined: 31 Oct 2014 Posts: 3 Location: Scotland
|
solved |
Posted: Mon Nov 24, 2014 5:58 am |
|
|
Hi I have found the fault - I did not have the pull-ups on the 2 control lines.
Now works correctly. |
|
|
|