PIC TIMER0 and 7-segment multiplexing problem

walid el masry

Joined Mar 31, 2009
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


Joined Jul 17, 2007
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:


Joined Dec 31, 1969
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.