This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

I/O problem

Dear all,

I have a working program which has been running for about a year. This project uses the AT89C51ED2 from Atmel. Seeing as I was using uV Version 7.02 which didn't support this chip I decided to upgrade and am now running V7.50a (I believe the latest).

I did some alterations on the above mentioned project like changing timers and including the origional keil header file instead of the one I altered myself, and then recompiled.

Tested the project in the simulator, everything seems ok.

Then I flashed a chip and.... nothing....

Even the Outputs didn't get set to "0".

After examining the header files I came accross the following differences.

Old altered file:

sbit P1_7 = P1^7;
sbit P1_6 = P1^6;
sbit P1_5 = P1^5;

New AT89C51XD2.h file

Sbit (P1_7 , 0x90, 7);
Sbit (P1_6 , 0x90, 6);
Sbit (P1_5 , 0x90, 5);

etc...etc...etc...

In my progarm I have the following:

sbit relais = P1^1;
sbit active = P1^0;

etc...etc...

The question: Could this be the cause of the problem? If so, why don't I get compiler errors?

Thanks in advance for any responses.

Regards
John Garrelts

Parents
  • No offence taken Erik, glad for some help.

    I have written a simple trial program, can't get much simpler than this. and this also doesn't run.

    #include <REG51xD2.h>
    
    #include <stdio.h>
    
    sbit IObit_0	= P1^0;
    sbit IObit_1	= P1^1;
    
    
    void main(void)
    	{
    	IObit_0 = 0;
    	IObit_1 = 0;
    
    	while(1)
    		{
    		}
    	}
    

    As you see I'm just clearing two bits on port 1. The assembly listing seems ok too.

                 ; FUNCTION main (BEGIN)
                                               ; SOURCE LINE # 15
                                               ; SOURCE LINE # 16
                                               ; SOURCE LINE # 17
    0000 C290              CLR     IObit_0
                                               ; SOURCE LINE # 18
    0002 C291              CLR     IObit_1
    0004         ?C0001:
                                               ; SOURCE LINE # 20
                                               ; SOURCE LINE # 21
                                               ; SOURCE LINE # 22
    0004 80FE              SJMP    ?C0001
                 ; FUNCTION main (END)
    
    C51 COMPILER V7.50   REC_UNIT_LEDBLINK                                                     02/02/2005 10:53:46 PAGE 8
    
    NAME                                    CLASS   MSPACE  TYPE    OFFSET  SIZE
    ====                                    =====   ======  ====    ======  ====
    
    
    P1 . . . . . . . . . . . . . . . . . .  SFR      DATA   U_CHAR   0090H  1
    size_t . . . . . . . . . . . . . . . .  TYPEDEF  -----  U_INT    -----  2
    main . . . . . . . . . . . . . . . . .  PUBLIC   CODE   PROC     0000H  -----
    IObit_0. . . . . . . . . . . . . . . .  ABSBIT   -----  BIT      0090H  1
    IObit_1. . . . . . . . . . . . . . . .  ABSBIT   -----  BIT      0091H  1
    
    

    The offset's for the bits on Port-1 look ok. I just don't understand whats going on.
    Never had this problem before....

    I am now looking at my programmer to see if that is the cause of my problems.
    If anyone else can see anything wrong in the above please let me know. Again the above runs just fine in the simulator, but not on the live target.

    Kind regards
    John Garrelts

Reply
  • No offence taken Erik, glad for some help.

    I have written a simple trial program, can't get much simpler than this. and this also doesn't run.

    #include <REG51xD2.h>
    
    #include <stdio.h>
    
    sbit IObit_0	= P1^0;
    sbit IObit_1	= P1^1;
    
    
    void main(void)
    	{
    	IObit_0 = 0;
    	IObit_1 = 0;
    
    	while(1)
    		{
    		}
    	}
    

    As you see I'm just clearing two bits on port 1. The assembly listing seems ok too.

                 ; FUNCTION main (BEGIN)
                                               ; SOURCE LINE # 15
                                               ; SOURCE LINE # 16
                                               ; SOURCE LINE # 17
    0000 C290              CLR     IObit_0
                                               ; SOURCE LINE # 18
    0002 C291              CLR     IObit_1
    0004         ?C0001:
                                               ; SOURCE LINE # 20
                                               ; SOURCE LINE # 21
                                               ; SOURCE LINE # 22
    0004 80FE              SJMP    ?C0001
                 ; FUNCTION main (END)
    
    C51 COMPILER V7.50   REC_UNIT_LEDBLINK                                                     02/02/2005 10:53:46 PAGE 8
    
    NAME                                    CLASS   MSPACE  TYPE    OFFSET  SIZE
    ====                                    =====   ======  ====    ======  ====
    
    
    P1 . . . . . . . . . . . . . . . . . .  SFR      DATA   U_CHAR   0090H  1
    size_t . . . . . . . . . . . . . . . .  TYPEDEF  -----  U_INT    -----  2
    main . . . . . . . . . . . . . . . . .  PUBLIC   CODE   PROC     0000H  -----
    IObit_0. . . . . . . . . . . . . . . .  ABSBIT   -----  BIT      0090H  1
    IObit_1. . . . . . . . . . . . . . . .  ABSBIT   -----  BIT      0091H  1
    
    

    The offset's for the bits on Port-1 look ok. I just don't understand whats going on.
    Never had this problem before....

    I am now looking at my programmer to see if that is the cause of my problems.
    If anyone else can see anything wrong in the above please let me know. Again the above runs just fine in the simulator, but not on the live target.

    Kind regards
    John Garrelts

Children