Hi all. It's time for Josh's nightly "I'm trying to use parts of the PIC I don't fully understand" question. Well, thanks to Bob, Tony, Wouter, and I think Vasile, I now understand the PCLATH. Well, enough to get the job done. Anyway, now I must calculate the values I will put in to that jump table. Here is the situation: I am taking an 8 bit value, and using it to come up with 256 values of delay. Just so you know, it's a 16f628. Each individual delay section will be 162.5 instruction cycles. I'll round it up or down for the ones that don't come out to whole values. So for instance, if I get a value of 3 for my delay, it should delay 487.5 cycles, or 488. The values are not absolutely critical down to the clock cycle, but they should be relatively close. I know I have to use the prescaler, but I'm confused about how to use it effectively. It's too bad I can't get the prescaler to be 1:162, then I'd just have to plug in my delay value in the TMR and I'd get the right delay :) However, that won't work (at least as far as I can tell, please let me know if I'm wrong). Anyway, If I use a 1:128 value for the prescaler, I have problems. Even if I use a value of 255 in the TMR register, I only end up with (255x128) 32 640 cycles before my interrupt, and I need about 41 437. So it seems I must use a value of 1:256 in the prescaler. But in this case I only end up with approximately 162 levels of delay, rather than the 256. I guess I can deal with this, I'm just curious if there is another way, or even if my thinking is correct. I don't really want to use TMR1, even though it has 16 bit registers, because that would nessecitate 2 lookup tables, one for the low byte, and one for the high byte. So, please let me know if I'm calculating this right. And if anyone has any innovative ideas, I'd really appreciate hearing them! Thanks! Josh Koffman -- A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools. -Douglas Adams -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu