Try this way: ;*********************************************************************** ;TEMPERATURE_TABLE converts values from LM335 sensors to values ; between -23 to 1000C. Negative values are ; determined by NEG flag. ;*********************************************************************** TEMPERATURE_TABLE movwf W_TEMP ;save w movlw high TABLE ;get HI byte of TABLE address movwf PCLATH ;to PCLATH=HI of program counter movfw W_TEMP ;restore w addlw low TABLE ;add start address to table entry byte btfsc STATUS, C ;are we going over page boundary? incf PCLATH, f ;yes, so change page movwf PCL ;no, calculate jump TABLE retlw .151 ;128 (MSB) is added to actual retlw .151 ;number to indicate negative values!! retlw .150 retlw .150 retlw .149 retlw .149 retlw .148 retlw .148 --- Jim Tellier wrote: > OK, this seems embarassingly simple, but... > For midrange PIC (16F877), I write: > movlw 0 > call getvalue > ... > getvalue: > addwf PCL, F > retlw B'10100000' > ...etc. > > All code is within page 0 (< 2048 bytes). Single > step thru, upon exec the 'addwf' the simulator says > W=0, but the retlw isn't executed... control jumps > off into middle of some other code. > I'd swear I've used this construction before, but > this isn't flyin'! Any ideas? Thanks! > Jim > > -- > http://www.piclist.com hint: To leave the PICList > mailto:piclist-unsubscribe-request@mitvma.mit.edu __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu