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

problem regarding garbage value

Hi,

I have developed a software in c(embedded).I used c51 compiler,8051(ATmel) microprocessor.I programmed to spot billing machines(machines that generate electricity bills) with the software.It is working fine in some machines,whereas in some machines iam getting a grabage value(for TAX column).WE calculate tax.

Iam not able to identify the problem.Please give me a suggestion.what would be the problem.


thanx in advance.

  • what would be the problem.

    There's a bug in the program.

    With the information you give, there is no way of even speculating any further.

  • But i didn't find any error or bug in my program.If there is any bug,it should effect all the machines.But it is happening in 3 machines out of 20.

  • "But i didn't find any error or bug in my program."

    Yes you did - you said it gives "garbage values"!!
    That, by definition, is a bug!

    If you couldn't see the problem when you have the code in front of you, how on earth is anyone else supposed to guess without even seeing it!

    "If there is any bug,it should effect all the machines"

    Not at all.
    It is very likely indeed that you have made some false assumption, and the other machines are actually only working by pure luck!

    On the other hand, it is possible that the problem machines have a bug and are sending invalid data. In that case, you have a choice:

    1. Get the problem machines fixed;

    2. Fix your code to cope with the problem machines.

    Only you can decide that one!

  • But it is happening in 3 machines out of 20.

    Well, let's see. That leaves 2 possibilities:

    1. The 17 other machines are working correctly by coincidence.

    This means that there is a bug in the program.

    2. The 3 machines are working incorrectly because they are somehow different from the 17 others.

    2a) The difference is in the hardware, i.e. the hardware is somehow not functioning as intended. Can happen. Bad soldering and the like.

    2b) The difference is in the environment (different input signals). This means the program is not reacting as intended to all expected environments. It is buggy.

    2c) The difference is in the user interaction. Either the user is doing something wrong and user education is required, or the program is not reacting correctly to normal user interaction ... it is buggy.

  • 1. The 17 other machines are working correctly by coincidence.

    This means that there is a bug in the program.


    1a)
    Timing. Often such problems (which are indeed due to "there is a bug in the program") are timing related.

    Erik

  • "Timing"

    Very possibly.

    For example:

    The 17 machines are all rather old and slow;
    they are all within the spec, but towards the slow end of all the permitted timings.
    Your unit works fine with these.

    The other 3 machines are newer and quicker;
    they are also all within the spec, but towards the fast end of all the permitted timings.
    Your unit is not quite fast enough, and so it fails with these units.

    Or, conversely:
    The 17 machines are all new and quick;
    they are all within the spec, but towards the fast end of all the permitted timings.
    Your unit works fine with these.

    The other 3 machines are older and slower;
    they are also all within the spec, but towards the slow end of all the permitted timings.
    Your unit is actually a little too quick on its timeouts, and so it fails with these units.


    The above illustrate how your unit could have a bug (in the timing), and yet work with some machines and not others.

    This doesn't prove that it is your bug - just that it could be your bug.

  • It is very likely indeed that you have made some false assumption, and the other machines are actually only working by pure luck!

    what you mean to say.How can you run your machines by pure luck.Iam using those machines from past 3 years.And how i can run 17 machines on pure luck.

    Now if the problem is with the software.It should effect all the machines because

    1.All machines are AT89c51RD2 machines (1MB Ram withno flash).
    2.WE insert same data in all the machines.
    3.Those 3 machines worked earlier properly.

    If te problem is with the hardware.
    1.Iam able to run my previous programs on those 3 mchines without any problem(but the new program is higher version of older one).
    2.I checked out the difference between the two.I didn't find anything suspicious that may corrupt the program.

    Now suggest me the solution.
    Even my hardware vendor is unable to findout the solution(whether the problem is with the hardware or software)

  • 2.I checked out the difference between the two.I didn't find anything suspicious that may corrupt the program.

    In that case, look harder.

    Roll back the changes one at a time and check when the program starts running correctly .. then you will have found a very likely culprit.

    Also, things might break your program that are not directly visible from the code. Maybe some interrupt service routine now takes a few cycles longer to execute, maybe the memory overlay mapping changed a little, etc.