On Thu, 17 Jan 2002 09:29:19 +1000 David Duffy writes: > I assume that this is for DMX ? I put 20MHz 16F628's in my dimmer > project > as I came to the conclusion that you need at least a 10MHz clock to > do the > 250Kbps data rate. I have not written the DMX code for it yet > though. SPBRG > needs to be 4 at 20MHz and 20MHz/4MHz = 5 so you'd have to have 0.8 > for > 4MHz ! Maybe a value of 1 at 5MHz would work. (but not for a 4MHz > part) > The 16F628-20/P is currently cheaper than the 16F628-04/P I've > found. Yes, it's DMX (actually, it's our DMX talk back). I've done bunches of DMX stuff using a PIC at 16 MHz. However, here, I thought I'd use 4 MHz since I should then be able to use any 16F627. The datasheets (for example, page 73 of the PIC16F62X datasheet) say the bit rate is Fosc/(16(X+1)) if BRGH=1. Solving for X, we get X=(Fosc/(16*BR))-1 . If Fosc=20MHz and BR=250e3, we get X=44 (not 5). Dropping to 4 MHz, we get X=0. So, it seems that it would work. Some have said X has to be between 1 and 255 inclusive, but the datasheet says 0 and 255 inclusive. The datasheet also shows several examples where X=0 (for example, 625 kpbs with Fosc=10 MHz). So, the question remains, why does the datasheet show NA for 250 kbps at 4 MHz? I have since changed my resonator to 16 MHz and found other bugs in the code. I imagine that if I change back to 4 MHz (now that the bugs are removed), it will work... but I don't know if I want to make the effort. Just trying to figure out why the datasheet says 250 kbps at 4 MHz is "NA." Looks like it should work... Harold FCC Rules Online at http://hallikainen.com/FccRules Lighting control for theatre and television at http://www.dovesystems.com ________________________________________________________________ GET INTERNET ACCESS FROM JUNO! Juno offers FREE or PREMIUM Internet access for less! Join Juno today! For your FREE software, visit: http://dl.www.juno.com/get/web/. -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu