Decrementing packed BCD question

Discussion in 'Embedded Systems and Microcontrollers' started by RG23, Jun 13, 2011.

  1. RG23

    Thread Starter Active Member

    Dec 6, 2010
    301
    2
    I am trying to implement a decrement counter for the seconds register
    It works quite fine.

    But I have the following issue.
    When I am in the edit mode my seconds value should keep blinking on LCD
    It works fine for all other values except 00

    When the value 00 should keep blinking somehow '5A' blinks in place of 00

    If anyone has an idea please let me know.

    Thanks


    label921:

    movlw 0x01
    subwf SECS1,0
    btfss STATUS,DC
    addlw -0x06
    movwf SECS1
    movlw 0xC6/////////position on display
    movwf PORTD
    call SND_CMD//////////send command to LCD
    movf SECS1,0
    call writebcd//////display data on LCD
    movf SECS1,0
    btfsc ZERO
    call label_S0
    return

    label_S0:
    movlw 0x00
    movwf SECS1
    movlw 0xC6
    movwf PORTD
    call SND_CMD
    movf SECS1,0
    call writebcd//////display data on LCD

    movlw h'5A'
    movwf SECS1
    return
     
  2. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    Something to do with these lines?
    movlw h'5A'
    movwf SECS1
     
  3. RG23

    Thread Starter Active Member

    Dec 6, 2010
    301
    2
    If I dont put those lines
    movlw h'5A'
    movwf SECS1

    the counter doesn't work right
     
  4. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    It looks like if 5A is in SECS1 then the first part will display that, then straight afterwards the second part will send 0 to the display. If you put the check for zero earlier in the first part so that it skips over sending 5A to the display, will that fix it?
     
  5. RG23

    Thread Starter Active Member

    Dec 6, 2010
    301
    2
    I solved that issue
    Thanks for your opinion Mark
     
Loading...