
Appendix 2
2(15)
}
else if ((PRT2DR & 0x40) == 0x40)
{
decision = 4;
button_press();
}
else if ((PRT0DR & 0x01) == 0x01)
{
decision = 5;
button_press();
}
// Button 1 P2.6
// Notes decision
// Forwards decision to function
// Button 1 P0.0
// Notes decision
// Forwards decision to function
if(count == 30) // If timer has interrupted 30 times,
{ // Photo frame is turned off,
Timer8_Stop(); // Resets
Read_enable_Switch(0); // Resets
SD_pwr_Switch(0); // Resets
count = 0; // Resets
}
ButtonSig1_Switch(0); // Button signals zeroed after forwarding
ButtonSig2_Switch(0); // Button signals zeroed after forwarding
ButtonSig3_Switch(0); // Button signals zeroed after forwarding
ButtonSig4_Switch(0); // Button signals zeroed after forwarding
ButtonSig5_Switch(0); // Button signals zeroed after forwarding
}
}
// Function description----------------------------------------
// Function takes decision value and forwards the respective button
// signal to the communications MCU.
// All values are reset in case of a new button push.
// Delays are set to give proper warm up time of MCU
// While loop waits until the finished signal is given from the
// communications MCU, in which case it is shut off and power
// and read enable is given to the photo frame.
// The timer is also started for use of its interrupt.
// This creates the timeout before the screen turn off automatically.
void button_press(void)
{
Timer8_Stop();
SD_pwr_Switch(0);
Read_enable_Switch(0);
count = 0;
// Resets
// Resets
// Resets
// Resets
for(i=0; i < 21000; i++); // Delay waits for photo frame to give up control of SD
MCU2_pwr_Switch(1);
for(i=0; i < 800; i++);
if (decision == 1) ButtonSig1_Switch(1);
else if (decision == 2) ButtonSig2_Switch(1);
else if (decision == 3) ButtonSig3_Switch(1);
else if (decision == 4) ButtonSig4_Switch(1);
else if (decision == 5) ButtonSig5_Switch(1);
// Communications MCU turned on
// Delay for MCU2 warmup
// Sending button signal
for(i=0; i < 800; i++); // Delay for read of signal
while((PRT1DR & 0x08) == 0x00); // Waits for MCU2 finished signal
MCU2_pwr_Switch(0); // Turns off Communications MCU
Read_enable_Switch(1); // Turns on read enable
Comentários a estes Manuais