That's because the addition to PCL is 8 bit and the high bits aren't managed properly(16xx doesn't have 16 bit add command) you need to increment PCLATH for the next section of the table (I only found this out last weekend) There is a good worked example in the techref at piclist.com. The basic understanding I got from the list (thanks David and Jan-erik Olin and others) is that the addwf pcl is limited to 8 bits but a direct goto is 11 bits and PCLATH 3,4 are the page bits. This leaves bits 0-3 of PCLATH which need to be set according to the page location on computed (addwf PCL,F)jump. Hence a table that starts at 0800h is called after setting PCLATH,3 to 1 and the continuation of the table past 0900H requires a conditional incf PCLATH,f to continue the table past the first 256b Below is the example sent to me that helped lots and the link to the techref I am no expert but the following code helped lots Steve.... Surprisingly hard to get a straight answer. However, assuming you are using the 16F series, have a look at the PICLIST archives at: http://www.piclist.com/techref/microchip/tables.htm Here is one of the code snippets: fcall Table ; will be returned here with data in W. ; Tony Nixon ; plus tweak from Dmitry Kiryashov [zews at AHA.RU] Table movlw High(TStart) addwf OffsetH,W movwf PCLATH movlw Low(TStart) addwf OffsetL,W skpnc incf PCLATH,F movwf PCL ;computed goto with right PCLATH ; end of Table subroutine. ; ... ; org 0x???? TStart Retlw d'0' Retlw d'255' Retlw d'9' .... etc As you can see, you have to account for when you roll over the 256 boundary on the address, and correct the PCLATH. David -----Original Message----- From: pic microcontroller discussion list [mailto:PICLIST@MITVMA.MIT.EDU] On Behalf Of PSL Sent: 06 January 2004 19:32 To: PICLIST@MITVMA.MIT.EDU Subject: Re: [PIC]: ADDWF PCL,F Oic anyway is there any restriection in where this instruction can be use in creating a jump table. I know one of it is that the jump table should be with in 256 bytes(0x0000 to 0x0100) as by doing ADDWF PCL,F we are doing a change at a max of 256. i try the table on 0x0200 it does not work(16f876) can any one enlighten me why? thanks ----- Original Message ----- From: "Jan-Erik Soderholm XA (TN/PAC)" To: Sent: Wednesday, January 07, 2004 2:03 AM Subject: Re: [PIC]: ADDWF PCL,F > PSL wrote : > > how many cycle does > > ADDWF PCL,F > > takes? is it 2 cycles like goto or is it 1 cycle? > > > *Any* instruction that modifies > the PCL takes 2 cycles, what ever the > data sheet says... > > Jan-Erik. > > -- > http://www.piclist.com hint: To leave the PICList > mailto:piclist-unsubscribe-request@mitvma.mit.edu -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu