TURNIN FINAL Mini Project 2 in C

TURNIN FINAL Mini Project 2 in C - ME 106 Mini-Project 2 in...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
ME 106 10/21/08 Mini-Project 2 in C //-----------------------------------------------------Code Starts: #include <inttypes.h> #include <avr/io.h> #include <avr/interrupt.h> #include <avr/sleep.h> void initAll (void) { SREG=0x82; //Setting the registry to hex82, allows the global interrupt to work DDRB=0xFF; // setting the DDRam Port B as output,in hex FF is all ‘1’ DDRC=0xFF; //setting the DDRam Port C as output,in hex FF is all ‘1’ DDRD=0x00; //clearing the DDRam Port D as output,in hex FF is all ‘0’ //set stack pointer (fr:MiniProject1 in C) //SPH=0xFF; (fr:MiniProject1 in C) //SPL=0x10; Already done (fr:MiniProject1 in C) //set up Timer 2 for Phase Correct PWM, prescale=256 (fr:MiniProject1 in C) //use prescale=1 for testing (fr:MiniProject1 in C) TCCR2=0x61; //(fr:MiniProject1 in C) //set up A/D ADCSRA=0xE0; //(fr:MiniProject1 in C) ADMUX=0x40 ; //(fr:MiniProject1 in C) //PIN D bit 4 in the I/O view, Timer/Counter1Input Capture Pin is =(Tim1Capt1) //PIN4 catches the pulse when it is lite-up to switch on and turns off. //RPM must be converted to pulses for the program to read it rite off the //decoder. //
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/08/2010 for the course ME 106 at San Jose State.

Page1 / 3

TURNIN FINAL Mini Project 2 in C - ME 106 Mini-Project 2 in...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online