program error

(instructions, reset, WDT, specifications...) PIC12F6xx, PIC16Fxxx, PIC16F6x, PIC16F7x

program error

Postby tharu » Tue Dec 02, 2014 3:36 pm

pls help me to get this program correct
Attachments
calculator.c
(3.23 KiB) Downloaded 96 times
tharu
 
Posts: 1
Joined: Thu Nov 20, 2014 1:46 pm
PIC experience: EE Student

Re: program error

Postby Joseph Watson » Tue Dec 02, 2014 7:20 pm

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.
NCR once refused to hire me because I was too short. I'm still waiting on my growth spurt.
User avatar
Joseph Watson
 
Posts: 49
Joined: Sat May 31, 2014 8:06 pm
Location: Ohio, USA
PIC experience: Experienced Hobbyist

Re: program error

Postby ric » Wed Dec 03, 2014 2:32 am

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.
Latest test project, an LED matrix display made from one reel of addressable LEDs. here
User avatar
ric
Verified identity
 
Posts: 453
Joined: Sat May 24, 2014 2:35 pm
Location: Melbourne, Australia
PIC experience: Professional 5+ years with MCHP products


Return to 14-Bit Core

Who is online

Users browsing this forum: No registered users and 1 guest