electronics forum

Rules | Recent posts | topic RSS | Search | Register  | Log in

Problem with DS12887


Post new topic  Reply to topic    EDAboard.com Forum Index -> Microcontrollers -> Problem with DS12887
Author Message
DrWhoF



Joined: 06 May 2005
Posts: 334
Helped: 12


Post10 Dec 2005 5:13   

ds12887 problem


I am testing a circuit with RTC DS12887, 87C52, 74LS373 and DS12887 on a vero-board.
I can access registers of seconds, years and control: 0A, 0B and 0C, but I can't access registers of minutes, hours, days and months. It looks like this: seconds are counting from 00 to 59 but there is no count on minutes and so on.
I can write a number to and read form (00 to 99) the years register.
I tested DS12887 in another circuit and it is OK.
Why so weird behaviour and whay can be the reason?
Thanks.
DrWho
Back to top
IanP



Joined: 05 Oct 2004
Posts: 6492
Helped: 1542
Location: West Coast


Post10 Dec 2005 8:02   

ds12887 pic


Do uou have 2 of these DS12887? It doesn't make sense ..
And, what is the reason you have 74373?
The DS12877 has already built-in the multiplexed DATA/ADDRESS bus and all what you need to connect are the ALE, RD, WR and/or IRQ signals ..
Regards,
IanP
Back to top
DrWhoF



Joined: 06 May 2005
Posts: 334
Helped: 12


Post13 Dec 2005 10:56   

ds12887


I have only one DS12887 and 27C512 as external program memory (74373 is used for this purpose).
The DS12877 is connected to AD bus with all control signals in place.
As I said I can read seconds and hours and I can access all controll registers and RAM locations.
Thanks.
DrWho
Back to top
IanP



Joined: 05 Oct 2004
Posts: 6492
Helped: 1542
Location: West Coast


Post13 Dec 2005 11:52   

how to use irq signal of ds12887


If you say that the DS12887 itself is not faulty then most likely you have software bugs..
Double check the sections of code where you read year, month, .., and seconds, and where you display or send somewhere results .. or if you would like post them here for verification ..

Regards,
IanP
Back to top
DrWhoF



Joined: 06 May 2005
Posts: 334
Helped: 12


Post14 Dec 2005 10:04   

ds12887 circuit


This is the code which I use to read from DS12877:
Code:
; Reading DS12887

      MOV      R0, #0Ah
Wait:      MOVX      A, @R0
      JB      ACC.7, Wait

      MOV      R0, #00h
      MOVX      A, @R0         
      MOV      MSec, A
      MOV      R0, #02h
      MOVX      A, @R0
      MOV      MMin, A
      MOV      R0, #04h
      MOVX      A, @R0
      MOV      MHour, A
      MOV      R0, #07h
      MOVX      A, @R0
      MOV      MDay, A
      MOV      R0, #08h
      MOVX      A, @R0
      MOV      MMonth, A
      MOV      R0, #09h
      MOVX      A, @R0
      MOV      MYear, A


This is the code which I use to display Date and Time:
Code:

; Date and Time transmission.

Year:      MOV      A, MYear
      SWAP      A
      ANL      A, #0Fh
      MOV      R6, A
      LCALL      Send_R6
      MOV      A, MYear
      ANL      A, #0Fh
      MOV      R6, A
      LCALL      Send_R6

      MOV      R6, #0Dh         ; "-"
      LCALL      Send_R6

Month:   MOV      A, MMonth
      SWAP      A
      ANL      A, #0Fh
      MOV      R6, A
      LCALL      Send_R6
      MOV      A, MMonth
      ANL      A, #0Fh
      LCALL      Send_R6

      MOV      R6, #0Dh         ; "-"
      LCALL      Send_R6

Day:      MOV      A, MDay
      SWAP      A
      ANL      A, #0Fh
      MOV      R6, A
      LCALL      Send_R6
      MOV      A, MDay
      ANL      A, #0Fh
      LCALL      Send_R6
   
Hour:      MOV      A, MHour
      SWAP      A
      ANL      A, #0Fh
      MOV      R6, A
      LCALL      Send_R6
      MOV      A, MHour
      ANL      A, #0Fh
      LCALL      Send_R6

      MOV      R6, #0Ah         ; ":"
      LCALL      Send_R6

Minute:   MOV      A, MMin
      SWAP      A
      ANL      A, #0Fh
      MOV      R6, A
      LCALL      Send_R6
      MOV      A, MMin
      ANL      A, #0Fh
      LCALL      Send_R6

      MOV      R6, #0Ah         ; ":"
      LCALL      Send_R6

Second:   MOV      A, MSec
      SWAP      A
      ANL      A, #0Fh
      MOV      R6, A
      LCALL      Send_R6
      MOV      A, MSec
      ANL      A, #0Fh
      MOV      R6, A
      LCALL      Send_R6

      RET


Thanks.
DrWho
Back to top
IanP



Joined: 05 Oct 2004
Posts: 6492
Helped: 1542
Location: West Coast


Post14 Dec 2005 11:09   

ds12887,microchip


The code for reading the RTC looks perfectly fine ..
However, in the other section (Month, Day, Hour and Minute) after:
ANL A, #0Fh (lower nibble)
you should load R6 with A and then send R6; so, for example, Month should look like this:

Month: MOV A, MMonth
SWAP A
ANL A, #0Fh
MOV R6, A
LCALL Send_R6
MOV A, MMonth
ANL A, #0Fh
MOV R6, A
LCALL Send_R6

.. and I think there are your missing Months, Days, Hours and Minutes ..
Good Luck and Regards,
IanP
Back to top
DrWhoF



Joined: 06 May 2005
Posts: 334
Helped: 12


Post15 Dec 2005 9:30   

ds12887 code for pic


Wow, it is working.
Thank you very,very much.
DrWho
Back to top
vratislav



Joined: 22 Aug 2005
Posts: 6


Post09 Feb 2006 2:52   

reading ds12887


DrWhoF wrote:
Wow, it is working.
Thank you very,very much.
DrWho



can you send me your code for to try use a DS12887, i`m use microchip`s pic but not communicate with the device. sorry my english!!
Back to top
IanP



Joined: 05 Oct 2004
Posts: 6492
Helped: 1542
Location: West Coast


Post09 Feb 2006 7:07   

ds12877


I don't think any code written for 8051 and DS12887 will be of any help to you ..
First of all, the DS12887 uses multiplexed 8-bit address-data bus, which is pretty normal for 8051 architecture, but "strange" for PICs ..

From PIC user point of view much better option is RTC with I2C interface, for example PCF8583 ( http://www.amresearch.com/datasheets/pcf8583.pdf ), or DS1337 ( http://www.maxim-ic.com/quick_view2.cfm/qv_pk/3128 ) ..

Regrads,
IanP
Back to top
Google
AdSense
Google Adsense




Post09 Feb 2006 7:07   

Ads




Back to top
sharang



Joined: 02 Jun 2009
Posts: 18


Post07 Nov 2009 7:20   

Problem with DS12887


#include<reg51.h>
#include<absacc.h>
sbit RS=P1^2;
sbit RW=P1^3;
sbit E=P1^4;
void put(unsigned char ch,bit rs);
void delay(unsigned int t);
void init(void);
void main()
{
int i=0x00;
delay(500);
//P0=0xFF; //Input Port
init();
put('R',1);
put('T',1);
put('C',1);
put(0xC0,0);
delay(2);
XBYTE[10]=0x20;
XBYTE[11]=0x83;
XBYTE[11]=0x03;
XBYTE[0]=41;
//XBYTE[11]=0x03;
while(1)
{
put(0xC0,0);
for(i=0x00;i<0x0A;i++)
{
// XBYTE[0]++;
put((XBYTE[0]<<0x0F)+0x30,1);
delay(500);
put(0x94,0);
put((XBYTE[10]<<0x0F)+0x30,1);
}
/*if(XBYTE[0]>=0x39)
XBYTE[0]=0x30;
*/
}
}
void init(void)
{
put(0x3C,0); //Set interface length
put(0x01,0); //Clear the display
put(0x06,0); //Set cursor move direction
put(0x0E,0); //Enable display cursor
return;
}
void put(unsigned char ch,bit rs)
{
E=1;
RW=0;
P2=ch;
RS=rs;
delay(1);
E=0;
delay(1);
RW=1;
return;
}
void delay(unsigned int t)
{ unsigned int k,l;
for(l=0;l<t;l++)
for(k=0;k<900;k++);
return;
}
Back to top
Arabic versionBulgarian versionCatalan versionCzech versionDanish versionGerman versionGreek versionEnglish versionSpanish versionFinnish versionFrench versionHindi versionCroatian versionIndonesian versionItalian versionHebrew versionJapanese versionKorean versionLithuanian versionLatvian versionDutch versionNorwegian versionPolish versionPortuguese versionRomanian versionRussian versionSlovak versionSlovenian versionSerbian versionSwedish versionTagalog versionUkrainian versionVietnamese versionChinese version
Post new topic  Reply to topic    EDAboard.com Forum Index -> Microcontrollers -> Problem with DS12887
Page 1 of 1 All times are GMT + 1 Hour
Similar topics:
Wierd problem with DS12887 RTC (2)
problem in ds12887 time (1)
Why my 89S uC can't Interrupt when interfce with Ds12887 (3)
interface ds12887 to microcontroller 89s52 (1)
HOw to interface RTC DS12887 to AT89S51..?? (9)
Digital calendar using ds1307 0r ds12887 (3)
Time loss in DS12887 RTC...any solutions?? (2)
rtc project using 89c52 and ds12887 (1)
problem with Compaq C794WU laptop..hedset(voice problem) (2)
Problem with RTC Chip DS1307 with PIC18F452 using Hi-Tech C (3)


Abuse || Administrator || Moderators || Support us || sitemap
topic RSS