> On 9/16/06, Denny Esterline wrote: > > > > There are several approaches to this. As others have mentioned > > RC oscillators are not usually stable enough for async serial, > > but there are plenty of clocked protocols that are workable with > > RC oscillators. But here's the problem - an 8Mhz PIC is chugging along > > at 2 MIPS. 2 million/64k leaves about 31 instructions per bit time. > > Probably not enough to do anything else useful. Find a way to > > reduce your data needs or get a bigger proccessor. > > > > I understand that a small PIC probably does not fit the requirement. > I need to use internal oscillator and a small MCU due to space constraint. > So it seems quite doable to have customized 2-pin half-duplex communication > with a faster MCU like a 20MHz 4-clock 8051 and a 16MHz single-clock > MSP430. > > Do you have some examples of "clocked protocols"? My idea is to > embed the clock into the data bits. For example, 1000 will represent "0" > and 1111 will represent "1". The first rising edge is the sync signal. > Does this sound okay? > > Regards, > Xiaofan No matter how you encode it that's still a LOT of data to be receiving continuously on a microcontroller. Ask yourself what your going to do with it - you don't have RAM enough to store it - you don't have time enough to do math with it. Look for ways to reduce that data. One example is the NEMA datastream from a GPS unit, it sends out data continually, but most applications simply ignore it and parse out a few relevant details. Your example above is a possible protocol, probably workable. But notice that you now require several transitions per bit, obviously this requires several more instructions per bit. Even on a 16MIPS MSP430 that's about 250 instructions per bit time. Sounds like a lot, but when you add some looping and jumps to handle protocol bit stuffing, you don't have a lot of free time left. For other suitable protocols head to your nearest search engine with phrases like "self clocking serial" or "Manchester encoding". You'll find many - here's the wikipedia page on Manchester http://en.wikipedia.org/wiki/Manchester_encoding it's a little sparse but it's a good start. -Denny -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist