Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
06/09/07 16:01
Modified:
  06/09/07 16:54

Read: times


 
#140483 - Details, details, details
Responding to: ???'s previous message
Jan said:
But, hey wait, I TRIED it in simulator and IT WORKED!

Jan, you are such a kidder, trying to ruffle Erik's feathers like that so that he will give us another one of his famous sermons. Well, I will save him the trouble so that he can sit under a tree with a nice cool lemonade and enjoy his weekend:

Erik might have said:
succesful testing does not prove the abscence of bugs, it only proves the abscence of known bugs

(You're welcome, Erik. :-))

Now, here are the bugs I found in the code for the quiz:

One
   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.

Two
    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?

Three

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.

Four

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.

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? Perhaps with the line
   lcall RxString
Hmm. I wonder ...

-- Russ


List of 10 messages in thread
TopicAuthorDate
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      

Back to Subject List