PIC TIMER0 and 7-segment multiplexing problem

Discussion in 'Embedded Systems and Microcontrollers' started by thejmh, Jul 3, 2009.

  1. walid el masry

    Active Member

    Mar 31, 2009
    132
    0
    wooow finally it works i was gonna be crazy
    it works in replacing
    INCF DIG0,DIG0 to INCF DIG0,1 and so on although it not wrong it is the 1st time i replace destination number with the register name :):):)
    great thnx millwood , SgtWookie really i waste your time

    i will include
    Proteus 7 and pcb of circuit links soon and if there any comments of the hardware you are welcome
     
  2. SgtWookie

    Expert

    Jul 17, 2007
    22,201
    1,809
    It was not a really obvious problem.

    If you look at DIG0's equates, it's x21, which is b'100001' - the 1's bit is set.
    If you look at DIG1's equates, it's x22, which is b'100010' - the 1's bit is not set.

    So when you executed INCF DIG1,DIG1 it was interpreted (I believe) as INCF DIG1,0
    and the result wound up in the W register, which you immediately overwrote with another value.

    Since DIG1 was not incrementing, it would never overflow to xA, so DIG2 was never getting incremented.
    DIG2 equates to x23 which is b'100011' - the 1's bit is set; so if the logic ever got there it would have incremented.

    Proteus version 7.0 is shareware, and can be downloaded here: http://proteus.software.informer.com/7.0/
     
    Last edited: Jul 10, 2009
  3. walid el masry

    Active Member

    Mar 31, 2009
    132
    0
    perfect and thnx for help
     
  4. millwood

    Guest

    this shows how difficult it is to develop code in assembly.

    I wrote my C code and got it up and running in less than half an our, and I was new to that chip.
     
Loading...