Performing counter increment

Discussion in 'Embedded Systems and Microcontrollers' started by RG23, Apr 1, 2011.

  1. RG23

    Thread Starter Active Member

    Dec 6, 2010
    301
    2
    main:

    movlw 0x00
    movwf count1

    /////1 second routine

    incf count1
    movf count1,0
    call bcd
    return


    bcd:////////////////bcd to ASCII conversion routine
    movwf TMP5
    swapf TMP5,0
    andlw 0x0F
    addlw 0x06
    btfss STATUS,DC
    goto lessnine3
    addlw 0x31
    goto digit3

    lessnine3:
    addlw 0x2A

    digit3:
    movwf PORTD
    call SND_DTA
    movf TMP5,0
    andlw 0x0F
    addlw 0x06
    btfss STATUS,DC
    goto lessnine4
    addlw 0x31
    goto digit4

    lessnine4:
    addlw 0x2A
    digit4:
    movwf PORTD
    call SND_DTA
    return
     
  2. RG23

    Thread Starter Active Member

    Dec 6, 2010
    301
    2
    Above is part of code I am working on

    I need to increment count1 every second and display on lcd

    It gets incremented from 0 to 9 properly but after 9 I get A,B,C..........

    I want 10 after 9

    If anyone has an idea please let me know
     
  3. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
  4. RG23

    Thread Starter Active Member

    Dec 6, 2010
    301
    2
    Actually I figured it out.

    Thanks a lot appreciated
     
Loading...