Chapter 7: Microcontroller Interrupts and Timers
rojects
/ Demonstrator.h Joystick version
define PINB_MASK ((1<<PINB4)|(1<<PINB6)|(1<<PINB7))
#define PINE_MASK ((1<<PINE2)|(1<<PINE3))
#de
#de
oid parseInput(char *);
oid joystick(void);
pen the Demonstrator.c and change it to:
P
Grab your joystick – and test your interrupts..........................................
Create a new directory Joystick and copy the PC_comm. and Demonstrator .c and
.h files from the PC_comm. directory.
In Programmers Notepad change Demonstrator.h to:
/
#include <avr/signal.h>
#include <inttypes.h>
#define KEY_UP 0
#define KEY_DOWN 1
#define KEY_LEFT 2
#define KEY_RIGHT 3
#define KEY_PUSH 4
#define KEY_INVALID 5
#define BUTTON_A 6 // UP
#define BUTTON_B 7 // DOWN
#define BUTTON_C 2 // LEFT
#define BUTTON_D 3 // RIGHT
#define BUTTON_O 4 // PUSH
fine TRUE 1
fine FALSE 0
// declare functions
void PinChangeInterrupt(void);
char getkey(void);
void initializer(void);
v
v
O