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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/13/04 07:49
Read: times


 
#68406 - STARTUP.A51
Responding to: ???'s previous message
Hello,

This is my startup.a51 file
$NOMOD51

IDATALEN        EQU     80H     

; Standard SFR Symbols 
ACC     DATA    0E0H
B       DATA    0F0H
SP      DATA    81H
DPL     DATA    82H
DPH     DATA    83H

                NAME    ?C_STARTUP

?C_C51STARTUP   SEGMENT   CODE
?STACK          SEGMENT   IDATA

                RSEG    ?STACK
                DS      32

                EXTRN CODE (?C_START)
                PUBLIC  ?C_STARTUP

                CSEG    AT      0
?C_STARTUP:     LJMP    STARTUP1

                RSEG    ?C_C51STARTUP

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

                MOV     SP,#?STACK-1
                LJMP    ?C_START

                END

And this my main.c file

#include <AT89X52.H>

void main(void)
{
	while(1)
	{
		P1 =0x0a;
		P0 =0x05;
	}	
}

If I delete the following code from the startup.a51 my C code works or else it doesnt...
IF IDATALEN <> 0
                MOV     R0,#IDATALEN - 1
                CLR     A
IDATALOOP:      MOV     @R0,A
                DJNZ    R0,IDATALOOP
ENDIF

I dont see any flaw in the above code ! But why is it not working...

Regards
Raj Shetgar

List of 22 messages in thread
TopicAuthorDate
Assembly works but C...            01/01/70 00:00      
   RE: Assembly works but C...            01/01/70 00:00      
      RE: Assembly works but C...            01/01/70 00:00      
         RE: Assembly works but C...            01/01/70 00:00      
            RE: Assembly works but C...            01/01/70 00:00      
               RE: Assembly works but C...            01/01/70 00:00      
   RE: Assembly works but C...            01/01/70 00:00      
      RE: Assembly works but C...            01/01/70 00:00      
         STARTUP.A51            01/01/70 00:00      
            RE: STARTUP.A51            01/01/70 00:00      
               RE: STARTUP.A51            01/01/70 00:00      
                  Stand Still...            01/01/70 00:00      
                     RE: Stand Still...            01/01/70 00:00      
                  RE: STARTUP.A51            01/01/70 00:00      
               RE: STARTUP.A51            01/01/70 00:00      
         function for LCD in C...            01/01/70 00:00      
            RE: function for LCD in C...            01/01/70 00:00      
      RE: Assembly works but C...            01/01/70 00:00      
         RE: Assembly works but C...            01/01/70 00:00      
            RE: Assembly works but C...            01/01/70 00:00      
               RE: Assembly works but C...            01/01/70 00:00      
            RE: Assembly works but C...            01/01/70 00:00      

Back to Subject List