In SX Microcontrollers, SX/B Compiler and SX-Key Tool, JonnyMac wrote: [quote="David Bayliss"]JM - that code is an excellent learning tool - thnx Couple of newbie questions to ensure I understood - a) The 1.5 bits after the initial start detection - is that to place your sample into the 'middle' of the pulse so that a minor mis-timing doesn't catch an edge? b) The timing of the RxReady test is set up so that even if the ready happens immediately after the previous test there will still be another test before a full byte comes in - correct ? c) Your interupt seems to be going at least 3 times faster than you ever really use (you're always clocking it down in your code) - so why have it so fast? David[/quote] A) Yes; after start bit detection (RX goes low using True mode) one waits 1.5 bit periods to land int the "middle" of the first bit; after that the timing is set to 1 bit B) Yes; at 38.4k baud a byte will take 260 microseconds; by checking at twice this rate I should never miss anything. And Peter's code gives us a buffer so we can actually be receiving a second byte before retrieving the first. C) I chose that speed to get very close to a baud-friendly rate (I use 4x [or multiple thereof] oversampling) and so that I could generate a tick timing of 10us that will be used for other processes (specifically, servos -- I've yet to add them in). ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=3&m=324554#m326315 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)