Always, on every assignment, please write your name legibly as it appears on your University ID and on the class list!
This assignment is dominated by review questions that are not as much specific to the material in the book as they are to material you should have learned in prior courses or work experience.
FORTRAN, an ancient computer language, contained a somewhat similar feature, the assigned GOTO. A program could assign a label to a variable and then later, use that variable as the target of a GOTO statement. The implementation of an assigned GOTO was trivial. The assign statement simply loaded the address referenced by the label into the variable, and the assigned GOTO simply did an indirect jump through the indicated variable.
The Problem: What is the difference between a control transfer initiated by longjmp() and a control transfer initiated by the older FORTRAN assigned GOTO.
_______________________________________ PIE1 | | | |TXIE| | | | | |____|____|____|____|____|____|____|____| TXIE = 0 -- transmit interrupt disabled TXIE = 1 -- transmit interrupt enbaled an interrupt will be requested if TXIF=1 and TXIE=1 _______________________________________ PIR1 | | | |TXIF| | | | | |____|____|____|____|____|____|____|____| TXIF = 0 -- transmit data register is in use TXIF = 1 -- transmit data register available _______________________________________ TXREG | Transmit Data Register | |_______________________________________| assignment of one character to TXREG when TXIF=1 will set TXIF=0 until the character in TXREG has been enqueued by the hardware for transmission. _______________________________________ TXSTA | |TX9 |TXEN| | | |TRMT|TX9D| |____|____|____|____|____|____|____|____| TX9 = 0 -- Transmit 8 bit data TX9 = 1 -- Transmit 9 bit data TXEN = 0 -- Disable transmitter TXEN = 1 -- Enable transmitter TRMT = 0 -- The transmitter queue is empty TRMT = 1 -- There is data in the transmitter queue TX9D -- the 9th bit of TXREG if TX9=1. note, assign to TX9D first before assigning to TXREG for 9 bit data!
Part A: How would you initialize these registers, and which of these registers would you initialize, prior to using this interface.
Part B: Write high level pseudocode for a function, TXPUTC, that outputs one character to the asynchronous serial port. This function should use polling to await the port-ready condition, then output the 8-bit character with mark parity. Assume the register names can be safely used as variable names in your code!