This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to use DS12887?

Hi,
The interface DS12887 to MCU(I use 89c52) is all right.But I can't programe it with C51.My application is very simple.I just want to initiate and read the RTC.What can I do?
Many thanks for any help!

Parents
  • Hi Vidarson,
    If you are interfacing ur DS12887 with 89C52,the things that come into consideration are
    1.Make sure that the RTC is selected(Chip Select).
    2.Configure the hardware A and B registers of the DS12887.You can use a pointer to access the registers(like a pointer that points to the base address of the RTC and u can increment it to point to the other locations of the RTC).
    3.If u choose the BCD mode then care should be taken in the interpretation of the data that is being read from the RTC.

    eg.,Use the pointer like
    unsigned char xdata *RtcPtr;

    the routine for initialisation can be like this
    CS_RTC=0;//ChipSelect is Active low
    *(RtcPtr+10)=0x2F;
    *(RtcPtr+11)=0xC2;//make Set Bit =1
    ///Initialize the date and time in BCD mode
    *(RtcPtr+11)=0x42;//Reset Set Bit to 0
    CS_RTC=1;

    Regards,
    Rajesh.

Reply
  • Hi Vidarson,
    If you are interfacing ur DS12887 with 89C52,the things that come into consideration are
    1.Make sure that the RTC is selected(Chip Select).
    2.Configure the hardware A and B registers of the DS12887.You can use a pointer to access the registers(like a pointer that points to the base address of the RTC and u can increment it to point to the other locations of the RTC).
    3.If u choose the BCD mode then care should be taken in the interpretation of the data that is being read from the RTC.

    eg.,Use the pointer like
    unsigned char xdata *RtcPtr;

    the routine for initialisation can be like this
    CS_RTC=0;//ChipSelect is Active low
    *(RtcPtr+10)=0x2F;
    *(RtcPtr+11)=0xC2;//make Set Bit =1
    ///Initialize the date and time in BCD mode
    *(RtcPtr+11)=0x42;//Reset Set Bit to 0
    CS_RTC=1;

    Regards,
    Rajesh.

Children
No data