> ps2 interface ask pic as slave, it is really bad idea and occupied > INT that brings lots trouble later. Ok, I am afraid I must be guessing here, but I think you are saying: "Using a PS/2 interface with the PICmicro as a slave is a really bad idea and will occupy the interrupt handler which will bring a lot of problems later on". If this is not what you meant, please post what you meant, and ignore the following response. 1) The PICmicro will always be a slave of the PS/2 device. The PS/2 device always generates its own clock: this is part of the protocol and can't be avoided. 2) I am assuming you hook up the PS/2 clock line to a pin that can handle interrupts, and set up the interrupt on the appropriate pin change (LOW to HIGH, I think). The interrupt routine itself would be quite short, as it would just shift the databit into the result variable, and set a bit once a full byte is received, possibly copying the shift buffer into a safe location so the next byte can be received. As far as I can tell this wouldn't really occupy the interrupt routine much. apart from the context saving and loading it would take about 10-20 instructions. If you are really worried about the time spent in the interrupt handler, you could just copy the one data bit to a variable available in all banks: in that case you could do without the context loading and saving, but your main routine would have to handle the individual bits at a slightly faster rate (though still nothing terrible). If you have multiple interrupt sources you might have to build in an additional check for the source of the interrupt and add appropriate bit resets, but this is also trivial. In short: I don't think it is a bad idea to do this, in fact, I think it is a very good idea. Of course, when you have extremely time critical code, like my NTSC generating stuff, you don't want any interrupts at all. However, in most cases a 30 instruction interrupt that occurs at most every 800 instructions (assuming a 4 MHz clock) doesn't seem to bad. Greetings, Maarten Hofman. -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist