Lasse Madsen wrote: > >How did you come to the conclution that the value 7 had to be AND with W ? >Is there a formular for this or is this some- mega advanced "you dont wanna >know" outrageous procedure which requires a degree in hardware archetecture >to understand because if it is >i think i will satisfy my self with the answer that: 7 was a "good number" >:o) If you look at 7 in binary, it's 00000111. By ANDing with it, you keep only the bits that you care about. Masking with 7 keeps your value within the bounds of your table. If you had, for example, 5 bits to look at (with 32 cases possible), you would mask with 0x1f to get just the bits that you are interested in. In your case, by masking with 15 (0x0f), you had one extra bit that was giving you a result too big for your jump table. When it went 'off the end', you lost control of your program. Regards, Bob _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads