Hi all, I have the following issue and I am interested in either your suggestions or if you encountered the same problem. The example is based on the sample program I made for the real time clock library DS3231.
The DS3231 has two alarms and uses the IIC interface. The device has an interrupt line that can be activated when an alarm is triggered. I connected this line to the external interrupt of the PIC. The main program read the time and sends it to the serial port. Since the main program calls DA3231 functions, the IIC interface is used to access the DS3231. When an interrupt occurs, a register has to be read from the DS3231 to see which alarm was activated also using the IIC interface of course. In order to prevent that halfway an IIC transmission initiated by a library call from the main program, I disable the external interrupt of the PIC at the start of the main program an enable it again at the end of the main program. In that way I am sure that the interrupt does not interrupt an IIC transmission initiated by the main program. There is a delay at the end of the main program, sufficient for any pending interrupt to be handled. The problem is that it does not work. The PIC just hangs and does not start. The only solution I found is setting a flag in the interrupt routine and let the main program poll this flag and read the register from the DS3231 to check which alarm was activated. But in this way the whole idea of the interrupt is gone. Looking forward to your reactions and suggestions. Thanks. Kind regards, Rob -- You received this message because you are subscribed to the Google Groups "jallib" group. To unsubscribe from this group and stop receiving emails from it, send an email to jallib+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jallib/679a0f81-03fe-4310-b401-ac69f2d2aeadn%40googlegroups.com.