• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

DS12887 and PIC timing question...

Not open for further replies.


Hi i wanted to write code for the DS12887 with a PIC and was looking at the timing waveforms,what got me thinking was that two parameters that have upper limits on the time.

Read-Data Hold Time tDHR

Output Data Delay Time from DS or R/W tDDR

I am using a 18LF4620 with a 4MHz crystal which gives me a MC of 1us.

Here is an example code i found for this purpose written in CCS compiler,i can write the code but before doing that i wanted to ask about the delay problems...

It uses a 16MHZ cryatal with HS i-e .25us or 250ns MC.

char read_rtc(char addr)
  char data;
  rtc_tris=0b11100000;//set the tris of C for setting address
  rtc_tris.ad=0x00; //set the tris of D for setting address
  rtc     =0b00011110;//set C for for setting address
  rtc.ad=addr;      //put address on bus
  #asm nop #endasm    //pause
  rtc.as=0;           //latch
  delay_cycles(1); // pause
  rtc_tris.ad=0xFF; //set the tris of D for reading data
  rtc.ds=0;           //release
 [B] #asm nop #endasm    //pause
  data=rtc.ad;      //read the data from the bus[/B] [B][I]tDDR[/I][/B]
  rtc_tris_r(); //set the tris of B  and D to ALL INPUTS
The reference:

CCS :: View topic - ds12887 RTC

So if i just use 1us will it cause any problems?I dont think that i will have to put any nops in between.



Well-Known Member
Most Helpful Member
Those are read timings that have upper limits. They are the maximum times that you have to wait before the data is guaranteed. That is also the minimum time that you should wait before reading the data. There is no maximum on the time that you can wait before reading the data.
Not open for further replies.

Latest threads

EE World Online Articles