1 Replies - 376 Views - Last Post: 11 November 2018 - 08:02 AM

#1 sundy58   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 30-October 18

set DST in 87C51

Posted 30 October 2018 - 03:18 PM

Thanks for having a forum for assembly language and hello.

I manufacture synchronized clock systems. The previous owner did all the firmware for our products. I do not code so I hire out my firmware/software development. I have a master clock that is not setting DST (daylight saving time) consistently. My Chipmaster 3000 computer has finally died and before I pay someone to burn a bunch of chips I would like to get my DST issues worked out. The code is written for a 87C51FB and he used the ASM51 assembler, I mentioned the burner, I'm not sure what other info a person might need.

I think this is the section of firmware that sets DST.

;DSTWT:  MOV     DAYS,#0            ; DST DATE SET ROUTINE
;        MOV     IND1,#01100000B    ; BEGIN, MONTH
;        MOV     SCTCH1,#1
;        MOV     IND2,#0
;        MOV     DHRS,#0FFH
;        MOV     DFLAG,#00000001B
;        MOV     SCTCH2,#0FFH
;        MOV     MINS,#0FFH
;        MOV     SCTCH3,#0FFH
;        MOV     SCTCH4,#0FFH
;        MOV     SCTCH5,#0FFH
;        CALL    BTNCLR
;DSTLUP: CALL    BTNCK
;        JB      BTN1.5,DSTLP1   ; CANCEL
;        JB      BTN2.0,DSET     ; AHEAD
;        JB      BTN2.1,DSET     ; BACK
;        JB      BTN2.3,DSTREV   ; REVIEW
;        JB      BTN2.2,DSTNXT   ; SELECT
;        JMP     DSTLUP
;DSTLP1: JMP     FINISH
;;
;DSTNXT: CALL    BMD
;        JMP     DSTLUP
;DSET:   CALL    HT1
;        MOV     DPTR,#DST
;        MOV     A,SCTCH2
;        MOVX    @DPTR,A
;        INC     DPTR
;        MOV     A,SCTCH3
;        MOVX    @DPTR,A
;        INC     DPTR
;        MOV     A,SCTCH4
;        MOVX    @DPTR,A
;        INC     DPTR
;        MOV     A,SCTCH5
;        MOVX    @DPTR,A
;        JMP     DSTLUP
;DSTREV: MOV     IND2,#00001000B   ; REVIEW
;        MOV     IND1,#01110000B   ; BEGIN, MONTH, DATE
;        MOV     DPTR,#DST
;        MOVX    A,@DPTR
;        MOV     DHRS,A
;        INC     DPTR
;        MOVX    A,@DPTR
;        MOV     MINS,A
;RVDST1: CALL    BTNCLR
;DSRVLP: CALL    BTNCK
;        JB      BTN1.5,DSTCNC   ; CANCEL
;        JB      BTN2.3,DSTWT    ; REVIEW
;        JNB     BTN2.2,DSRVLP   ; SELECT
;        MOV     A,IND1
;        ANL     A,#10000000B    ; CHECK FOR END
;        JNZ     DSTREV
;        MOV     IND1,#10110000B   ; END, MONTH, DATE
;;        MOV     IND2,#00001000B   ; REVIEW
;        MOV     DPTR,#DST+2
;        MOVX    A,@DPTR
;        MOV     DHRS,A
;        INC     DPTR
;        MOVX    A,@DPTR
;        MOV     MINS,A
;        JMP     RVDST1
;DSTCNC: MOV     B,4H
;        MOV     DPTR,#DST
;RVDST2: MOV     A,#0FFH
;        MOVX    @DPTR,A
;        INC     DPTR
;        MOV     A,B
;        DEC     A
;        MOV     B,A
;        JNZ     RVDST2
;        JMP     DSTREV



Is This A Good Question/Topic? 0
  • +

Replies To: set DST in 87C51

#2 turboscrew   User is offline

  • D.I.C Lover
  • member icon

Reputation: 171
  • View blog
  • Posts: 1,107
  • Joined: 03-April 12

Re: set DST in 87C51

Posted 11 November 2018 - 08:02 AM

Maybe I'm wrong, but it looks like Date SeT (DST) function. It looks like it sets the date and time, though.
I don't know what the SCTCH1, SCTCH2,... are, but maybe they are SCT CHannel1, SCT Channel2, ...?

This looks like the "main loop":
;DSTLUP: CALL    BTNCK
;        JB      BTN1.5,DSTLP1   ; CANCEL
;        JB      BTN2.0,DSET     ; AHEAD
;        JB      BTN2.1,DSET     ; BACK
;        JB      BTN2.3,DSTREV   ; REVIEW
;        JB      BTN2.2,DSTNXT   ; SELECT
;        JMP     DSTLUP
;DSTLP1: JMP     FINISH
;;
;DSTNXT: CALL    BMD
;        JMP     DSTLUP



The BMD probably switches between time-fields: days, hours, minutes, ...

BTN2.3 means probably "button connected in port 2, pin 3".


I wonder if the semicolons are later added in the beginning of each line?
The semicolon means that the rest of the line is comment, so the code seems to be commented out.

I'm sorry, but to tell more, the variable/constant definitions and the schema is needed.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1