ECET340COMPLETE COURSE
ECET340 COMPLETE COURSE
Click below link for Answers
ECET340 Week 1 HomeWork 1
1.
Give three examples each of internal and external peripheral devices as referenced to
the HCS12 microcontroller and not an entire PC. (2 points)
2. Given “the requirements of each signal’s destination must match the capabilities of the signal’s source,” name some of the electrical signal parameters that must be considered when designing an interface between two different hardware components. (2 points)
2. Given “the requirements of each signal’s destination must match the capabilities of the signal’s source,” name some of the electrical signal parameters that must be considered when designing an interface between two different hardware components. (2 points)
3. Write down the instructions needed to program PORT A for pins PA7, PA4-PA0 as inputs and PA6-PA5 as outputs. Answer should be a valid C language statement. (2 points)
4. Write an instruction sequence to output the value $35 to PORT P. Use the C language only when writing your answer; - no assembly language. (2 points)
5. Write an instruction sequence to configure Port H for input, read in the current signal levels on the Port H pins, and store the value to a C variable called data1. Use the C language only when writing your answer, no assembly language. Also make sure to set the data direction register appropriately in your answer. (2 points)
6. Write a short program in C language which reads in the bits on port H, inverts the bits and adds 1 to the result, and then outputs the result onto port P. Be sure to include port initializations and variable declarations in your code. (2 points)
7. Using only Ports B, H, & J, (see Figure 1} write C code to read in the value from dip switch 1 (SW1) {all 8 bits}, invert the bits, and then display the results on the 8 LEDs driven by Port B (see Figure 3). When the value is a ‘1’, the LED is ON, and when it is a ‘0’, the LED is off. See how SW1 is connected to Port H (see Figure 2), and how the LEDs are connected to Port J (see Figure 3) (2 points)
8. What maximum current will be drawn from the 5V output of a peripheral device connected to an HCS12 input port? What input resistance does this represent? Please note the problem states connected to an HCS12 “input port”. (3 points)
9. Given an LED with a forward drop of 1.5V and an operating current of 10 mA, design the interface to the HCS12 showing your calculations. (3 points)
ECET340 Week 1 iLab 1
OBJECTIVES:
1.
To
become familiar with Microcontroller MC9S12 parallel ports and how simple input
and output devices are interfaced through them.
2.
To
learn how to program I/O instructions in C language.
3.
To
learn how to organize a program to read data from input ports, process the
data, and display the result on a simple output device.
ECET340 Week 2 HomeWork 2
1.
Where does program control transfer to when an interrupt occurs? +2 points
2. Which one of the following Interrupts
has highest priority? +2 points
3. RAM Vector table addresses
$3E52 belongs to which interrupt? +2 points
4. Before exiting an ISR, the
programmer should use which command? +2 points
5. In which one of the following
sequences is the stack pulled by rti? +3 points
6. Given the starting address for
the TC0 Interrupt is to become $5000. Write the assembly instruction necessary
to place this ISR address into the interrupt vector table and then unmask the
interrupt (assembly only). +3 points
7. Write the C statements needed
to place the address of an interrupt service routine that is to be called
PortJ_handler into the vector address for the Port J interrupt and then unmask
the interrupt. +3 points
8.
Circle the interrupt below that will have highest priority after the
statement ; is executed. +3 points
ECET340 Week 2 iLab 2
ECET340 Week 2 iLab 2
ECET340 Week 3 HomeWork 3
1.
Sketch a circuit that can be used to debounce a pushbutton and explain how it
works. (4 points max)
2.
In Figure 7.32 on page 339 of the Huang textbook, if the rowhas and
the columns are , which key is pressed? (2 points max)
3.
In Figure 7.32 on page 339 of the Huang textbook, explain why the 10kΩ
resistors ties to VCC are required. (2 points max)
4. Write down the lines of C code
(interrupt service routine, ISR) that generates an interrupt when Port H pin 0
becomes a logic “1”. Within this ISR, disable interrupts, clear the interrupt
flag, then enable interrupts, and return from routine. I also want the routine
or lines of C code that initialize Port H pin 0 to be used as an interrupt
(hint: think data direction register) (2 points max)
5.
Write down the C statements you would need to add to the main program of the
keypad driver program given in lecture and lab in order to store the key
characters to a buffer area of memory called keys_entered and
exit the program as soon as either seven keypresses are entered or the the “D”
key is entered. (Counts as two questions) (4 points max….you need to use arrays
in C code)
6. State the functions of pins
RS, E and R/W in the LCD. (4 points max)
7.
Give the state of RS, E and R/W~, and the command code (in hex) for the 20th
location, line 2 on the 40x2 LCD described in lecture. (2 points max)
ECET340 Week 3 iLab 3
SOLVED
ECET340 iLAB3
OBJECTIVES:
1.
To
learn the basic operation of a keypad.
2.
To
understand how to interface a keypad to a microprocessor.
3.
To
learn how to program a keypad driver in C language.
4.
To
learn how to program a keypad activated interrupt that identifies the key being
pressed and displays or otherwise returns its value to the main program.
ECET340 Week 4 HomeWork 4
1.
Determine the conversion time for an ADC0804 (8-bit), where 66 clocks per bit
are required, if its clock frequency is 50 kHz.
2. If an 8-bit SAR has Vref = 10 V, what is the binary value for an input voltage of 7.28 V?
3. What is the percent error for the binary answer found in Problem #2?
4. Given an 24 MHz bus speed. Write down the line(s) of instruction which set the ATD1 unit for 2MHz conversion frequency, 10-bit resolution and 8 A-to-D clocks per sample time.
5. A single 10-bit, left justified conversion of 3.75V is complete in ATD0. Assume and
i. Name the register(s) where the result of the conversion is found
ii. What are the values in each of the 16-bits of this register after conversion is complete? Assume the result is unsigned. Show work
6. Assume that a position-sensitive potentiometer can measure up to 25 cm over a voltage range of 0 to 5 V. If an 8-bit ADC outputs a value of 0111 1010, what is the distance measured?
7. Design the basic interface circuit (using an op amp) for a temperature sensor that covers a range of 0° to 70°C if the output of the sensor is 2 mV/1°C and the ADC voltage range is 0 to 4 V.
2. If an 8-bit SAR has Vref = 10 V, what is the binary value for an input voltage of 7.28 V?
3. What is the percent error for the binary answer found in Problem #2?
4. Given an 24 MHz bus speed. Write down the line(s) of instruction which set the ATD1 unit for 2MHz conversion frequency, 10-bit resolution and 8 A-to-D clocks per sample time.
5. A single 10-bit, left justified conversion of 3.75V is complete in ATD0. Assume and
i. Name the register(s) where the result of the conversion is found
ii. What are the values in each of the 16-bits of this register after conversion is complete? Assume the result is unsigned. Show work
6. Assume that a position-sensitive potentiometer can measure up to 25 cm over a voltage range of 0 to 5 V. If an 8-bit ADC outputs a value of 0111 1010, what is the distance measured?
7. Design the basic interface circuit (using an op amp) for a temperature sensor that covers a range of 0° to 70°C if the output of the sensor is 2 mV/1°C and the ADC voltage range is 0 to 4 V.
8. Design an amplifier suitable
for converting the output voltage from an LM35 temperature sensor (10 mV/°C)
into a signal that makes use of the full input voltage range (0-5V) of the
HCS12 ADC port pins. Assume the LM35 is to measure temperatures from 0°C up to
+150°C. Show work and circuit!
9. Given a sensor with W that
outputs voltage in the range +1.25V to +4.25V. Show the complete interface
circuitry needed to connect it to the A/D unit built-in to the HC12 Controller.
10.
Write the lines of C code needed to configure the A/D converter, start the
conversion, and output a hex integer in the range 0x0000 to 0xFFFF to the
variable called data1 that is proportional to
airflow input (0.0 to 1.0 litre/min). No further conversion is
required
ECET340 Week 6 iLab 6
ECET340 Week 6 iLab 6
ECET340 Week 7 HomeWork 7
1.
The movable part of the solenoid is the: +2 points
2.
Why is the 6N139 optoisolator used in the interfaces to devices such as large
motors? +2 points
3. Calculate the number of steps
per revolution for a stepper motor with a step angle of 7.5°. +2 points
4.
How is stepper motor speed controlled? State any two ways a program can do
this. +2 points
5. For this problem, you should
look at Figure 5A on the next page as a physical example of a stepper motor. It
is an example of a stepper motor with four (4) magnetic windings which are
connected via an interface circuit to the HCS12 Port T pins 4, 5, 6, & 7,
with an armature (rotor) that has 12 poles (combined number of North and South
magnetic poles). Notice how each step rotates the rotor 30 degrees, and notice
the logic states on the Port T pins going from Step 1 to Step 2. To rotate the
rotor 90 degrees, you would need three (3) steps (see figure 5A for
explanation).
6. Identify 2 major kinds of
devices that can be used to interface a dc motor to the HCS12. +2 points
7. Given that pulses need to be
delivered to a specific dc motor at the rate of 12.5 kHz to avoid vibration,
write down the C statements needed to output pulses from the HCS12 to drive the
at 80% of its full drive level. +2 points
8.
An HCS12 timer input capture/output compare register (TC0) holds the
value 0x498 when timing the period between pulses coming
in from a servomotor’s optical encoder (see Figure 8A below for setup of
optical encoder). Assume the counter/timer is operating at 1.0us. The encoder
wheel has 6 holes. Find the motor’s speed in RPM. Show work. +2 points
9.
Unidirectional dc motors often have high-voltage diode connected for
reverse-bias across the motor’s input terminals. Explain why this is
done. +2 points
10. What advantages do dc motors
offer over stepper motors? +2 points
ECET340 Week 7 iLab 7
ECET340 Week 7
iLab 7
ECET340 Complete Class / Devry
University / Graded A
ECET340
ALL HomeWork Assignments Week 1 - 7
ECET340
ALL iLabs
ECET340 COMPLETE COURSE ECET
340 COMPLETE COURSE
Click below link for Answers