This unit is responsible for collecting the wind and temperature data and then transmitting it via the RF link to the other microcontroller. Timing for the circuit is controlled using Timer1. We only needed one timer for this unit and so we decided to go with Timer1 since it has a more accurate reset than Timer0. When Timer1 increments the variable "c" once every 10ms. We then use this variable to regulate the half second data collection and transmission. Another interrupt which is enabled on this unit is the analog to digital converter interrupt. We need to use this so that it can read the output of the LM34/LMC7111 temperature sensing circuit. The third interrupt used on this microcontroller is External Interrupt 0. This is connected to the output of the photo interrupter sensing the rotations of the anemometer and is triggered on the rising edge of the signal. The reason we chose to send data every half second is that this allows a sufficiently long time for the anemometer to gather enough rotation data to make a reasonably accurate wind speed calculation, yet it updates the data to the display unit frequently enough so that the user does not have to wait; it is a trade-off. We used the microcontroller's UART to communicate the data to the RF transmitter. We did this so we only had to decide which variables to send and when to send them. The UART takes care of the decomposition of the bytes into a series of bits.
Remote Display Unit:
This unit is responsible for receiving via the RF link and then displaying the wind and temperature data. Just like the detector, we only required one timer and so we used Timer1 to regulate the timing of the unit. The other interrupt is the UART receive complete interrupt. When a receive is completed the interrupt checks the character which has been deposited in the UDR if it is equal to an identifying character, 0xbb. After that has been received we know the next three bytes which come through the RF link are the wind speed, wind direction, and air temperature, in that order. Once the temperature variable is received the interrupt resets the conditions to look for the identifier again.
We have a simple state machine with three states which organizes the operation of the unit. The default state is what the unit boots up into and stays in as long as no data is being received. What it does it alternate between displaying, "Wind Caddie" and "No Data" on the LCD. If the microcontroller is in any other state for more than 30 seconds without receiving data, it will reset back into the default state. One of the other two states is for displaying the wind data and the third state is for displaying temperature data. A push button on the unit toggles the microcontroller between the two states. In the wind display state, wind speed is displayed in the middle and the two characters on the far right are used for showing the wind direction. Using combinations of four characters, one for each of the cardinal directions relative to the unit (forward, backward, right and left) it displays the wind direction data in one of each directions. The four cardinal directions !
use single characters and the directions halfway inbetween these use two characters to impart the information to the user. Unfortunately, the up and down arrows on the LCD we are using did not work; for some reason it isn't supported, so in place of those we use "F" for forward and "B" for behind. The right and left arrows are supported by the LCD we are using for the display. The temperature is the third state and it displays the value in the middle of the LCD.