Homework 7 Solution

56 vref adlar 0 set adcw to be right justified mux4

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: a student skipped the prescalar of 1 it is fine **Note: If a student assumed worst case time is 2 clks it is fine also Name: Lab Section: Question 3: Software implemented Input Capture (15 pts) a) Complete the bubble diagram below to implement a Mealy State Machine that implements a positive edge detector (i.e. the state machine outputs 1 each time a positive edge occurs on the input). Assume at Start the input to the state machine is initially 0 ( 5 pts) b) Assume the ATMEGA128 does not have Input Capture hardware. Write a C program to save TIMER1’s count value when a positive edge event occurs on PortD, pin4. Note: you may want to do 4c first. (5 pts) int main(void) { unsigned int rising_edge_time; // For grading do not mark off for not having this DDRD &= 0b11101111; // set wire 4 of PortD for input while(1) { // Check if the current value of wire 4 is 0 if( ( PIND & 0b00010000) == 0) { // wai...
View Full Document

This document was uploaded on 04/07/2014.

Ask a homework question - tutors are online