In SX Microcontrollers, SX/B Compiler and SX-Key Tool, Peter Van der Zee wrote: Hi Paul; Well it works a little differently. The issue is to sync-up the interrupt routines on the transmitter (syncer) and the receiver (syncee). Once you have that accomplished, you can transfer data by setting a transmit line high/low and sample it with the other unit at exactly the right time, because you KNOW you are synced. In fact, once you are synced, there are other benefits; two (or more) units connected to the sync/data line running the same software, will execute their programs in exact synchronism. This can be useful for applications where multiple SX's must perform functions at PRECISELY related times. Any number of devices can be synced by simply connecting to the data line. To synchronize the interrupts, the syncer sets a data line high at a specific point early in its ISR, and drops it again some few instructions later. The syncee, running an ISR of the SAME interrupt period, samples the data line early in its ISR. If that sample was high, then its interrupt period is adjusted so its next interrupt occurs exactly one instruction earlier. Had the level been low, then its interrupt period is adjusted to make the next interrupt exactly one instruction later. This has the effect of the receiver (syncee) sliding by the transmitter's sync pulses until it finds a positive going edge. And once that is found, it remains locked on that. Sending data is then simply a matter of appending data bits to the sync bit; the receiver knows EXACTLY when to sample at the middle of the bits; its all locked to the sync pulse's leading adge. I use a sync (interrupt) interval of 1 to 5 usec, and a sync (bit) width of 5 to 10 instructions. Once chosen, these numbers remain fixed for any particular application. One caveat is that the data bits must be out of the way before the next sync pulse (interrupt) occurs. Dead simple and works 100% reliably, regardless of a small amount of resonator drift. In fact with some modifications, one can follow a slowly varying interrupt (baud) period. Although there are a lot more tricks (half duplex operation, redundant transmitters etc.), this is the basis of my concept. Hope this clears up some of the magic. Cheers, Peter (pjv) ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=2&m=88814#m89487 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)