Académique Documents
Professionnel Documents
Culture Documents
CMA instruction! How many of you would even know off the top of your heads that the 8080 is an older Intel microprocessor? Instead of sending the blocks and any other characters over a serial port, the blocks and other characters should simply be written to an output file, xmodemSenderData.dat. This file should only contain bytes that would normally be sent from the sender to the receiver. Any bytes that would normally come from the receiver to the sender should not go in the file, at least for this assignment. I have written a rather complete template for you to modify. You will primarily need to modify the member functions genBlk(), resendBlk(), and start(). See the start() member function as given to you for a simulation of the protocol in operation and the use of these other three member functions (you will need to finish the start() member function). If at all possible for you, use the Posix functions read() and write() to read from and write to files. The template already makes some use of these Posix functions. These functions are used in our textbook for the course and we will be counting on these functions for the QNX programs you will be writing for later assignments. On Microsoft-Windows-based computers these functions are directly available when using the MinGW compiler (see the package of software for the course that I will make available). Do not modify lines of code in my templates unless such modifications are indicated or you explain in a comment why you have decided to make such modifications. Modifications that you feel improve the code are encouraged but otherwise modifications are discouraged as, among other things, they make marking more difficult and time consuming. Assume that the imaginary receiver sends a NAK to begin the transfer, always sends an ACK for odd numbered blocks, and for each even numbered block first sends a NAK and later sends an ACK for the retransmission. After the last block is ACKed, send an EOT, which will be NAKed, and then repeat the EOT. So for a file that fits in 4 blocks the imaginary receiver would send NAK, ACK, NAK,ACK, ACK, NAK,ACK, NAK, ACK For this assignment, dont worry about references to the CAN byte in the specification, and dont worry about timing. Just assume that a NAK or ACK will be received immediately after each block is sent. Also, for this assignment each block should send a checksum. In later assignments we may switch to using the CRC-16 method of detecting errors. As I understand is usually the case for ENSC courses, you are allowed to verbally discuss the assignments with classmates. However, for each person, whether a classmate or not, who significantly helps you with some part of the assignment, you must acknowledge their help. Please use the indicated area at the top of main.cc to do so. Any help that is not acknowledged constitutes academic dishonesty and can trigger university-specified penalties, which can include receiving a grade of FD for the course. Please consult the relevant university policies if you need to review them. Though verbal help is okay when acknowledged, it is not allowed to use code written by anyone other than your partner for the assignment while you are completing any assignment. It is also not allowed to share your code or your partners code or portions of such code with others. That means dont ask anyone for code or you could get them in trouble too. Any lines of code that may end up in WebCT discussions for the course may be used but should still be acknowledged. Obviously you should be judicious when posting lines of code to WebCT. Dont post more than is necessary to ask or answer a question.
3 January 2012