Ah, now it makes more sense. A couple of questions: Each wire can generate from 0 to 65535 pulses, right? (or is it 1 to 65535?). Do the pulses have to be absolutely consistent in length? Do the pulses have to be absolutely consistent in spacing? How do you know how many pulses each wire needs to generate? You say triggers come in every 10 seconds. This implies that the pulse rate must be at least 65535 per 10 seconds or 6554 per second, right? If this is the case you have at most 152 instructions per pulse. This would seem to be doable. Here is some pseudocode to get you started: unsigned int counts[5]; // The 16-bit count value for each output unsigned int pulsenum; // Which pulse we are generating unsigned char active; // Which outputs are are generating pulses for when trigger comes: active = B'11111' // Start with all pulses enabled pulsenum = 0 // Which pulse we are working on do { if (counts[0] == pulsenum) active &= ~1; // Turn off output 1 if (counts[1] == pulsenum) active &= ~2; // Turn off output 2 if (counts[2] == pulsenum) active &= ~4; // Turn off output 3 if (counts[3] == pulsenum) active &= ~8; // Turn off output 4 if (counts[4] == pulsenum) active &= ~10; // Turn off output 5 PORTB = active; // Start pulses on all active pins delay a bit PORTB = 0; // End the pulses ++pulsenum; } while (pulsenum != 0); You will need to use isochronous code to get evenly spaced pulses. Bob Ammerman RAm Systems (contract development of high performance, high function, low-level software) -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu