> At 01:18 AM 3/9/2001 +0530, you wrote:
>
> It looks like you will jump to the address PCL+W. If W varies each time you
> call nib2hex then the jump position will also vary (random). There is a
> application note from Microchip on table reads.
>
> Good luck,
>
>
> Peter
> >Hi guys,
> >
> >I've been trying to work out on a Byte to Hex routine for a project of mine.
> >
> >But the Table read mysteriously jumps back to a totally unrelated area on
> the PIC.
> >
> >Here is the code frag that was causing the problem.
> >
> >;************************************************************
> >;*****************BEGIN CODE Block*******************
> >
> >;Enter with low nibble in W
> >;Exit with ASCII code for Nibble in W
> >nib2hex:
> > addwf PCL,f Mysterious Jump from Here
> > dt "0123456789ABCDEF"
> >
> >;Enter with byte in W
> >;Exit with Two ASCII chars in hex_hi : hex_lo
> >byte2hex:
> > movwf bintemp
> > andlw 0x0F
> > call nib2hex
> > movwf hex_lo
> > swapf bintemp,w
> > andlw 0x0F
> > call nib2hex
> > movwf hex_hi
> > return
> >
> >;************************************************************
> >;********************END CODE BLOCK*****************
> >;************************************************************
> >
> >In MPLAB SIM, when the execution goes to the code commented as "Mysterious
> Jump from Here" ,
> >
> >PCL = 0x1B
> >PCLATH = 0x 00
> >
> >
> >and then the code suddenly jumps to a *random* location
> >
> >0x21 (PCL).
> >(I thought Retlw was supposed to Return back!)
> >
> >What kind of a problem is this ?
> >Some sort of a bug ?
> >And finally, anyone has done some similar routines ?
> >
> >
> >Jeethu Rao
> >
> >--
> >
http://www.piclist.com hint: The list server can filter out subtopics
> >(like ads or off topics) for you. See
http://www.piclist.com/#topics
> >
>
> --
>
http://www.piclist.com hint: The list server can filter out subtopics
> (like ads or off topics) for you. See
http://www.piclist.com/#topics
>
>
>
>