I have a program I've written to measure RPM via a hall effect sensor, and display that data on a HD44780 compatible LCD. I have can read the hall effect sensor via interrupt, and i can display stuff on the LCD just fine, but there must be some weird interactions that I'm not understanding because my program (or more specifically the arduino board) hangs randomly.
hopefully someone on this forum can point out to me either what I'm doing wrong, or some tips to help narrow down what is causing the problem.
I have a delay in my loop() function, but from reading the documentation the interrupt will still get called fine during that, and it appears too.
If I start triggering the hall effect sensor, eventually it will lock up and the 'alive' count will stop updating. It only locks up during (or more specifically in relation to) an interrupt firing, but I don't know how to be any more specific.
If it was a power problem, I'm surprised that I would see the same effects when running via USB power and via an external power supply. Is there something inherently wrong with how I have the hall effect sensor wired, and am using the built in 20k pull up resistor?
Well I don't know but if you are measuring RPM then you have something generating the R that you are measuring. It is my guess that this is generating interference that is causing your system to crash. Remember it is not only conducted interference that can be a problem but also radiated. Extra decoupling helps.
If it were just interference to the sensor then you would get spurious input signals, probably too many, that wouldn't (shouldn't) cause a crash of working code. So it has to be the general environment.
If so, then there's a "known" bug with the OSX version of the avr-gcc (4.3) compiler included in Arduino 0012 and 0013. Basically it generates bad interrupt handling code which causes crashes and lockups.
You could prove this by building your sketch on Windows to see if the lockups go away.