Hi, My last pic project was a midi switching device that would receive Program Change information and recall via internal EEPROM data for that particular change and display a three digit number and 8 leds ( It also scanned a 12-key keyboard and latched and external 74HC564.) It was designed around a 16c84, but it was running at 8 Mhz. I used the porta RTCC/RA4 pin configured as counter set to increment on falling edge of external counter( the midi start bit ) loaded with FF as to cause an interupt on overflow. From there its a matter of setting the RTCC back to internal clock and waiting exactly until the middle of the next bit. Or you could poll it a bunch of times and average the result. ( but not after the initial start bit, too much going on!) Also, the interupts are disabled during most of the midi byte. The timing was very critical, even at 8 Mhz, and there was just barely enough time even with 64 cycles! I couldn't emagine trying to squeeze it down any further for this type of setup. You could maybe just poll a pin like mad and reset a timer as soon as the start bit comes in. Hope this helps. p.s Watchout for AN555( Asychronous Serial I/O )!!! The code is sloppy, indeed. There are whole sections of code that do absolutely nothing! :-( Except take the place of NOP's ;-) Overall the Book is great, and I suggest getting it :-) p.s ( I accidentaly sent this to Mike Watson, sorry mike ) Regards, Hamilton |_ _ _ _ | )(_|( | ) @ s l i p . n e t h: http://www.slip.net/~ham w: http://www.mesaboogie.com At 08:52 AM 1/28/97 GMT, you wrote: >In message <32EDBFD6.7E32@isy.liu.se> PICLIST@MITVMA.MIT.EDU writes: >> Craig Knotts wrote: >> > >> > 32 instructions isn't much in the way of elbow room... I'm having a >> > hard time imagining what you could usefully do with any MIDI data in >> > that amount of time. Maybe at 10 MHz things would be easier. >> > >> > Is this device a receive only, transmit only, or both? I'd certainly >> > wish for a built-in serial port before tackling MIDI for anything but >> > the most simple task. >> >> Well, I'm not planning to do much processing, just receiving three bytes in a >> sequence, and then set/reset a bit or send out the data on the ports and go >> back to receiving again. What do you think? >> > >I think you will loose data if you wait for your transmission >to end before you start receiving again. > >If I were to do it (and I have a project in mind) I would look >to either bit-bang with a much higher clock speed (20MHz on a >16C61) or go to one of the 28 pin pics with a uart on board. > >Regards, > > >Mike Watson > >