MC1 is running at 1 MHz and is connected to two switches, one pushbutton and an
LED. MC1 operates in two states; S1 and S2. When the system starts, MC1 is in state S1 by
default and it toggles between the states whenever there is an external interrupt. When
MC1 is in S1, it sends always a value of zero to MC2 always and the LED is turned on.
On the other hand, when MC1 is in S2, it periodically reads the value from the two
switches every 0.5 seconds and uses a lookup table to map the switches values (x) to a 4-bit
value using the formula y=3x+3. The value obtained (y) from the lookup table is sent to
MC2. Additionally, and as long as MC1 is in state S2, it stores the values it reads from the
switches every 0.5 seconds in the memory starting at location 0x20 using indirect
addressing. When address 0x2F is reached, MC1 goes back to address 0x20. As Long as MC2
is in S2, the LED is flashing every 0.5 seconds.
The timing in the two states should be done using software only. The LED is used to
show the state in which MC1 is in such that it is OFF when in S1 and is flashing every 0.5
seconds when in S2.
MC2 is running at 1 MHz and has 8 LEDs that are connected to pins RB0 through RB7
and a switch that is connected to RA4. This MC also operates in two states; S1 and S2
depending on the value that is read from the switch. As long as the value read from the
switch is 0, MC2 is in S1 in which it continuously reads the value received from MC1 on
PORTA and flashes a subset of the LEDs every 0.25 seconds. Effectively, when the received
value from MC1 is between 0 and 7, then the odd numbered LEDs are flashed; otherwise,
the even numbered LEDs are flashed. When the value read from the switch on RA4 is 1,
then MC2 is in S2 in which all LEDs are on regardless of the value received from MC1. The
timing for flashing the LEDs should be done using TIMER0 module.
For both microcontrollers, the specified times should be calculated carefully. If the
exact values can’t be obtained, then use the closest value.