Hello Martarse,

M>>Anyways, I've make some test on my side.

high portb.0 '0001
pause duree

low portb.0 '0010
high portb.1
pause duree

high portb.0 '0011
pause duree

low portb.0 '0100
low portb.1
high portb.2
pause duree
...
... until '1111


I want to optimize this code because it uses many many space.

<<

Try the following: this simplified your code to count to 15 using your first 4 bits. If you want to go higher, remove the for-next loop. and let it "recycle" itself.

TRISB=%00000000
counter var byte
Portb=0;

Loop:
for counter=0 to 7 step 1
Portb=Portb+1
Next counter
Portb=0
goto Loop


Dwayne