11.07.2015 Views

Builders guide robot pacman.pdf

Builders guide robot pacman.pdf

Builders guide robot pacman.pdf

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

We know that the timer counts at 1 MHz so that in 9.817 ms, the timerwill do 1 MHz × 9.817 ms = 9817 counts . If we set the timer value to be0xFFFF – 9817 = 55718 = 0xD9A6 at every interrupt, the timer willoverflow every 9.817 ms, creating an interrupt in which we will toggle thestepper output to create a 51 Hz square wave.Left StepperMotor DriverRight StepperMotor DriverPIC16F877MicrocontrollerFigure 36. Model of interface between PIC and stepper motor driversThe diagram above shows how the PIC interfaces to the stepper motors.6.1.5 Ghost Contact SensorThe Ghost contact sensor is connected to an interrupt pin on the PICbecause the Ghost can catch Pac-Man at any point during the game. Thisprevents polling which is susceptible to missing the signal and holds upCPU time. The following diagram models how the Ghost contact sensoris connected to the PIC.PIC16F877MicrocontrollerGhost ContactSensorFigure 37. Model of interface between PIC and Ghost contact sensor6.1.6 Maze Dot SensorThe maze-dot sensor is connected to an interrupt pin on the PIC for thesame reasons as the Ghost contact sensor. The following diagram modelshow the Maze dot sensor is connected to the PIC.PIC16F877MicrocontrollerMaze Dot SensorFigure 38. Model of interface between PIC and maze dot sensor29

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!