??? 06/09/07 18:21 Modified: 06/09/07 18:21 Read: times |
#140486 - A- Responding to: ???'s previous message |
Russ Cooper said:
Jan, you are such a kidder, trying to ruffle Erik's feathers like that... 2 points. :-) Russ Cooper said:
sjmp ISR_UART_Echo ; and leave, echoing back the CR
At this point, the accumulator has been clobbered and the code at ISR_UART_Echo will transmit the message length byte, not a CR. I don't see how this this could have worked in the simulator. 2 extra points - I really did not check what was going out of the chip, I just checked that it went through that sequence. This is really my error. Russ Cooper said:
cjne r0,#RxBuff+RxSize,ISR_UART_Store
This is a classic "off by one" error that allows the buffer to be overrun by one byte. It doesn't show up in testing because the byte immediately following the RxBuffer isn't being used. Maybe Jan didn't even see this one? 2 points for finding this really nasty bug - although I remember I have thought about the value needed for this check, given that the "pointer increment first" is really not my style. Monday I need to look closer at the original (I don't have it with me at the moment). I "tweaked" it a bit after I uploaded (I removed the initialisation which is your point four, I though it is too straighforward if I leave the initialisation there) - maybe I spoiled this one in a momentary rush of madness? :-) Russ Cooper said:
Since the program is using R0 in register bank 1, the stack pointer must be initialized to address 8 or higher so that there is no conflict between the stack and R0 in bank 1. 2 points. This was the original goal of this lesson. Russ Cooper said:
The program doesn't initialize R0 in bank 1, so for the first input line, the program will store characters at some undetermined memory location, not in RxBuf as expected. 1 point - the explanation is NOT completely true, although as I said above, I really had the initialisation there but removed it. Russ Cooper said:
At least that's how it looks on the surface. But wait, he TRIED!!! it and it WORKED!!! Could it be that Jan has played some diabolical trick on us? This is why it is not A+. You did not try... :-) JW PS. Russ, I thought about it twice and I simply don't believe you don't already know how and why it does work. |
Topic | Author | Date |
weekend quiz - topic: interrupts | 01/01/70 00:00 | |
I spot two things wrong. | 01/01/70 00:00 | |
Three, maybe four | 01/01/70 00:00 | |
3?... 4??? | 01/01/70 00:00 | |
3 or 4, yes | 01/01/70 00:00 | |
Details, details, details | 01/01/70 00:00 | |
A- | 01/01/70 00:00 | |
Yes, I do know the trick. | 01/01/70 00:00 | |
OK, A+, then. | 01/01/70 00:00 | |
K&R is for weenies | 01/01/70 00:00 |