
We declare the led state control and interrupt counter variables.0th pin of PORT P3 or Receiver pin of Microcontrollerġst pin of PORT P3 or Transmitter pin of MicrocontrollerĢnd pin of PORT P3 or External Interrupt 0 of MCUģrd pin of PORT P3 or External Interrupt 1 of MCUĤth pin of PORT P3 or Timer 0 interrupt of MCUĥth pin of PORT P3 or Timer 1 interrupt of MCUĦth pin of PORT P3 or Write to External data memory pinħth pin of PORT P3 or Read from External data memory pinĮxternal crystal pin 2 of MicrocontrollerĮxternal crystal pin 1 of MicrocontrollerĠth pin of PORT P2 or High-order Address bit 8 of MCUġst pin of PORT P2 or High-order Address bit 9 of MCUĢnd pin of PORT P2 or High-order Address bit 10 of MCUģrd pin of PORT P2 or High-order Address bit 11 of MCUĤth pin of PORT P2 or High-order Address bit 12 of MCUĥth pin of PORT P2 or High-order Address bit 13 of MCUĦth pin of PORT P2 or High-order Address bit 14 of MCUħth pin of PORT P2 or High-order Address bit 15 of MCU

Volatile uint16_t timer_counter = INTERRUPTS_PER_SECOND One processor cycle takes 12 clock cycles, and thus we arrive at 1600^8 = 5208.33333.

It's configured as a single 8bit timer, so this happens every 2^8 processor cycles. Assuming oscillator is 16MHzĪn interrupt occurs when the Timer0 overflows. We also include stdint.h which contains definitions of uint8_t and uint16_t integer types. It contains macros for interacting with registers as if they were variables.

We start by including the AT89X051 header from sdcc.
