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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
06/29/06 08:47
Read: times


 
#119321 - formatted code.
Responding to: ???'s previous message
Hope I have got the formatting right, now can I please have the corrections? I am in quite a bit of a hurry.
The code is not accepting more than 256 bytes, the ADDRS rolls over to 00h after 0ffh. Despite the change in RDCMD and WTCMD, the code only picks up 256 bytes. all subroutines work without any flaw.....the problem is in the main code.


;_________________________________________________________________ 
;--------------------------MAIN CODE------------------------------ 
;_________________________________________________________________ 



brw_main: 
     mov sp,#64h 
     mov p1,#0ffh 
     mov ie,#00h 
     acall s9k_main 


;_________________________________________________________________ 
;--------------------FULL WRITE SUBROUTINE------------------------ 
;_________________________________________________________________ 



full_write: 
      setb ROLLOVER ;indicates memory write into 1st half 
      mov ADDRS,#00h 
      mov WTCMD,#10100000B 

full_write_loop1: 
      acall rx_main 
      acall tx_main 

      mov I2C_IN,a 
      acall WRITE_iic 
      inc ADDRS 
      mov a,ADDRS 
      cjne a,#0ffh,full_write_loop2 

      jnb ROLLOVER,overload 
      mov WTCMD,#10100010B 
      mov ADDRS,#00h 
      clr ROLLOVER ;indicates memory write into 2nd half 

      full_write_loop2: 
      mov a,I2C_IN 
      cjne a,#27,full_write_loop1 

      mov dptr,#disp_leadthrough_complete 
      acall disp_message 
      ;sjmp $ 
      sjmp full_read ;delete this n enable previous inst 


;_________________________________________________________________ 
;-----------------MEMORY OVERWRITE PREVENTION--------------------- 
;_________________________________________________________________ 



overload: 
    mov dptr,#disp_overload 
    acall disp_message 
    sjmp $ 


;_________________________________________________________________ 
;--------------------FULL READ SUBROUTINE------------------------ 
;_________________________________________________________________ 



full_read: 
   mov ADDRS,#00h 
   mov RDCMD,#10100001B 

   mov dptr, #disp_executing_task 
   acall disp_message 

full_read_loop1: 
   acall READ_iic 
   mov a,I2C_OUT 
   lcall tx_main 
   inc ADDRS 

    mov a,ADDRS 
    cjne a,#0ffh,full_read_loop2 

    mov RDCMD,#10100011B 
    mov ADDRS,#00h 

full_read_loop2: 
    mov a,I2C_OUT 
    cjne a,#27,full_read_loop1 

    mov dptr, #disp_finish_read 
    acall disp_message 


    SJMP FULL_WRITE 


end 


List of 22 messages in thread
TopicAuthorDate
eeprom word addressing            01/01/70 00:00      
   do not confuse bits and bytes            01/01/70 00:00      
      maximum seerial memory chip available?            01/01/70 00:00      
         yes, you do            01/01/70 00:00      
   code not working            01/01/70 00:00      
      How to post code            01/01/70 00:00      
      formatted code.            01/01/70 00:00      
         I searched for a comment stating "write            01/01/70 00:00      
         "write device address"-i2c subroutine            01/01/70 00:00      
            you reply with an uncommented sub            01/01/70 00:00      
            formatted code with comments.            01/01/70 00:00      
               ORL a,HighAddressBit;            01/01/70 00:00      
                  Solution            01/01/70 00:00      
                     You 'can' make the chips you use work fo            01/01/70 00:00      
                        Question still remains unanswred            01/01/70 00:00      
                           i told you how            01/01/70 00:00      
                           One more time            01/01/70 00:00      
                              code written for that but not working            01/01/70 00:00      
                                 rather than trying to figure your code o            01/01/70 00:00      
   Corrections please, urgent.            01/01/70 00:00      
   It is in the data sheet            01/01/70 00:00      
   datasheet            01/01/70 00:00      

Back to Subject List