1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

problem in hex file

Discussion in '8051/8951' started by mausami kumari, Jun 4, 2016.

  1. mausami kumari

    mausami kumari New Member

    Joined:
    Jun 4, 2016
    Messages:
    7
    Likes:
    0
    the compiler is generating the hex file of 1KB
    my program is-
    // Coding (MAIN):
    Code (c):


    #include<reg51.h>

    sbit in=P1^1;
    sbit out=P1^2;
    sbit LED=P2^0;

    void delay_msec(int);

    void main()
    {
      int count=0;
      in=1;
    out=1;  //////  declaring ‘in’ and ‘out’ as input
    LED=0;
    while(1)
        {
         if(in==1)
            {
             while(!out){}
             count++;
             LED=1;
            delay_msec(1000);
            }
      if(out==1 && count)
         {
          while(!in){}
          count--;
          delay_msec(1000);
         if(!count)
             LED=0;
         }
      }
    }

    // Coding (delay.h):

    void delay_msec(int time)
    {
    int i=0;
    while(i<time)
       {
        TMOD=0x10;
        TH1=0xfc;
        TL1=0x66;
        TR1=1;
         while(TF1==0);
             {
              TR1=0;
              TF1=0;
              i++;
           }
       }
    }
     
    the compiler is showing 0 errors and 0 warning
    if the hex file is being created properly, please send it to my <email address deleted - Moderator>
    Please reply soon
    Its URGENT

    Moderator note:
    e-mail addresses in plain view on the forum are an invitation to spammers.
    Use the Conversation system for initial one to one communication.
     
    Last edited by a moderator: Jun 5, 2016
  2. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,165
    Likes:
    910
    Location:
    Rochdale UK
    ONLINE
    ????? What difference will my hex be to yours..
     
  3. mausami kumari

    mausami kumari New Member

    Joined:
    Jun 4, 2016
    Messages:
    7
    Likes:
    0
    so ,
    can a hex file be of 1kb?
    i thought there's any error if hex file generated is of 1kb
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,165
    Likes:
    910
    Location:
    Rochdale UK
    ONLINE

    The actual size is only 647 bytes.... It is only a very small file..
     
  6. mausami kumari

    mausami kumari New Member

    Joined:
    Jun 4, 2016
    Messages:
    7
    Likes:
    0
    ok
    that means my 1kb hex file is correct
     
  7. mvs sarma

    mvs sarma Well-Known Member

    Joined:
    Oct 29, 2006
    Messages:
    3,512
    Likes:
    76
    Location:
    Hyderabad, India.
    Perhaps files smaller than 1kb like hex files etc, are shown as 1kb
     
  8. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,165
    Likes:
    910
    Location:
    Rochdale UK
    ONLINE
    It's weird.... The file is 647 bytes... Shows as 1kb but takes up 4kb on a drive???
     
  9. mausami kumari

    mausami kumari New Member

    Joined:
    Jun 4, 2016
    Messages:
    7
    Likes:
    0
    please send me the hex file if you have created it
    please
     
  10. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,165
    Likes:
    910
    Location:
    Rochdale UK
    ONLINE
    It will be the same as yours...
     

    Attached Files:

  11. mausami kumari

    mausami kumari New Member

    Joined:
    Jun 4, 2016
    Messages:
    7
    Likes:
    0
    thankyou so much for your help
    now my doubts are cleared
     
  12. mvs sarma

    mvs sarma Well-Known Member

    Joined:
    Oct 29, 2006
    Messages:
    3,512
    Likes:
    76
    Location:
    Hyderabad, India.
    perhaps it depends on OS and filing system management. I am , of course , NOT and expert.
    try to see any file that is less than 1kB
    i use winXP, i never found one that is less than 1kb
     
  13. djsfantasi

    djsfantasi Member

    Joined:
    Mar 15, 2011
    Messages:
    161
    Likes:
    21
    Location:
    Metro Boston
    It depends on OS and the file system used. Files are stored in blocks and a block is 4kb (typically), 8kb, 16kb... I do not remember the specifics at this time, but I recall that Windows uses a default block size of 4kb. Hence, any filed that is 1 byte to 4096 bytes in general will take up the same amount of space on disk - 4kb. All OS work in this manner, so it's not a Windows thing.
     
  14. mausami kumari

    mausami kumari New Member

    Joined:
    Jun 4, 2016
    Messages:
    7
    Likes:
    0
    my hex file is of 412 bytes
    its different from yours
    please see the attached file
     

    Attached Files:

  15. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,165
    Likes:
    910
    Location:
    Rochdale UK
    ONLINE
    I use a different compiler to you.... The file will be different....
     
  16. mausami kumari

    mausami kumari New Member

    Joined:
    Jun 4, 2016
    Messages:
    7
    Likes:
    0
    ok now i understood
     
  17. vanan

    vanan New Member

    Joined:
    Jun 14, 2016
    Messages:
    8
    Likes:
    0
    Location:
    Chennai
    Hi
    if you using Keil complier it uses "startup.a51" to initialization for controller and SDCC will not, it always good practices to generate list file by configuring in the compiler option
     

    Attached Files:

Share This Page