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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
02/24/09 18:20
Read: times


 
#162763 - SBUF problem
Hi Everybody,

For some reason that I can not puzzle out, the assembler instruction

MOV A, SBUF

does not transfer any value from SBUF to the accumulator. I determined that it does not work with the Keil debugger (using both µVision 2 and µVision 3). When stepping through the program, no value is loaded into the accumulator according to the system window.

In order to simulate input I type in a value (e.g. 0x4C) into the SBUF register on the serial port window and manually set the RI bit. This I do once program execution gets to the line

JNB RI, $

Once I set the value and the RI bit in the serial port window the program execution steps to the next line

CLR RI

and proceeds normally. Then it steps right on through

MOV A, SBUF

but no value is transferred into the accumulator.

I've also tried leaving a value in SBUF that was transferred there by a line of code elsewhere in the program, just in case the problem was a bug in the serial port window input box, but it still does not transfer the value into the accumulator.

I have looked into the Philips manuals, and I see that SBUF, though it maps as just 0x99 in address space, is actually two separate registers (one input and one output). However, I can not discover any way that I might control which one is accessed. In other words, the hardware (or presumably/hopefully the simulator/debugger) accesses the register that is appropriate to the instruction (and/or accurately simulates any transfers).

Now for the final twist. This code was working fine, actually running in the µ-controller and everything. It was part of a routine that transferred the formatted contents of a file into an external SRAM, and it was all working nicely. Then I changed a handful of unrelated lines of code. Really, they seem completely unrelated to the SBUF operation. The only lines I changed were CLR and SETB instructions concerning pins on ports 1 and 3. But once I made those changes the thing quit working and what I discovered I've described above.

Anybody have any ideas?

Joe

P.S. I am using the evaluation software from Keil, but the files compile and link normally, the program size is reported as code = 382, and the object file that is created is about 1783 bytes.

List of 9 messages in thread
TopicAuthorDate
SBUF problem            01/01/70 00:00      
   Your test case may be incorrect            01/01/70 00:00      
      Can not deduce            01/01/70 00:00      
   what is the state of the RI pin at idle?            01/01/70 00:00      
      U's            01/01/70 00:00      
         sorry, not the RI bit, the RI pin            01/01/70 00:00      
   May be here..            01/01/70 00:00      
      Good link            01/01/70 00:00      
      Thanks Everybody            01/01/70 00:00      

Back to Subject List