On Thu, 21 Feb 2002 14:17:17 -0500 Andrew Kilpatrick writes: > Hi, > > I'm working on DMX-512 receiving code with the PIC16F874 using > the built in USART. DMX uses a break to start a new packet. It > is supposed to be 88uS (2 frame times @250Kbps), and the recommended > practice says that receivers should detect on slightly less, like > 70uS. > > So far I'm using the framing error flag to detect a break by > making sure that all the data bits are low. I've been getting a bit > of instability with this method. Is there a better way? > > Also, the PIC16F874 datasheet is confusing when it talks about how > to read the error flag bits in the receiver. It says that the FERR > flag gets buffered in the FIFO, but the block diagram wouldn't > suggest > that. Then it says to read the error flags before requesting a byte > from the FIFO. If FERR flags are buffered in the FIFO wouldn't this > mean that you'd be reading the wrong data unless you check the FERR > bit after you get data from the FIFO? Can someone please explain > this? > I've done a fair amount of DMX transmission and reception using PICs (mostly 16c74 and 18c452). I detect a break using the FE flag, then "eat the byte" out of the usart data register, then go back to waiting for the next incoming byte. After the FE, we assume the incoming byte will be the start code byte (which should be zero). As each byte is brought in, FE is checked. If an FE occurs, the state machine is reset to the point where we are waiting for the start code byte. I don't check the contents of the byte when there was an FE. I just throw it out. Seems to work (many thousand units now out there). 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: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads