Linked Questions

Popular Questions

Large number of case statements breaks I2C?

Asked by At

I am using an 8 bit PIC (PIC16F18326) and one of the main purposes is to process many different I2C messages. The PIC is configured as an I2C slave and needs to respond with various data to about 100 different commands. When a complete message is received via the I2C interrupt a flag is set. The flag is read from the main loop and a function is called to process the data using a switch...case statement and build the message response. Everything works fine when only decoding about 50 different messages but the PIC isn't even able to acknowledge the master when I grow the number of case statements above 50. Has anyone experienced similar problems with 8 bit PICs? Is there a max number of case statements allowed before the PIC does strange things? The compiler and linker don't report any errors or warnings. Please let me know if you have any ideas/suggestions.

Thanks, Jack

Related Questions