Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

8051 with RTC DS12887 problem

Status
Not open for further replies.
Hi,

as far as i can see you don´t use any of the three methods to prevent corrupt data.

--> I don´t think it is usefull to read the data at hig speed in an infinite loop.
Your code seems to read the data maybe thousand of times in a second and uptes the display at the same rate.

Do you have the interrrupt line connected from clock to controller?

Klaus
 

Hi,

as far as i can see you don´t use any of the three methods to prevent corrupt data.

--> I don´t think it is usefull to read the data at hig speed in an infinite loop.
Your code seems to read the data maybe thousand of times in a second and uptes the display at the same rate.

Do you have the interrrupt line connected from clock to controller?

Klaus

i added the first method as following but it result in more time error
weather i pooled on UF bit or IRQF
i thought i won't need the interrupt pin so i didn't connect it

Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
while(1)
{
if((XBYTE[12] & 0x10)== 0x10){  //looping on UF bit
    //if((XBYTE[12] & 0x80)== 0x80){  //looping on IRQF bit
    sec = XBYTE[0];
    min = XBYTE[2];
    hr  = XBYTE[4];
    day  = XBYTE[7];
    month= XBYTE[8];
    year = XBYTE[9];
        if(disp_f == 0){
          display(sec , min , hr);
            if(sec == 0x19)
            disp_f = 1;
        }
        else{
            display(year ,month ,day);
            if(sec == 0x39)
                 disp_f = 0;
        }
        XBYTE[12] = 0;
    }
}

 
Last edited by a moderator:

Hi,
What´s this?
--> datasheet says:

Klaus
i found the datasheet says also at the end of method 1 description
If this interrupt is used, the IRQF bit in Register C should be cleared before leaving the interrupt routine.

besides i tried the code without this statement and it has no difference
 

Hi,

If this interrupt is used, the IRQF bit in Register C should be cleared before leaving the interrupt routine.
True, but how to clear it.

Datasheet never mentiones that writing a "0" to the bit clears it.
It always says, that reading registerC clears it. Please do so.

It seems to be no "read/write" bit. Just read only, and the same it is cleared.

Klaus
 

Hi,


True, but how to clear it.

Datasheet never mentiones that writing a "0" to the bit clears it.
It always says, that reading registerC clears it. Please do so.

It seems to be no "read/write" bit. Just read only, and the same it is cleared.

Klaus

ok i removed this statement

- - - Updated - - -

To summarize:
i think my problem is that
1_ keep reading the RTC at high speed many times at each second
(any suggestions to solve this)
2_ using method 1 ... it seems i have to use the interrupt pin with it, and this method cann't be used without the interrupt pin .. please correct me if i'm mistaken
 

read the RTC at the lowest acceptable rate, controlled by a software timer.

i mean by my question (any suggestion... ) how to control the rate as all RTC codes i met before were reading directly .. do i have to use MCU timer
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top