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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
07/23/08 07:53
Read: times


 
#156964 - A sample code for your task
Responding to: ???'s previous message
Dear Alan,

Try this sample code. Here I hwve writen only one routine which is responsible for incrementing. Beauty of the routine is that it effects only r0, psw and the actual ram locations that are ment to alter. all other registers (including Accumulator) are untouched


acall read_num	;this routine reads from eeprom n stores number in desired location(0x60 to 0x69)
acall inc_num
acall stor_num  ;this routine stores incremented number back to eeprom
acall prn_num   ;this routine sends number to print / display etc


stor_num:

   push psw
   mov psw, #0
   push 0
   mov r0, #60h  ;initialising pointer

nxt_dig:

  inc @r0
  cjne @r0,#0Ah,go_ret
  mov @r0,#0
  inc r0
  cjne r0,#6Ah,nxt_dig

go_ret:

  pop 0
  pop psw
  ret



Try this n reply.
Wish u best luck

Regards,
Mahesh

List of 19 messages in thread
TopicAuthorDate
incrementing a large number in assembly            01/01/70 00:00      
   Wear and tear            01/01/70 00:00      
      The EEPROM is            01/01/70 00:00      
      F-RAM            01/01/70 00:00      
         F-RAM problem            01/01/70 00:00      
            what's the problem?            01/01/70 00:00      
               found a substitute            01/01/70 00:00      
   first do it in C, then            01/01/70 00:00      
      Load/Save in loop            01/01/70 00:00      
   To Answer Your Question ...            01/01/70 00:00      
      Thanks Russ - slow event            01/01/70 00:00      
   A sample code for your task            01/01/70 00:00      
      Sample code irrelevant            01/01/70 00:00      
         Socketed EEPROM?            01/01/70 00:00      
            walking writes are dead simple            01/01/70 00:00      
               Larger EEPROM = simple code            01/01/70 00:00      
            the counter is            01/01/70 00:00      
         good point            01/01/70 00:00      
            Blinkers            01/01/70 00:00      

Back to Subject List