4180T2_F22s

.docx

School

Georgia Institute Of Technology *

*We aren’t endorsed by this school

Course

4180

Subject

Electrical Engineering

Date

Apr 3, 2024

Type

docx

Pages

4

Uploaded by BailiffMantisMaster1210

Score: _____________ Name:___________________________________________ EE 4180 Test II Test is open book and notes. No electronic devices. Place all answers in the spaces provided. 1. ( 5% ) What protocol is used on the Internet to ensure in order error free delivery of packets? ( answer using the acronym ) _____________ TCP _____________ 2. ( 5% ) What code is used to detect bit errors in an Ethernet packet? ( answer using the acronym ) _____________ CRC _____________ 3. ( 5% ) What protocol is typically used to transfer text data on web pages? ( answer using the acronym ) _____________ HTTP _____________ 4. ( 5% ) What C/C++ function call from the add-on IO library was used to set the LED pin to an output in lab 4 ( name only no arguments ) _____________ gpioSetMode _____________ 5. ( 5% ) What special Linux command line prefix had to be added in the C/C++ compiler's build options since it was required to execute the I/O library code to run the blink LED code in lab 4 on the Pi? _____________ sudo _____________ 6. ( 5% ) What C/C++ function call was used to add-on a time delay for the LED in the lab 4 code ( name only no arguments ) _____________ time_sleep _____________ 7. ( 5% ) Because of this hardware unit in the Pi's processor each process gets it's own memory address space, but it also prevents a user program from directly accessing the Pi's I/O hardware registers. ( answer using the acronym ) _____________ MMU _____________ 8. ( 5% ) What is the name of the Windows WIN32 C/C++API that provides a fast mutex lock type operation for threads? ( Does lock only, not declaring it or unlocking it ) ___________ EnterCriticalSection _______________ 9. ( 5% ) What is Microsoft's generic name of the small data base tables in memory where Window's stores I/O device names and the filenames of their device drivers along with other information about the OS and machine setup? ( one word, not the path ) ____________ registry ______________ 10. ( 5% ) What is the name of the Window's C++ function that can be used in device drivers to write to an 8-bit I/O port? ( name only don't list arguments or include parenthesis ) ____________ write_port_uchar ______________ 11. ( 5% ) In C#, what method can be used to communicate with mbed over the USB cable? ( name only don't list arguments or include parenthesis ) ____________ SerialPort ________________ 12. ( 5% ) A semaphore initialized to this value functions like a mutex lock, but the code in most implementations is slower. ____________ _1 _______________
13. ( 40% ) Write the remaining mbed C++ API and RTOS 2.0 code needed after the initial template code provided to complete the embedded device as described on the last page of the test. The solution requires around 60 short lines of additional code, so use two columns and the back of the page if needed. volatile int current_temp = 0; //last temperature reading volatile bool heater_on = false;//turn heater ON/OFF volatile int set_point = 20;//temperature setting Mutex LCD; //LCD mutex lock void Safety(void const *argument){ while(1) { if(tilt_switch) { heater_on = false; heat_relay = false; } Thread::wait(100.0); } } void Display(void const *argument){ while(1) { current_temp = ((LM61*3.3)-0.6)*100.0; LCD.lock(); uLCD.locate(2,3); uLCD.printf("%3.0d",current_temp); LCD.unlock(); Thread::wait(2.0*1000.0); } } void Blue_Remote(void const *argument){ char bnum; char bhit; while(1) { while(!blue.readable()) Thread::yield(); LCD.lock(); if (blue.getc()=='!') { if (blue.getc()=='B') { //button data packet bnum = blue.getc(); //button number bhit = blue.getc(); //1=hit, 0=release switch (bnum) { case '5': //button 5 up arrow if (bhit=='1') set_point++; break; case '6': //button 6 down arrow if (bhit=='1') set_point--; break; case '7': //button 7 left arrow if (bhit=='1') heater_on = !heater_on; break; default: break; } } } } uLCD.locate(2,6); uLCD.printf("%3.0d", set_point); LCD.unlock(); Thread::wait(50.0); } } int main(){ uLCD.text_height(2); uLCD.text_width(2); uLCD.printf(" Heater"); Thread thread2(Safety); Thread thread3(Display); Thread thread4(Blue_Remote); while(1) { if (((current_temp + 1) >= set_point) || !heater_on) heat_relay =0 ; if (((current_temp - 1) <= set_point)&& heater_on) heat_relay = 1; Thread::wait(2.0*1000.0); } }
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help