2.3.2 Interrupt-Driven Example

In the interrupt-driven example, a finite state machine (FSM) is implemented. If the driver is not busy transmitting data on the bus, this FSM is called from an eternal loop. When the driver is busy, the FSM will be skipped to allow any other code to be run. The FSM itself assumes that there is a sole DS1820 temperature sensor available on the bus. It will read the current temperature, and compute the CRC to make sure that it was read correctly. The temperature is then put in a global variable. Whenever the driver is busy, the eternal loop outputs the temperature to PORTB, so it can be observed, for instance, on the LEDs of an STK600 development board.