Getting Started

(lily) #1

Chapter 7: Microcontroller Interrupts and Timers


;

DDRB |= 0xD8;

dString("You are talking to the JoyStick demo.\r");

// Demonstrator.c Joystick version


#include "PC_Comm.h"
#include "Demonstrator.h"


// declare global variables
volatile char KEY = 0
volatile char KEY_VALID = 0;
volatile char ENABLED = 0;


void initializer()
{


// Calibrate the oscillator:
OSCCAL_calibration();

// Initialize the USART
USARTinit();


// Init port pins

PORTB |= PINB_MASK;
DDRE = 0x00;
PORTE |= PINE_MASK;

// Enable pin change interrupt on PORTB and PORTE
PCMSK0 = PINE_MASK;
PCMSK1 = PINB_MASK;
EIFR = (1<<6)|(1<<7);
EIMSK = (1<<6)|(1<<7);


DDRD = 0xFF; // set PORTD for output
DDRB = 0X00; // set PORTB for input


PORTB = 0xFF; // enable pullup on for input
PORTD = 0XFF; // set LEDs off


// say hello
sendString("\rPC_Comm.c ready to communicate.\r");
// identify yourself specifically
sen


}


void parseInput(char s[])
{

Free download pdf