Yesterday I finally had the change to go to the repeater station and change out the microprocessor that was reading the sensor data from the weather station and pushing it to wunderground. The reason for the upgrade was that I never intended to use the microprocessor that was in there (Arduino Uno + Ethernet Shield) but I ended up having to use it while I would try and get the Teensy 3.1 hardware working.
I believe there was a defect in either the Arduino IDE or the Teensy plug-in that caused the etherent library to not function correctly. When I uploaded the same program after installing software updates for the IDE and Teensy plug-in everything worked as expected. And I addressed a software defect that resulted in reporting windgust of over 800 km/h every once in a while. I borrowed some code that would read the anemometer pulses and convert it into windspeed and windgust. To catch the rotation of the anemometer an Interrupt Service Routine (ISR) is triggered every time it does a full rotation. I discovered that there was a shared resource that didn't use mutual exclusion when the windspeed was calculated. So in the odd occasion it happened that the windspeed was to be calculated while the variable within the ISR was changed resulting in odd results. Once the cause was identified it was easily solved by adding noInterrupts(); before the calculation and interrupts(); after the calculation to guarantee mutual exclusion.
0 Comments
Your comment will be posted after it is approved.
Leave a Reply. |
AuthorGeorge Timmermans, Research Toolmaker, Software Engineer and Tinkerer Archives
April 2023
Categories |