Getting Started

(lily) #1

Chapter 7: Microcontroller Interrupts and Timers


// parse first character

'm')&&(s[3]=='o')&&(s[4]=='?') )

n't understand.\r");

pt(void)

key;

ns |= (~PINE) & PINE_MASK;

switch (s[0])
{
case 'j':
if( (s[1] == 'o') && (s[2] == 'y'))
joystick();
break;
case 'd':


if((s[1]=='e')&&(s[2]==
sendString("You are talking to the JoyStick
demo.\r");
break;
default:
sendString("\rYou sent: '");
sendChar(s[0]);
sendString("' - I do
break;
}
s[0] = '\0';
}


void joystick()
{
if(ENABLED == 0) ENABLED = 1;
else ENABLED = 0;
}


SIGNAL(SIG_PIN_CHANGE0)
{
PinChangeInterrupt();
}


SIGNAL(SIG_PIN_CHANGE1)
{
PinChangeInterrupt();
}


void PinChangeInterru
{
char buttons;
char


buttons = (~PINB) & PINB_MASK;
butto

Free download pdf