/*======== Proforma : EEET2246 Laboratory Test 3 - OUSB Process Control ============ Proforma version number: XXXXXXXXXXa PURPOSE: This file is a proforma for the EEET2246 Laboratory Test 3. This file...

please refer the given files


/*======== Proforma : EEET2246 Laboratory Test 3 - OUSB Process Control ============ Proforma version number: 2020.001.a PURPOSE: This file is a proforma for the EEET2246 Laboratory Test 3. This file defines the assessment task which is worth 15% of the available course grade - there is no other documentation. GOAL: Laboratory Test 3 task is to write a program that takes up to 2 command line arguments and makes several decisions based on certain register values on the OUSB Board. Due to the current University shut-down this assessment will use the OUSB Board simulator exclusively which is available on the subject Canvas website. Where this proforma mentions an OUSB Board, it is referring the simulator. To provide background the underlying hardware is briefly described. You will be required to read the 'PINC' and 'ADC 5' registers which are connected to the DIP switches and potentiometer on an OUSB Board, respectively. Your program will then perform a comparison (decision) on the input data from the command line arguments and simulated OUSB Board PINC / ADC 5 registers and write the largest value to be written to PORTB, as well as display the binary representation of the value to the console window. The binary representation of the largest value from the comparison must be written to the console using 8 characters (zero padded as necessary) to either display the binary representation in reverse or conventional order. You will need to account for the limitations in the hardware/simulator and appropriately write the correct value to the OUSB board, as well as perform any necessary error and range checking of input arguments. The value written to PORTB should always be in the conventional bit-order. The program decisions will be based on: - The first input argument, which must be a valid number between 0 and 255 input as a floating point number. This number will need to be rounded to the nearest integer (i.e. the value 3.4 will be rounded to 3 and 3.5 will rounded to 4). - The (optional) second input argument determines the type of comparison operation to undertake and the format of the output on the console window. The only valid arguments for the second command line argument are: "c1" Compare command line argument 1 to the OUSB Board switches (PINC) and display the larger value in binary to the console window in reverse order as well as write the value to PORTB. (Default) "c2" Compare command line argument 1 to the OUSB Board potentiometer (ADC 5) and display the larger value in binary to the console window in reverse order as well as write the value to PORTB. "c3" Compare command line argument 1 to the OUSB Board potentiometer (ADC 5) and switches (PINC) and display the larger value in binary to the console window in reverse order as well as write the value to PORTB. "c4" Same as option "c3", however display the larger value in binary to the console window in the correct order of bit7 through to bit0 in addition to writing the value to PORTB. If only one command line argument is provided, then a comparison between the first command line input argument and the OUSB Board switches should be performed (i.e. option "c1" by default). Note: - The value on the switches (PINC) is the value of 8 (DIP) switches on the OUSB Board, or the pinc.txt file if using the simulator. NOTE: Valid values in the pinc.txt file are integer numbers between 0 - 255 (i.e. 8-bits). - The value on the potentiometer (ADC 5) is derived from the potentiometer and resistive network connected to pin 5 of PORTA. If using the simulator, this value will come from the p_ADC5.txt file. NOTE: Valid values in the p_ADC5.txt file are integer numbers between 0 - 1023 (i.e. 10-bits). The program output will be via the OUSB Board LEDs connected to PORTB and the console window. The output to the console window under normal conditions will display the binary representation of the value at PORTB in the specified order followed by a new line character. If an error occurs the only output will be a one character error code followed by a new line character. The OUSB Board LEDs (PORTB) must not be updated if an error occurs. The emphasis in this lab is to achieve the basic FUNCTIONAL REQUIREMENTS, however your program will also need to consider range checking, as well as basic, intermediate and advanced error level detection and handling to achieve full marks. Initially it is recommended that you aim for "c1", "c2" and "c3" functionality and if time permits then attempt to implement "c4" functionality and error checking in priority order. RESOURCES: 1. Lecture and tutorial notes. 2. Prescribed Text book and the "Teach Yourself C++ in 21 Days" PDF ebook. 3. The Open-USB-IO Reference manual (PDF file on canvas under the "OUSB Board Resources" page 3. The ousb.exe file on canvas, which will provide the simulated OUSB Board functionality. SUBMISSION: You will be required to rename this *.cpp to the following format: lab3_1234567.cpp where the numbers 1234567 are your student number. The file should then be uploaded via Canvas before the due date and time. You are only required to upload this submission as a *.cpp file using the correct naming convention. No report is required - only the *.cpp file which you have created. Note: 10 marks per 24-hour period penalty will apply to late submissions (inclusive of weekends and public holidays). Therefore if you submit 1 minute late, a 10 mark penalty will be applied. MARKING: Your code will not be modified at all and must compile. Code that fails to compile will score 0%. Marking has several components- 1. your code will be checked for functionality. 2. your code will be tested with erroneous input. PLAGIARISM: The submission must be your code solution in its entirety. If your code is found to be similar to another submission it will be investigated for possible Academic Misconduct. Please respect the academic process and make sure your submission complies with RMIT's Student Conduct Policy. See: https://www.rmit.edu.au/about/governance-and-management/policies/student-conduct-policy */ /* ___________________________________________________________________________________________ ___ GENERAL SPECIFICATIONS (mostly common to all three EEET2246 Laboratory Tests): G1.You must rename your file to lab3_1234567.cpp, where 1234567 is your student number. Your filename MUST NEVER EVER contain any spaces. _under_score_is_Fine. You do not need to include the 's' in front of your student number. G2.Edit the name/email address string in the main() function to your student number, student email and student name.The format of the student ID line is CSV (Comma Separated Variables) with NO SPACES- student_id,student_email,student_name When the program is run without any operands i.e. simply the name of the executable such as: lab3_1234567.exe the program MUST print student ID string in Comma Separated Values (CSV) format with no spaces. For example the following text should be outputted to the console updated with your student details: "1234567,[email protected],FirstName_LastName" G3.All outputs are a binary representation of an integer or a single character error indicator followed by a linefeed ( endl or \n). G4.DO NOT add more than what is specified. Do NOT add additional information, text or comments to the output console. G5.DO NOT use 'cin', system("pause"), getchar(), gets(), etc. type functions. Do NOT ask for user input from the keyboard. All input MUST be specified on the command line separated by blank spaces (i.e. use the argv and argc input parameters). G6. DO NOT use the characters: * / \ : ^ ? in your command line arguments as your user input. These are special character and may not be processed as expected, potentially resulting in undefined behaviour of your program. G7.All input and output is case sensitive. G8.You should use the Integrated Debugging Environment (IDE) to change input arguments during the development process. G9.When your code exits the 'main()' function using the 'return' command then you MUST use zero as the return value. This requirement is for exiting the 'main()' function ONLY. G10. Do NOT put any functions after the 'main()' function - if you write your own functions then add them BEFORE the 'main()' function. This is a requirement of the Autotester and failure to do so will result in the Autotester not compiling your code correctly and loss of marks. G11. You MUST run this file as part of a Project - No other *.cpp or *.h files should be added to your solution. G12. The user-defined functions to read and write to the OUSB board must be written before the 'main()' function. This is a requirement of the Autotester and failure to do so will result in your code scoring 0. G13. If an error (as per the definition in this specification) occurs, then the value on the simulated OUSB PORTB (LEDs) must not to be updated. G14. All numerical values read from / written to the simulated OUSB Board are considered to be unsigned integers and are between 0 to 255 (inclusive) for PORTB register and 0 to 1023 for the ADC 5 register. G15. All binary numbers within this document have the prefix 0b. This notation is not C++ compliant (depending on the C++ version), however is used to avoid confusion between decimal, hexadecimal and binary number formats within the description and specification provided in this document. For example the number 10 in decimal could be written as 0xA in hexadecimal or 0b1010 in binary. It can equally be written with leading zeroes such as: 0x0A or 0b00001010. For output to the console screen you should only ever display the numerical characters only and omit the 0x or 0b prefixes. G16. Do not attempt to read/write to any other OUSB Board IO port other than PORTB, PINC or ADC pin 5 (adc 5). G17. The conversion to binary must occur in your code, not by using the -b switch as part of the OUSB.exe application. The '-b' flag will not be supported by the AutoTester. */ /* ___________________________________________________________________________________________ ___ FUNCTIONAL REQUIREMENTS: F1.For situations where NO command line arguments are passed to your program: F1.1Your program must display your correct student details in the format: "1234567,[email protected],FirstName_LastName" F2.For the situation where ONE command line argument is passed to your program: F2.1Your program must compare the rounded value (to the nearest integer) of the input argument with the value of the DIP switches connected to PINC of the OUSB Board. Whichever value is larger should then be written to PORTB (LEDs) of the OUSB Board. The value should also be displayed to the console window using the reverse binary representation in an 8 character long string (ie. Bit0,
Oct 02, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions ยป

Submit New Assignment

Copy and Paste Your Assignment Here