Chapter 7: Microcontroller Interrupts and Timers
d Control version
#include "PC_Comm.h"
1<<PINB6)|(1<<PINB7))
2)|(1<<PINE3))
second
= 0; // IR detector count per second
astspeed = 0; // IR detector count per second
d initializer()
the oscillator:
OSCCAL_calibration();
SART
(1 << 7); // flag for PCINT15-8
PORTB for input
nable pullup on for input
tput
(1 << PIND0); // set pin 0 to enable pullup
lliS gnal
PC_Comm.c ready to communicate.\r");
elf specifically
are talking to the Motor Speed Control
r");
sendString("setxxx to set speed\r");
// Demonstrator.c Motor Spee
#include "Demonstrator.h"
#define PINB_MASK ((1<<PINB4)|(
#define PINE_MASK ((1<<PINE
unsigned char milliseconds = 0;
unsigned int second = 0; // count to 1000 and trigger one
event
unsigned int speed
unsigned int l
voi
{
// Calibrate
// Initialize the U
USARTinit();
// Set for pin change on PINB0
PCMSK0 = (1 << PINB0); //
EIFR =
EIMSK = (1 << 7); // mask for PCINT15-8
DDRB = 0X00; // set
PORTB = 0xFF; // e
// set PORTD for output
//DDRD = 0xFF;
DDRD = (1 << PIND0); // set pin 0 to ou
PORTD =
mi ecInit(127); // 50% duty cycle 1kHz si
// say hello
sendString("\r
// identify yours
sendString("You
demo.\
}