Hi, Okay, I've tried searching through the archives but I just can't seem to find the information I need! I know you guys are pretty brainy out there so maybe you could help me? I'm building what is known in my trade (sawmilling) as setworks. This basically measures the output from an optical rotary encoder counting the pulses and measuring the distance travelled. The shaft of the encoder is mounted onto a rack system with teeth. I've ripped out the old Klockner Mueller system to build my own (it had lost the program and proved to expensive to replace) but am having trouble getting pic (a 16C64A) chip to count the pulses properly. Right: Problem 1: The keypad to enter the sizes isn't being recognised correctly! I based the program round one I found in the cookbook and simulated it where it worked properly, just doesn't seem to work when plugged in (the wiring is correct from the keypad to the chip, I've had that checked) Any ideas?? Problem 2: Simple electrical fault here that I just can't fix. The pic drives a couple of relays to switch a 240V supply for the motors, this seems to reset the whole system or mess the counting up, any electronics boffins who can help with that one?? Problem 3: (I know, there's a lot of them!) The main problem is that it doesn't count properly. The encoder was built by a company who no longer exist but I can get a replacement from a company called Ideacod. There encoder which is the exact spec of my one is an incremaental PAO2 5 7 9 480 type encoder Now, I can't really help with the numbers as I've gone and lost the book with them in (I've phoned for a new one which I can supply to anyone in the know!) It's counting at 480 pulses per revolution, tooth pitch of 8mm and 96mm per revolution of the encoder (or 0.2mm per pulse). These pulses are basically being fed into the pic (after a bit of cleaning up) to count and move the motors accordingly. By the way, my idea is to type the number in on the keypad and the whole shebang moves to that size. The whole thing simulates correctly on mplab but doesn't work at all when connected to the machine. Can anyone help me out there please?? I've been at this off and on for over a year now! If you want or need any more help with exact specs of this thing or need to know anymore about what I've done then I'd be more than happy to give you a copy of the source and/or circuit diagrams! Again, I know this seems a lot but I'd be eternally gratefull to anyone who can help! Thanks and I'll be looking forward to hearing from you!! Gavin Tennant