EE 2361 - Introduction to Microcontrollers
Summer Term, 2005
Homework Assignment 3
Due: Wednesday, July 20

  1. Suppose that the TCNT counter is incremented at a rate of 1 MHz.

    1. If the value in TCNT becomes $1000 at some initial time t1 and the value in TCNT becomes $2000 at a later time t2, calculate the quantity t2 - t1 (in milliseconds).


    2. If the value in TCNT becomes $4000 at some initial time t3 and the value in TCNT becomes $3000 at a later time t4, calculate the quantity t4 - t3 (in milliseconds).


  2. Assume that an asynchronous serial communications channel uses 1 start bit, 7 information bits, 1 parity bit and 1 stop bit, so that there are a total of 10 bits per frame.

    1. If the baud rate is 10,000 bits per second, calcuate the bit time (in milliseconds), the frame time (in milliseconds) and the number of frames per second.


    2. If the system is configured for odd parity, determine the correct value of the parity bit for each of the following 7-bit information fields: 0011100, 1010101.


  3. A fuzzy logic system has two crisp inputs, temperature and pressure. Trapezoidal membership functions are specified by the four bytes P1, P2, S1, |S2|, where P1 and P2 are the x-coordinates of the two base points of the trapezoid and where S1 and |S2| are the absolute values of the two slopes. The membership functions for temperature are as follows:
    
           cold:    $00, $33, $00, $0F
           warm:    $22, $99, $0F, $0F
           hot:     $88, $FF, $0F, $00
    
    
    The membership functions for pressure are as follows:
    
           low:     $00, $44, $00, $0F
           medium:  $33, $BB, $0F, $0F
           high:    $AA, $FF, $0F, $00
    
    
    The system has one crisp output, speed. The singleton membership functions for speed are as follows:
    
           slow = $30 , partial = $60 , fast = $90
    
    
    The rule base is as follows:
    
    Rule 1: If temperature is cold and pressure is low then speed is slow.
    Rule 2: If temperature is cold and pressure is medium then speed is slow.
    Rule 3: If temperature is cold and pressure is high then speed is partial.
    Rule 4: If temperature is warm and pressure is low then speed is slow.
    Rule 5: If temperature is warm and pressure is medium then speed is partial.
    Rule 6: If temperature is warm and pressure is high then speed is fast.
    Rule 7: If temperature is hot and pressure is low then speed is partial.
    Rule 8: If temperature is hot and pressure is medium then speed is fast.
    Rule 9: If temperature is hot and pressure is high then speed is fast.
    
    
    1. Let the crisp temperature input be $24 and the crisp pressure input be $B0. Calculate the fuzzy input values (expressed in hex format) for the six input membership functions.


    2. Assuming that the fuzzy output values had all been initialized to $00, calculate the corresponding fuzzy output values (expressed in hex format) for the three output membership functions.


    3. Calculate the crisp output value for speed (expressed in hex format).