CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Search found 9 matches
CCS Forum Index
Author Message
  Topic: Reading seconds value from ds1307 skipping with dspic30f4013
ahmed-agt

Replies: 21
Views: 41762

PostForum: General CCS C Discussion   Posted: Tue Nov 13, 2018 9:33 am   Subject: The second solution using the hardware I2C.
The second option is to add a read of the I2CRCV
register before the first call to i2c_read() in your ds1307_read() function, for example changing
your ds1307_read() function the following:


v ...
  Topic: Reading seconds value from ds1307 skipping with dspic30f4013
ahmed-agt

Replies: 21
Views: 41762

PostForum: General CCS C Discussion   Posted: Tue Nov 13, 2018 9:14 am   Subject: This is one of the suggested solution!
Simple answer then, switch to using software I2C. On your chip this will make no difference at all (software can give over a MHz on a chip at this speed), and will fix the issue.
Using a software I2C ...
  Topic: Reading seconds value from ds1307 skipping with dspic30f4013
ahmed-agt

Replies: 21
Views: 41762

PostForum: General CCS C Discussion   Posted: Tue Nov 06, 2018 2:14 am   Subject: Reading seconds value from ds1307 skipping with dspic30f4013
One other thing, your I2C setup should have slow=100000, not fast=100000.
Using 'fast' tells the compiler that the device supports fast timings. The DS1307, doesn't.

Thank you for your efforts. Th ...
  Topic: Reading seconds value from ds1307 skipping with dspic30f4013
ahmed-agt

Replies: 21
Views: 41762

PostForum: General CCS C Discussion   Posted: Mon Nov 05, 2018 12:23 pm   Subject: Reading seconds value from ds1307 skipping with dspic30f4013
One thing to try. After every I2C_stop() in the code add delay_us(2).

I2C requires a minimum time between an I2C stop and a subsequent I2C start. Typically a couple of uSec. At normal processor spe ...
  Topic: Reading seconds value from ds1307 skipping with dspic30f4013
ahmed-agt

Replies: 21
Views: 41762

PostForum: General CCS C Discussion   Posted: Mon Nov 05, 2018 12:19 pm   Subject: Reading seconds value from ds1307 skipping with dspic30f4013
Is Vbat of the DS1307 connected to a good coin cell battery ?
Button Battery good, minutes and hours are running fine and accurate.
  Topic: Reading seconds value from ds1307 skipping with dspic30f4013
ahmed-agt

Replies: 21
Views: 41762

PostForum: General CCS C Discussion   Posted: Mon Nov 05, 2018 12:02 pm   Subject: Reading seconds value from ds1307 skipping with dspic30f4013
You claim the interrupts are working, but they are not enabled in what you post. You have also left out the chip configuration, so we cannot tell if it is setup reasonably.
What clock are you runnin ...
  Topic: Reading seconds value from ds1307 skipping with dspic30f4013
ahmed-agt

Replies: 21
Views: 41762

PostForum: General CCS C Discussion   Posted: Mon Nov 05, 2018 9:08 am   Subject: Re: Reading seconds value from ds1307 skipping with dspic30f
#include <testdspccs.h>

//----LCD Driver and Port
#include <Flex_LCD420.C>
#define USE_RW_PIN 1
#define LCD_BL PIN_D1

//----------FAST = 100000 SDA = PIN_F2, SCL = PIN_F3, FORCE ...
  Topic: Reading seconds value from ds1307 skipping with dspic30f4013
ahmed-agt

Replies: 21
Views: 41762

PostForum: General CCS C Discussion   Posted: Mon Nov 05, 2018 8:50 am   Subject: Thanks for your respond.
Every things works fine timer1 interrupt, date and time. This code works on pic18f and pic16f. But on dspic30f4013, the second is reading zeros.
using mikroc, it work fine with same hardware.
  Topic: Reading seconds value from ds1307 skipping with dspic30f4013
ahmed-agt

Replies: 21
Views: 41762

PostForum: General CCS C Discussion   Posted: Mon Nov 05, 2018 8:22 am   Subject: Reading seconds value from ds1307 skipping with dspic30f4013
#include <testdspccs.h>

//----LCD Driver and Port
#include <Flex_LCD420.C>
#define USE_RW_PIN 1
#define LCD_BL PIN_D1

//----------FAST = 100000 SDA = PIN_F2, SCL = PIN_F3, FORCE ...
 
Page 1 of 1
All times are GMT - 6 Hours
Jump to:  


Powered by phpBB © 2001, 2005 phpBB Group