ELEC 74 Worksheet 1 Logic Gate Review 1. Draw the truth table and schematic symbol for: a. An AND gate b. An OR gate c. An XOR gate d. A NOT gate
ELEC74 Worksheet 2 (Number Systems) 1. Convert the following binary numbers to octal, hexadecimal and decimal: Binary Octal Hexadecimal Decimal 00000001 0000 0010 0000 0100 0000 1000 0001 0000 0010 0000 0100 0000 1000 0000 0010 0011 0101 0110 0111 1001 1011 1100 1101 1110 1010 0101 0101 1010 0000 0000 1111 1111 1111 0000 0000 1111 2. Compute the following: a. 2 4 b. 16 2 c. 2 6 d. 8 2 e. 2 8 f. 16 4 g. 2 10 h. 2 20 3. How many unique values can be represented with an 8 bit, 16 bit and 32 bit binary numbers?
ELEC 74 Worksheet 3 Output Ports 1. Convert the following binary numbers to hex: 0101 1010 = 1101 1011 = 2. Write C code to set pins 1 as input and pin 2 as output. 3. If pins 0-3 are configured as output and pins 4-7 as input, and pin 0-7 are hooked up to LED s, how many LED s will light up after this command: bytetopins(0x3c, 0,1,2,3,4,5,6,7);? 4. What are the C language reserved words used to create an 8-bit unsigned variable? 5. In the pictured drawing, which side of the LED is connected to the microcontroller? anode or cathode 6. If the output voltage of the microcontroller is 3.3V and the forward bias voltage of the LED is 1.1V what is what is the required resistor value to have 22mA flowing through the LED?
ELEC 74 Worksheet 4 Inputs, Loops and Conditions 1. What is the logical AND operator? 2. What is the bitwise OR operator? 3. What is the result of a bitwise and (&) operation: 0 0 1 1 1 1 0 0 & 1 1 1 1 0 0 0 0 ------------------------- 4. What is the result of a bitwise or ( ) operation: 0xC3 0x0F? 5. What truth value does the following C language condition evaluate to? ( ( 0x05 & 0xF0 ) 0x01 ) 6. What value will x be when the following while loop exits? 7. How many times will have the loop been run? us8 i; us8 x; i = 1; while( i & 0x03 ) { i = i + 1; } x = i; 8. What is the voltage potential at the BUTTON net if the button is not pushed?
ELEC 74 Worksheet 5 Subroutines 1. Write a prototype for a function called add that takes two us8 parameters a and b and returns a us8 value? 2. Write the function for the above prototype that returns the sum of a and b. 3. If the value 13 is passed to the following subroutine what value does it return? us8 foo(us8 x) { return (x - 3) / 2; } 4. What is the purpose of a subroutine? a. To hide complexity of sophisticated algorithms. b. The make a program easier to read. c. To break up complex problems in to smaller more manageable tasks. d. To hold the place of a non-existent function while developing a program. e. All of the above. Use the following function prototype to answer the next four questions: us8 foo(us16 bar, us32 baz); 5. How many parameters does the function expect to be passed to it? 6. What is the return type of the function? 7. What is the name of the second parameter? 8. What is the type of the first parameter passed to the function?
ELEC 74 Worksheet 6 Asynchronous Serial Comm. 1. How many bits are transmitted per frame with 9600, 8, N, 1 UART communications? 2. What is the width in seconds of a bit transmitted at 115,200bps? 3. What is the width in seconds of an 8-bit frame with one stop bit no parity? 4. If you only needed to transmit in a single direction at a time in both directions what duplex scheme or schemes could you use? 5. Write the line of code that can be used to setup serial communications at 9600 bits per second using the Wiring abstractions. 6. What is the command to detect if any characters have been received by the target board? 7. What is the command to read a character out of the serial buffer? 8. If our desired bit rate is 115200 and our actual bit rate is 116312 using the following formula what is the percentage error from our desired bit rate? Error% = (Calculated Baud Rate - Desired Baud Rate)/Desired Baud Rate 100% 9. Will the error rate from the previous question be acceptable for most systems?
ELEC 74 Worksheet 7 - Pointers 1. Declare an 8-bit unsigned variable x: 2. Declare a pointer to an 8-bit unsigned variable px: 3. What is the value of x after this program runs? void main(void) { us8 x = 3; us8 y = 2; us8 *p; p = &y; x = x + *p; } 4. What is the value of c after this program runs? void main(void) { char c; char string[] = ABCDEF ; char *p = string; p = p + 3; c = *p; } 5. How many bytes are allocated by the following declaration? char string[] = MtSAC ; 6. Data in a queue (circular buffer) is put into and pulled out of in what order? 7. What are the hexadecimal values for the ASCII characters 0 (zero) and A (capital A)? 8. What is the hexadecimal value for the ASCII characters \r?
ELEC 74 Worksheet 8 Strings and Parsing 1. What is difference between an A and an a in the ASCII table? 2. What is the <string.h> library function for getting the length of a string? 3. What is the <string.h> library function for comparing the values of two strings? 4. What is the purpose of implied null (zero) character at the end of a character string in the C programming language? 5. When creating your own an library where are function prototypes declared? 6. When creating your own an library where are functions declared? 7. What is the notation for the including a user library called lightshow where the header for the library is called lightshow.h?
ELEC 74 Worksheet 9 ADC 1. ADC is an acronym for? 2. What are the inputs and outputs of an ADC? 3. Using a 10-bit ADC with a Vref of 5V what is reading when 1V is applied? 4. Using a 8-bit ADC with a Vref of 3.3V what voltage is required for a reading of 0x20? 5. What is the voltage resolution of an 8-bit ADC with a 3.3V reference? 6. What is the voltage resolution of a 16-bit ADC with a 3.3V reference?
ELEC 74 Worksheet 10 DAC / SPI 1. DAC is an acronym for? 2. DAC is an input or an output? 3. SPI is an acronym for? 4. The SPI signal MISO is an acronym for? 5. The SPI signal MOSI is an acronym for? 6. The SPI signal SDO is an acronym for? 7. The SPI signal SDI is an acronym for? 8. The SPI signal SCK is an acronym for? 9. Using a 16-bit DAC with a Vref of 5V what is value is required to output 1V? 10. Using an 8-bit DAC with a Vref of 3.3V what is the voltage output when it is set to 0x20?
ELEC 74 Worksheet 11 LCD / SPI Shift Registers 1. What does the acronym LCD stand for? 2. What is meant by bit mapped graphics? 3. What is meant by mono chromatic? 4. What does RGB stand for when referring to display technology? 5. What does pixel mean? 6. To cause a pixel on the LCD we are using in this class to become opaque what should the voltage for the segment be in relation to the backplane needed? 7. The D input to the serial to parallel shift register is hooked up to what output from the microcontroller? 8. The CLK input to the serial to parallel shift register is hooked up to what output from the microcontroller?
ELEC 74 Worksheet 12 C++ Classes 1. Objects and Instances? 2. Attributes? 3. Methods? 4. Public / Private? 5. How to declare an instance of an object? 6. How to call a member function of an object?