Continue to Site

# DS12887 and PIC timing question...

Status
Not open for further replies.

#### Wond3rboy

##### Member
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.

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.

Code:
char read_rtc(char addr)
{
//C7=swq,6=rclr_bar,5=irq_bar,4=reset_bar,3=ds,2=rw_bar,1=as,0=cs_bar
char data;
rtc_tris=0b11100000;//set the tris of C for setting address
rtc     =0b00011110;//set C for for setting address
#asm nop #endasm    //pause
rtc.as=0;           //latch
delay_cycles(1); // pause
rtc.ds=0;           //release
[B] #asm nop #endasm    //pause
rtc_tris_r(); //set the tris of B  and D to ALL INPUTS
return(data);
}

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.

#### Attachments

• TimeDelaynumber.JPG
87.5 KB · Views: 395
• Timerdelaywaveform.JPG
37 KB · Views: 493

#### Diver300

##### Well-Known 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.

Status
Not open for further replies.

Replies
9
Views
1K
Replies
10
Views
950
Replies
4
Views
2K
Replies
16
Views
862
Replies
0
Views
112