Are you doing context saving? You mention in the first line of your isr you clear the intf. This should not be! Peter van Hoof --- Tim ODriscoll wrote: > Hi Everyone, > > I'm obviously doing something blatently silly here, > but for the life of > me I can't figure it out... > > I've got two 16f628's hooked up as a master/slave > with rs485 IC's > between them. I'm trying to send one byte from > master to slave > (expanding to 4 bytes when I can send one > successfully). I've done this > loads of times before on other projects, so it's > quite frustrating that > it doesn't work anymore.... > > I'm receiving on portb,0, using a falling edge to > cause an interrupt. > The problem seems to be that the slave is > interrupting one more time > after it's collected the initial byte, but it > shouldn't be interrupting > as portb,0 is back to it's idle state of high. > > I've hooked up my dual-channel scope to portb,0 on > the slave and an > extra debug pin which I'm pulsing everytime it > samples the line. The ISR > only collects one byte. I've added a few ms of a > delay at the end of the > ISR before I retfie. The bit-time is 1ms. > > You can see from the attached trace that the slave > is jumping to it's > ISR when portb,0 is still high. It's not constantly > interrupting, it > only does it twice for each byte I try to send. > > Here's how I've setup ints on the slave: > bsf status,rp0 ; Bank1 > bcf option_reg,intedg ; Interrupt on > falling edge > bcf status,rp0 ; Bank0 > clrf intcon ; Prep intcon > bsf intcon,INTE ; Int on portb,0 > bsf intcon,GIE ; Global interupts > on > > ..and the first line of the ISR: > bcf intcon,INTF ; Clear the INT flag > > ..and the last line of the ISR: > retfie ; Exit the ISR > > I'm not using any other ints on the slave. I've > tried clearing the intf > flag multiple times throughout the ISR, but it's > still re-interrupting > as soon as it's done it the first time. > > Am I missing something really obvious, or is there > something I'm getting > totally wrong? > > Cheers, > > Tim > > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist