Well done! You've shown tenacity and resourcefulness in taking a lot of new concepts, haphazardly explained, and put them to effective use. That's a good thing - he says, licking the red pencil with relish..
I'm not beating on you (one of the redlines is mine but is now a good illustration) but you are doing well and I want to contain the strays before they become unmanageable so here we go - nuts and bolts first:
/******* OverHeat Conversion routine **********************/
Overheat? What Overheat - this routine displays OFF - accurate comments are a must if you are going to maintain sanity.
SegBits Looks like a stray from my suggested header (which would determine the design of the function). So it looks like you took my suggestion to make a version of Int2Segs without really understanding some things. No problem with that. So.. what is SegBits and what does it do? There is nothing in the function body that uses it. (and I had to compile it myself to see that the compiler is OK with it.. hmmm).
x = i/100; et al. These no longer do anything and should be removed..
unsigned short x,i; ..and then you would not need to add dummy variables.
DigitsBuf[ofs+1] = SegTable[10]; Perfectly valid, since you correctly put the segment pattern for 'F' but I would not use '10' directly. Later on, you might change the order in the seg table. Its better to put its offset in a #define so that if it changes, the code follows.
As for mine:
unsigned short x; // this gets removed by the optimizer
My bad. That should have been removed long before this to avoid just this kind of confusion. A good rule of thumb is to clear up all warnings, messages from the compiler frequently. Then its easier to find the new ones and avoid replicating them.
Which is the purpose of all the redlining. Before going much further, make a clean up pass through the code and slick things up. Do it until the compiler issues no warnings or optimizer messages, etc. I suspect you were going to anyway but its important so I emphasize it.
OFFmsg - Does exactly what you want it to do and even better after some cleanup. But, it only displays one message. If each message requires its own routine you'll be burning ROM that you don't need to. The 'canned messages' approach I mentioned before allows you to pass a pointer to a character string (a one-dimensional array of bytes in C) to a single function to put it on the display. Sound better? If so, let me know.
All things considered, you are making great progress. While I may snipe at your methods, success is success and you should be happy with your progress!
Carry on!
Rich (BB code):
/******* OverHeat Conversion routine **********************/
void OFFmsg(SegBits, unsigned short ofs)
{
unsigned short x,i; // this gets removed by the optimizer
// Appends passed decimal point to first digit
x = i/100;
DigitsBuf[ofs] = SegTable[0];
x = (i/10)%10;
DigitsBuf[ofs+1] = SegTable[10];
x = (i%10);
DigitsBuf[ofs+2] = SegTable[10];
}
/******* OverHeat Conversion routine **********************/
Overheat? What Overheat - this routine displays OFF - accurate comments are a must if you are going to maintain sanity.
SegBits Looks like a stray from my suggested header (which would determine the design of the function). So it looks like you took my suggestion to make a version of Int2Segs without really understanding some things. No problem with that. So.. what is SegBits and what does it do? There is nothing in the function body that uses it. (and I had to compile it myself to see that the compiler is OK with it.. hmmm).
x = i/100; et al. These no longer do anything and should be removed..
unsigned short x,i; ..and then you would not need to add dummy variables.
DigitsBuf[ofs+1] = SegTable[10]; Perfectly valid, since you correctly put the segment pattern for 'F' but I would not use '10' directly. Later on, you might change the order in the seg table. Its better to put its offset in a #define so that if it changes, the code follows.
As for mine:
unsigned short x; // this gets removed by the optimizer
My bad. That should have been removed long before this to avoid just this kind of confusion. A good rule of thumb is to clear up all warnings, messages from the compiler frequently. Then its easier to find the new ones and avoid replicating them.
Which is the purpose of all the redlining. Before going much further, make a clean up pass through the code and slick things up. Do it until the compiler issues no warnings or optimizer messages, etc. I suspect you were going to anyway but its important so I emphasize it.
OFFmsg - Does exactly what you want it to do and even better after some cleanup. But, it only displays one message. If each message requires its own routine you'll be burning ROM that you don't need to. The 'canned messages' approach I mentioned before allows you to pass a pointer to a character string (a one-dimensional array of bytes in C) to a single function to put it on the display. Sound better? If so, let me know.
All things considered, you are making great progress. While I may snipe at your methods, success is success and you should be happy with your progress!
Carry on!