I’m using a Diecimila board, and I have a tiny program that uses the analog comparator. I’ve encountered a weird bug - when I set the analog comparator status register (ACSR), my program seems to loop forever in the setup() routine. Here’s a small program that replicates the behavior:
ACSR = 0x48;
When I run the program I get a loop of “hello”'s displayed to my monitor. If I comment out the line setting ACSR, I see a single hello as would be expected.
Has anyone seen anything like this and can you suggest a workaround? I’ve tried fiddling with things like putting the assignment of the ACSR after the print statements, but I always see the same behavior. I checked the 168 header files and it seems I’m referencing the ACSR correctly, but even if I wasn’t I don’t see how that would cause the setup method to infinitely loop. Any help is greatly appreciated.
Thanks in advance -