Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/30/06 11:12
Read: times


 
#108688 - rtc code PLS HELP
Responding to: ???'s previous message
this is the code we are using to initiate our rtc ds12887 ,but it doesnt work out ,if anybody can correct it please do.

after writing to the rtc how do we check whether the data we have written has been written to the rtc.
the data in rtc is read on pressing key connected to p3.0.
we have tried reading data in the rtc location 00h and outputed on port p2.but all we get on port 2 is ffh
pls verify our code

ds=p3.6
rw=p3.7
cs=p3.5
as=p3.4
p1=ad0 to ad7
P3.3=IRQ

ORG 0000H
LJMP START
ORG 0500H
START: MOV SP,#065H
MOV PCON,#000H
MOV PSW,#000H
MOV IE,#000H
MOV P0,#00H
MOV P1,#00H
MOV P2,#000H
MOV P3,#009H
MOV R0,#000H
MOV R1,#000H
MOV R2,#000H
MOV R3,#000H
MOV R4,#000H
MOV R5,#000H
MOV R6,#000H
MOV R7,#000H
MOV TMOD,#01H
MOV TCON,#00H
SETB P3.3
SETB P3.4
CLR P3.5
SETB P3.6
SETB P3.7

LCALL REGB ;INITIALISE REG B
LCALL DEL1
LCALL REGA ;INITIALISE REG A
LCALL DEL1
LCALL REGB1 ;INIT REG B(SET BIT 7 OF REG B)
LCALL DEL1
LCALL WRITE;WRITE DATA TO RTC
LCALL REGB;CLR BIT 7 OF REG B
LCALL DEL1
HERE: JB P3.0,HERE;CHECK IF KEY IS PRESSED
LCALL REGB1;IF PRESSED BIT7 REGB=1
LCALL DEL1
LCALL READ;READ DATA
LCALL DEL1
LCALL REGB;BIT7REGB=0
MOV P2,R4;OP DATA IN R4 TO P2
LJMP HERE
;----------------------------------------------------------------REGB: MOV R0,#0BH;ADD OF REGB
MOV R1,#012H; REG B BIT7=0
LCALL XX
RET
REGA: MOV R0,#0AH;ADD OF REGA
MOV R1,#020H;DATA OF REG A
LCALL XX
RET
REGB1: MOV R0,#0BH;ADD OF REG B
MOV R1,#092H;BIT7 REG B=01
LCALL XX
RET
;-------------------------------------------------------
WRITE: MOV R0,#00H;SECS ADDRESS
MOV R1,#30H;DATA IN SECS PLACE
LCALL XX
WRITE1: JB P3.3,WRITE1;IF UPDATE IS COMPLETE
SETB P0.0
MOV R0,#02H
MOV R1,#30H
LCALL XX
WRITE2: JB P3.3,WRITE2
SETB P0.2
MOV R0,#04H
MOV R1,#03H
LCALL XX
WRITE3: JB P3.3,WRITE3
SETB P0.4
RET
;-----------------------------------------------------------
XX:
SETB P3.5
CLR P3.4
CLR P3.6
CLR P3.7
LCALL DEL1

SETB P3.4
SETB P3.6
SETB P3.7
CLR P3.5

LCALL DEL1
MOV P1,R0
CLR P3.4
CLR P3.7

MOV P1,R1
LCALL DEL1
SETB P3.4
SETB P3.5
SETB P3.7
RET

;------------------------------------------------------------
DEL1:
DEL1_0: MOV TH0,#0FCH
MOV TL0,#017H
SETB TCON.4
DEL2: JNB TCON.5, DEL2
CLR TCON.4
CLR TCON.5
RET
;-------------------------------------------------------------
READ: MOV R0,#00H
LCALL READDAT
RET
READDAT: SETB P3.5
CLR P3.4
CLR P3.6
CLR P3.7
LCALL DEL1

SETB P3.6
SETB P3.7
SETB P3.4
CLR P3.5

LCALL DEL1
MOV P1,R0
CLR P3.4
CLR P3.6
LCALL DEL1
MOV P1,#0FFH
LCALL DEL1

MOV R4,P1
LCALL DEL1
SETB P3.6
SETB P3.5
SETB P3.4
RET





List of 28 messages in thread
TopicAuthorDate
help            01/01/70 00:00      
   Get ready for Thrashing.            01/01/70 00:00      
      Clickable Link            01/01/70 00:00      
   Not exactly a newbie            01/01/70 00:00      
      Help ive fallen down a well            01/01/70 00:00      
      after your first post Kalpak posted            01/01/70 00:00      
   rtc code PLS HELP            01/01/70 00:00      
      Your code            01/01/70 00:00      
      PLS help            01/01/70 00:00      
         Commented code            01/01/70 00:00      
            Comments            01/01/70 00:00      
               pls help            01/01/70 00:00      
                  use gvim            01/01/70 00:00      
                  Pretty Print            01/01/70 00:00      
               a CAPITAL sin            01/01/70 00:00      
         rtc code            01/01/70 00:00      
            RTC code            01/01/70 00:00      
      Your code            01/01/70 00:00      
   pls help            01/01/70 00:00      
      How to post your code            01/01/70 00:00      
   code for rtc            01/01/70 00:00      
      Here is the code you require            01/01/70 00:00      
         andy            01/01/70 00:00      
            The details you require            01/01/70 00:00      
   2 accounts?            01/01/70 00:00      
      Yes!            01/01/70 00:00      
   ds            01/01/70 00:00      
      already said!            01/01/70 00:00      

Back to Subject List