Page 1 of 1

program error

PostPosted: Tue Dec 02, 2014 3:36 pm
by tharu
pls help me to get this program correct

Re: program error

PostPosted: Tue Dec 02, 2014 7:20 pm
by Joseph Watson
Hello tharu,

Have you successfully written programs in C (or any other computer language) prior to this one? I am not really a C programmer but I can see several major problems with your request.

1. I would recommend that you begin with a statement of exactly what you are trying to accomplish, a description of your approach for getting there, a description of what you have done so far, a detailed description of what specific problem you are currently struggling with, a description of your efforts to resolve that problem thus far, and a request for information or explanation about how others recommend that you should proceed. Simply requesting that someone help you "get this program correct" sounds like you want someone to do your work for you.

2. I suppose we can all guess from the file name that you are trying to make some kind of calculator. There surely are a lot of different things that might suggest.

3. I see a few references to some bits in Port B but you have no definition of the purpose of those bits. I would guess there must be some hardware associated with this program. Maybe you should tell your would-be helpers what the hardware environment is for your project. One might expect that you want your program to accept some input information and that you want it to output some kind of results. Do the input signals come from buttons, sensors, communication channels, or where exactly? Tell about each signal. When it is high, it means what? When low, it means what? Are there timing issues or rules? Have the signals been conditioned by hardware? Do they need to be conditioned by your software? Does the software need to debounce switch signals? Then there are a whole host of similar important details to be described about the output signals.

4. You seriously need to learn how to comment your work. It is not unreasonable to see a good program that has more comments than it has computer code. The comments not only help others to understand what you were thinking when you wrote each step of your program, they also very much help yourself to refresh your thinking when you are trying to chase down a problem or to make changes to your own program in the future. Learning to comment well is one of the most important skills a programmer can learn.

5. I suspect this program is no where close to completion. I am sure that you didn't expect that someone here would write it for you.

Re: program error

PostPosted: Wed Dec 03, 2014 2:32 am
by ric
Topic moved from "Introductions and general chat" to "[Microcontroller Discussion Group] ‹ 14-Bit Core"

I would agree with Joseph. You are being very presumptuous just throwing out a half finished program with next to no documentation, and expecting help.
You also seem to be using some non-standard C compiler, as I don't recognise the pragmas at the start.