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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/22/05 09:09
Read: times


 
#105723 - Keil's startup.a51
Responding to: ???'s previous message
Dear Shivani,
see the startup.a51 file from keil software. (www.keil.com)

IF IDATALEN <> 0
MOV R0,#IDATALEN - 1
CLR A
IDATALOOP: MOV @R0,A
DJNZ R0,IDATALOOP
ENDIF

Here IDATALEN is internal data memory length and is 0X80 defined in the same file by EQU directive. So IDATALEN - 1 = 0X7Fh
and becomes
MOV R0, #0X7Fh
everything here is same as what you have wrote.
But few comments from my side.

1. It is a good programming practice to clear the internal and external RAMs in the begining of code.

2. It is not necessary to write 0XFFh on ports after reset as they are already 0XFFh!

3. Not in this code, but it is general practice to put some delay while polling any external port pin. This is called as software key debounce and nicely explained in any 8051 microcontroller book.
eg.

; Poll the port pin P3.2. If it is 0 then wait for it to come
; to high and mov 00 on port 1.
...
...
system:
jb port3.2,system
delay:
mov r0, #0XFFh
djnz r0, delay
mov port1,#00h
...
...

or you can add one more instruction as
jnb port3.2, $ ; self loop
delay... ; delay routine as wrote above.

Or some timer delay for precision.

4. And last but not the least DO write comments.

Now as the code is OK, there may be problem somewhere else. So please check it thoroughly. I mean check the hex file and the way you are burning the file in flash of uC.
Can you not post the hex file here?

Dera Jan, Shivani is "she". Normally the first names of Indians ending with alphabet a and i are female names (ofcourse with some exceptions which are always there) But as already said by Erik, it is very difficult to know the location of forumites.

Regards
Sarang

List of 63 messages in thread
TopicAuthorDate
this code is not working            01/01/70 00:00      
   You solved it!            01/01/70 00:00      
      overreaction            01/01/70 00:00      
         Humility ?            01/01/70 00:00      
            Call it cultural difference...            01/01/70 00:00      
               Sounds familiar            01/01/70 00:00      
         thanks Jan Waclawek            01/01/70 00:00      
            Keil's startup.a51            01/01/70 00:00      
            hex seems OK            01/01/70 00:00      
               re hex seems OK            01/01/70 00:00      
                  And the switch?            01/01/70 00:00      
                     and switch            01/01/70 00:00      
                        Try a pull-up            01/01/70 00:00      
                           switch function            01/01/70 00:00      
                              Not at all            01/01/70 00:00      
                  reset cap            01/01/70 00:00      
                     yeah            01/01/70 00:00      
                        It can!            01/01/70 00:00      
                  points            01/01/70 00:00      
                     Some suggestions            01/01/70 00:00      
                        nope            01/01/70 00:00      
                           Use LEDs            01/01/70 00:00      
                        ok let me follow            01/01/70 00:00      
                           That sounds good !            01/01/70 00:00      
                           try this code            01/01/70 00:00      
                              and what good will that do?            01/01/70 00:00      
               How?            01/01/70 00:00      
                  capital            01/01/70 00:00      
                     Thanks!            01/01/70 00:00      
                        I did the same thing recently            01/01/70 00:00      
                           At least...            01/01/70 00:00      
            HORSEFEATHERS            01/01/70 00:00      
   i think yopu didn't got the message            01/01/70 00:00      
   of course it is not            01/01/70 00:00      
      It's easy to fix the code            01/01/70 00:00      
         no, he does not            01/01/70 00:00      
            wrong suggestion            01/01/70 00:00      
               it DOES NOT write to R0            01/01/70 00:00      
                  RE: it DOES NOT write to R0            01/01/70 00:00      
            why the continued discussion            01/01/70 00:00      
               Time zone            01/01/70 00:00      
                  just another guess            01/01/70 00:00      
                     She is most likely from India            01/01/70 00:00      
                  Irony            01/01/70 00:00      
   Help me            01/01/70 00:00      
      re help me            01/01/70 00:00      
         What happens if?            01/01/70 00:00      
            i will see            01/01/70 00:00      
            "mov @r0,#00h" by "NOP, NOP"?            01/01/70 00:00      
   A good idea            01/01/70 00:00      
      nothing postive            01/01/70 00:00      
         RAM fill ?            01/01/70 00:00      
            re ram fill            01/01/70 00:00      
               Simulator.            01/01/70 00:00      
                  Is the CPU really running?            01/01/70 00:00      
                     mov p1,r0            01/01/70 00:00      
                     last hope            01/01/70 00:00      
                        Tell this first            01/01/70 00:00      
                           let me clear            01/01/70 00:00      
                              pull ups            01/01/70 00:00      
                                 re pull ups            01/01/70 00:00      
                                    a word on pull ups            01/01/70 00:00      
                              What to say for that ignorance?            01/01/70 00:00      

Back to Subject List