David Thompson wrote: > I am sure I read recently (on the "gotchas" thread) about bugs in the > implementation of UART interrupts on the 16F877. Namely, they don't work. The chip interrupts work fine. MPSIM's simulation DOESN'T! > I am in the process of writing an interrupt handler which seems to be going > fine, but never is triggered by the UART TX or RX interrupts. I am mostly > concerned about the RX buffer full interrupt, as I want to put some code in > the handler to buffer any data that tries to sneak in when the program is > busy. So set up a proper ring buffer and you'll never miss a character. >The relevant flags are working fine, just no interrupt is triggered. > > Yes, the relevant interrupt enables are enabled. I am using Octavio's ICD Did you turn on the USART? (SPEN & CREN in RCSTA, TXEN in TSXTA) Did you configure TRISC appropriately? C6 out, C7 In. You shouldn't need to set TRISC but by explicitly setting it up (and putting a 1 in PORTC:6) you avoid a glitch character transmission on startup). > (great thing - by the way) to develop this but I don't think this interferes > with the RX/TX interrupts. Depends on what resources it consumes. You have to ensure that you aren't using the scratch memory the ICD needs. Why is it that something as common as an interrupt driven serial ring buffer is constantly being reinvented? I searched the web for more than a week, looked at Microchip app notes, and ended up writing one from scratch. Now my employer owns it and I can't publish it. I'm sure it's been reinvented a hundred times by now. I guess shared code libraries don't yet exist in picland. Robert.Rolf@UALberta.ca