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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
06/20/06 01:24
Read: times


 
#118561 - Code Posted
Responding to: ???'s previous message
Hi, here you go, this pretty much sums up my test code I'm attempting to use to find the problem.

;|******** AT89C51RD2 XRAM CODE ******|
;| 
;|
:|*************************************

mov A,#83h ;load register and set AUXR reg. (83h) to enable XRAM
mov R0,A   ;size of 1792 bytes (max), XRAM is indirect
mov @R0,#10h ;AUXR = XRAM enabled, max size

mov A,#10h  ;Load DPTR with address for reading data table
mov DPL,A
mov A,#06h  ;DPTR = 0610h
mov DPH,A
;note data table starts at 0610h in ROM

READ_TABLE:
  clr A
  movc A,@A+DPTR ;Get byte from data table in ROM
  movx @DPTR,A   ;and store in XRAM, same address for convenience
  
  inc DPTR  ;increment DPTR to prepare for next add./iteration
  
  clr TI
  mov SBUF,A ;send out byte value for verification (serial)

wait_serial1: 
   jnb TI, wait_serial1 ;Wait for transmission

   mov A,DPL
   cjne A,#69h, READ_TABLE ;Loop until last byte was read

XRAM_TEST_READ:
   mov A,#10h
   mov DPL,A
   mov A,#06h  ;DPTR will = 0610h
   mov DPH,A  ;Place address of byte data test in DPTR
              ;(indirect addressing required for XRAM)
XRAM_READ_LOOP:
   movx A,@DPTR ;get byte from XRAM and loop until all read

   clr TI
   mov SBUF,A
wait_serial2:
   jnb TI,wait_serial2

   inc DPTR
   mov A,DPL
   cjne A,#69h,XRAM_READ_LOOP ;loop until last byte read

;*** END ***


I had to recall it from memory as I don't have the file here but that's it "to a T". I even read back the AUXR register and it's 10h as required for me by datasheet.

I love these little ATMELs, hope to get this figured out before the boss asks a lot of questions! :) Thanks!







List of 14 messages in thread
TopicAuthorDate
Ready to XRAM My Head Against the Wall!            01/01/70 00:00      
   Show us the code!            01/01/70 00:00      
   Post Your Code            01/01/70 00:00      
      Code Posted            01/01/70 00:00      
         OK            01/01/70 00:00      
            That's different on the Atmel            01/01/70 00:00      
         After reading the datasheet..            01/01/70 00:00      
            Already Did All of That...            01/01/70 00:00      
            What your code is doing...            01/01/70 00:00      
               I'll Try That            01/01/70 00:00      
                  Thats the magic of 8051!            01/01/70 00:00      
                     But wait! There's more!            01/01/70 00:00      
                        an obvious miss            01/01/70 00:00      
                           Problem Solved            01/01/70 00:00      

Back to Subject List